diff --git a/src/pscloud/HISTORY.rst b/src/pscloud/HISTORY.rst new file mode 100644 index 00000000000..abbff5a61a7 --- /dev/null +++ b/src/pscloud/HISTORY.rst @@ -0,0 +1,8 @@ +.. :changelog: + +Release History +=============== + +1.0.0b1 +++++++ +* Initial release. \ No newline at end of file diff --git a/src/pscloud/README.md b/src/pscloud/README.md new file mode 100644 index 00000000000..d4e174dc5dc --- /dev/null +++ b/src/pscloud/README.md @@ -0,0 +1,5 @@ +# Azure CLI Pscloud Extension # +This is an extension to Azure CLI to manage Pscloud resources. + +## How to use ## +Please add commands usage here. \ No newline at end of file diff --git a/src/pscloud/azext_pscloud/__init__.py b/src/pscloud/azext_pscloud/__init__.py new file mode 100644 index 00000000000..9375d49e1f4 --- /dev/null +++ b/src/pscloud/azext_pscloud/__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_pscloud._help import helps # pylint: disable=unused-import + + +class PscloudCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + custom_command_type = CliCommandType( + operations_tmpl='azext_pscloud.custom#{}') + super().__init__(cli_ctx=cli_ctx, + custom_command_type=custom_command_type) + + def load_command_table(self, args): + from azext_pscloud.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_pscloud._params import load_arguments + load_arguments(self, command) + + +COMMAND_LOADER_CLS = PscloudCommandsLoader diff --git a/src/pscloud/azext_pscloud/_help.py b/src/pscloud/azext_pscloud/_help.py new file mode 100644 index 00000000000..126d5d00714 --- /dev/null +++ b/src/pscloud/azext_pscloud/_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/pscloud/azext_pscloud/_params.py b/src/pscloud/azext_pscloud/_params.py new file mode 100644 index 00000000000..cfcec717c9c --- /dev/null +++ b/src/pscloud/azext_pscloud/_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/pscloud/azext_pscloud/aaz/__init__.py b/src/pscloud/azext_pscloud/aaz/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/pscloud/azext_pscloud/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/pscloud/azext_pscloud/aaz/latest/__init__.py b/src/pscloud/azext_pscloud/aaz/latest/__init__.py new file mode 100644 index 00000000000..f6acc11aa4e --- /dev/null +++ b/src/pscloud/azext_pscloud/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/pscloud/azext_pscloud/aaz/latest/pscloud/__cmd_group.py b/src/pscloud/azext_pscloud/aaz/latest/pscloud/__cmd_group.py new file mode 100644 index 00000000000..a7eb34dc8b1 --- /dev/null +++ b/src/pscloud/azext_pscloud/aaz/latest/pscloud/__cmd_group.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "pscloud", + is_preview=True, +) +class __CMDGroup(AAZCommandGroup): + """Manage Pure Storage + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/pscloud/azext_pscloud/aaz/latest/pscloud/__init__.py b/src/pscloud/azext_pscloud/aaz/latest/pscloud/__init__.py new file mode 100644 index 00000000000..5a9d61963d6 --- /dev/null +++ b/src/pscloud/azext_pscloud/aaz/latest/pscloud/__init__.py @@ -0,0 +1,11 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * diff --git a/src/pscloud/azext_pscloud/aaz/latest/pscloud/reservation/__cmd_group.py b/src/pscloud/azext_pscloud/aaz/latest/pscloud/reservation/__cmd_group.py new file mode 100644 index 00000000000..b04a2b1b766 --- /dev/null +++ b/src/pscloud/azext_pscloud/aaz/latest/pscloud/reservation/__cmd_group.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "pscloud reservation", + is_preview=True, +) +class __CMDGroup(AAZCommandGroup): + """Manage Reservation + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/pscloud/azext_pscloud/aaz/latest/pscloud/reservation/__init__.py b/src/pscloud/azext_pscloud/aaz/latest/pscloud/reservation/__init__.py new file mode 100644 index 00000000000..f68091245a7 --- /dev/null +++ b/src/pscloud/azext_pscloud/aaz/latest/pscloud/reservation/__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 ._delete import * +from ._list import * +from ._show import * +from ._wait import * diff --git a/src/pscloud/azext_pscloud/aaz/latest/pscloud/reservation/_delete.py b/src/pscloud/azext_pscloud/aaz/latest/pscloud/reservation/_delete.py new file mode 100644 index 00000000000..ed90c446240 --- /dev/null +++ b/src/pscloud/azext_pscloud/aaz/latest/pscloud/reservation/_delete.py @@ -0,0 +1,169 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "pscloud reservation delete", + is_preview=True, + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete a reservation + + :example: Reservations_Delete + az pscloud reservation delete --resource-group rgpurestorage --reservation-name reservation_resource_name + """ + + _aaz_info = { + "version": "2024-11-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/purestorage.block/reservations/{}", "2024-11-01-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.reservation_name = AAZStrArg( + options=["-n", "--name", "--reservation-name"], + help="Name of the reservation.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9\\-_]{1,127}$", + max_length=127, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.ReservationsDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class ReservationsDelete(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/PureStorage.Block/reservations/{reservationName}", + **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( + "reservationName", self.ctx.args.reservation_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-11-01-preview", + required=True, + ), + } + return parameters + + def on_204(self, session): + pass + + def on_200_201(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/pscloud/azext_pscloud/aaz/latest/pscloud/reservation/_list.py b/src/pscloud/azext_pscloud/aaz/latest/pscloud/reservation/_list.py new file mode 100644 index 00000000000..9a46385add5 --- /dev/null +++ b/src/pscloud/azext_pscloud/aaz/latest/pscloud/reservation/_list.py @@ -0,0 +1,549 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "pscloud reservation list", + is_preview=True, +) +class List(AAZCommand): + """List reservations by Azure subscription ID + + :example: Reservations_ListBySubscription + az pscloud reservation list + """ + + _aaz_info = { + "version": "2024-11-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/purestorage.block/reservations", "2024-11-01-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/purestorage.block/reservations", "2024-11-01-preview"], + ] + } + + AZ_SUPPORT_PAGINATION = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) + if condition_0: + self.ReservationsListBySubscription(ctx=self.ctx)() + if condition_1: + self.ReservationsListByResourceGroup(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 ReservationsListBySubscription(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/PureStorage.Block/reservations", + **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", "2024-11-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType( + flags={"required": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.marketplace = AAZObjectType( + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.reservation_internal_id = AAZStrType( + serialized_name="reservationInternalId", + flags={"read_only": True}, + ) + properties.user = AAZObjectType( + flags={"required": True}, + ) + + marketplace = cls._schema_on_200.value.Element.properties.marketplace + marketplace.offer_details = AAZObjectType( + serialized_name="offerDetails", + flags={"required": True}, + ) + marketplace.subscription_id = AAZStrType( + serialized_name="subscriptionId", + flags={"read_only": True}, + ) + marketplace.subscription_status = AAZStrType( + serialized_name="subscriptionStatus", + ) + + offer_details = cls._schema_on_200.value.Element.properties.marketplace.offer_details + offer_details.offer_id = AAZStrType( + serialized_name="offerId", + flags={"required": True}, + ) + offer_details.plan_id = AAZStrType( + serialized_name="planId", + flags={"required": True}, + ) + offer_details.plan_name = AAZStrType( + serialized_name="planName", + ) + offer_details.publisher_id = AAZStrType( + serialized_name="publisherId", + flags={"required": True}, + ) + offer_details.term_id = AAZStrType( + serialized_name="termId", + ) + offer_details.term_unit = AAZStrType( + serialized_name="termUnit", + ) + + user = cls._schema_on_200.value.Element.properties.user + user.company_details = AAZObjectType( + serialized_name="companyDetails", + ) + user.email_address = AAZStrType( + serialized_name="emailAddress", + flags={"required": True}, + ) + user.first_name = AAZStrType( + serialized_name="firstName", + flags={"required": True}, + ) + user.last_name = AAZStrType( + serialized_name="lastName", + flags={"required": True}, + ) + user.phone_number = AAZStrType( + serialized_name="phoneNumber", + ) + user.upn = AAZStrType() + + company_details = cls._schema_on_200.value.Element.properties.user.company_details + company_details.address = AAZObjectType() + company_details.company_name = AAZStrType( + serialized_name="companyName", + flags={"required": True}, + ) + + address = cls._schema_on_200.value.Element.properties.user.company_details.address + address.address_line1 = AAZStrType( + serialized_name="addressLine1", + flags={"required": True}, + ) + address.address_line2 = AAZStrType( + serialized_name="addressLine2", + ) + address.city = AAZStrType( + flags={"required": True}, + ) + address.country = AAZStrType( + flags={"required": True}, + ) + address.postal_code = AAZStrType( + serialized_name="postalCode", + flags={"required": True}, + ) + address.state = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + class ReservationsListByResourceGroup(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/PureStorage.Block/reservations", + **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", "2024-11-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType( + flags={"required": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.marketplace = AAZObjectType( + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.reservation_internal_id = AAZStrType( + serialized_name="reservationInternalId", + flags={"read_only": True}, + ) + properties.user = AAZObjectType( + flags={"required": True}, + ) + + marketplace = cls._schema_on_200.value.Element.properties.marketplace + marketplace.offer_details = AAZObjectType( + serialized_name="offerDetails", + flags={"required": True}, + ) + marketplace.subscription_id = AAZStrType( + serialized_name="subscriptionId", + flags={"read_only": True}, + ) + marketplace.subscription_status = AAZStrType( + serialized_name="subscriptionStatus", + ) + + offer_details = cls._schema_on_200.value.Element.properties.marketplace.offer_details + offer_details.offer_id = AAZStrType( + serialized_name="offerId", + flags={"required": True}, + ) + offer_details.plan_id = AAZStrType( + serialized_name="planId", + flags={"required": True}, + ) + offer_details.plan_name = AAZStrType( + serialized_name="planName", + ) + offer_details.publisher_id = AAZStrType( + serialized_name="publisherId", + flags={"required": True}, + ) + offer_details.term_id = AAZStrType( + serialized_name="termId", + ) + offer_details.term_unit = AAZStrType( + serialized_name="termUnit", + ) + + user = cls._schema_on_200.value.Element.properties.user + user.company_details = AAZObjectType( + serialized_name="companyDetails", + ) + user.email_address = AAZStrType( + serialized_name="emailAddress", + flags={"required": True}, + ) + user.first_name = AAZStrType( + serialized_name="firstName", + flags={"required": True}, + ) + user.last_name = AAZStrType( + serialized_name="lastName", + flags={"required": True}, + ) + user.phone_number = AAZStrType( + serialized_name="phoneNumber", + ) + user.upn = AAZStrType() + + company_details = cls._schema_on_200.value.Element.properties.user.company_details + company_details.address = AAZObjectType() + company_details.company_name = AAZStrType( + serialized_name="companyName", + flags={"required": True}, + ) + + address = cls._schema_on_200.value.Element.properties.user.company_details.address + address.address_line1 = AAZStrType( + serialized_name="addressLine1", + flags={"required": True}, + ) + address.address_line2 = AAZStrType( + serialized_name="addressLine2", + ) + address.city = AAZStrType( + flags={"required": True}, + ) + address.country = AAZStrType( + flags={"required": True}, + ) + address.postal_code = AAZStrType( + serialized_name="postalCode", + flags={"required": True}, + ) + address.state = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/pscloud/azext_pscloud/aaz/latest/pscloud/reservation/_show.py b/src/pscloud/azext_pscloud/aaz/latest/pscloud/reservation/_show.py new file mode 100644 index 00000000000..c4ada3aed31 --- /dev/null +++ b/src/pscloud/azext_pscloud/aaz/latest/pscloud/reservation/_show.py @@ -0,0 +1,315 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "pscloud reservation show", + is_preview=True, +) +class Show(AAZCommand): + """Get a reservation + + :example: Reservations_Get + az pscloud reservation show --resource-group rgpurestorage --reservation-name reservation_resource_name + """ + + _aaz_info = { + "version": "2024-11-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/purestorage.block/reservations/{}", "2024-11-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.reservation_name = AAZStrArg( + options=["-n", "--name", "--reservation-name"], + help="Name of the reservation.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9\\-_]{1,127}$", + max_length=127, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ReservationsGet(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 ReservationsGet(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/PureStorage.Block/reservations/{reservationName}", + **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( + "reservationName", self.ctx.args.reservation_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-11-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.marketplace = AAZObjectType( + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.reservation_internal_id = AAZStrType( + serialized_name="reservationInternalId", + flags={"read_only": True}, + ) + properties.user = AAZObjectType( + flags={"required": True}, + ) + + marketplace = cls._schema_on_200.properties.marketplace + marketplace.offer_details = AAZObjectType( + serialized_name="offerDetails", + flags={"required": True}, + ) + marketplace.subscription_id = AAZStrType( + serialized_name="subscriptionId", + flags={"read_only": True}, + ) + marketplace.subscription_status = AAZStrType( + serialized_name="subscriptionStatus", + ) + + offer_details = cls._schema_on_200.properties.marketplace.offer_details + offer_details.offer_id = AAZStrType( + serialized_name="offerId", + flags={"required": True}, + ) + offer_details.plan_id = AAZStrType( + serialized_name="planId", + flags={"required": True}, + ) + offer_details.plan_name = AAZStrType( + serialized_name="planName", + ) + offer_details.publisher_id = AAZStrType( + serialized_name="publisherId", + flags={"required": True}, + ) + offer_details.term_id = AAZStrType( + serialized_name="termId", + ) + offer_details.term_unit = AAZStrType( + serialized_name="termUnit", + ) + + user = cls._schema_on_200.properties.user + user.company_details = AAZObjectType( + serialized_name="companyDetails", + ) + user.email_address = AAZStrType( + serialized_name="emailAddress", + flags={"required": True}, + ) + user.first_name = AAZStrType( + serialized_name="firstName", + flags={"required": True}, + ) + user.last_name = AAZStrType( + serialized_name="lastName", + flags={"required": True}, + ) + user.phone_number = AAZStrType( + serialized_name="phoneNumber", + ) + user.upn = AAZStrType() + + company_details = cls._schema_on_200.properties.user.company_details + company_details.address = AAZObjectType() + company_details.company_name = AAZStrType( + serialized_name="companyName", + flags={"required": True}, + ) + + address = cls._schema_on_200.properties.user.company_details.address + address.address_line1 = AAZStrType( + serialized_name="addressLine1", + flags={"required": True}, + ) + address.address_line2 = AAZStrType( + serialized_name="addressLine2", + ) + address.city = AAZStrType( + flags={"required": True}, + ) + address.country = AAZStrType( + flags={"required": True}, + ) + address.postal_code = AAZStrType( + serialized_name="postalCode", + flags={"required": True}, + ) + address.state = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/pscloud/azext_pscloud/aaz/latest/pscloud/reservation/_wait.py b/src/pscloud/azext_pscloud/aaz/latest/pscloud/reservation/_wait.py new file mode 100644 index 00000000000..ece46ec3df2 --- /dev/null +++ b/src/pscloud/azext_pscloud/aaz/latest/pscloud/reservation/_wait.py @@ -0,0 +1,310 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "pscloud reservation wait", +) +class Wait(AAZWaitCommand): + """Place the CLI in a waiting state until a condition is met. + """ + + _aaz_info = { + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/purestorage.block/reservations/{}", "2024-11-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.reservation_name = AAZStrArg( + options=["-n", "--name", "--reservation-name"], + help="Name of the reservation.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9\\-_]{1,127}$", + max_length=127, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ReservationsGet(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 ReservationsGet(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/PureStorage.Block/reservations/{reservationName}", + **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( + "reservationName", self.ctx.args.reservation_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-11-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.marketplace = AAZObjectType( + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.reservation_internal_id = AAZStrType( + serialized_name="reservationInternalId", + flags={"read_only": True}, + ) + properties.user = AAZObjectType( + flags={"required": True}, + ) + + marketplace = cls._schema_on_200.properties.marketplace + marketplace.offer_details = AAZObjectType( + serialized_name="offerDetails", + flags={"required": True}, + ) + marketplace.subscription_id = AAZStrType( + serialized_name="subscriptionId", + flags={"read_only": True}, + ) + marketplace.subscription_status = AAZStrType( + serialized_name="subscriptionStatus", + ) + + offer_details = cls._schema_on_200.properties.marketplace.offer_details + offer_details.offer_id = AAZStrType( + serialized_name="offerId", + flags={"required": True}, + ) + offer_details.plan_id = AAZStrType( + serialized_name="planId", + flags={"required": True}, + ) + offer_details.plan_name = AAZStrType( + serialized_name="planName", + ) + offer_details.publisher_id = AAZStrType( + serialized_name="publisherId", + flags={"required": True}, + ) + offer_details.term_id = AAZStrType( + serialized_name="termId", + ) + offer_details.term_unit = AAZStrType( + serialized_name="termUnit", + ) + + user = cls._schema_on_200.properties.user + user.company_details = AAZObjectType( + serialized_name="companyDetails", + ) + user.email_address = AAZStrType( + serialized_name="emailAddress", + flags={"required": True}, + ) + user.first_name = AAZStrType( + serialized_name="firstName", + flags={"required": True}, + ) + user.last_name = AAZStrType( + serialized_name="lastName", + flags={"required": True}, + ) + user.phone_number = AAZStrType( + serialized_name="phoneNumber", + ) + user.upn = AAZStrType() + + company_details = cls._schema_on_200.properties.user.company_details + company_details.address = AAZObjectType() + company_details.company_name = AAZStrType( + serialized_name="companyName", + flags={"required": True}, + ) + + address = cls._schema_on_200.properties.user.company_details.address + address.address_line1 = AAZStrType( + serialized_name="addressLine1", + flags={"required": True}, + ) + address.address_line2 = AAZStrType( + serialized_name="addressLine2", + ) + address.city = AAZStrType( + flags={"required": True}, + ) + address.country = AAZStrType( + flags={"required": True}, + ) + address.postal_code = AAZStrType( + serialized_name="postalCode", + flags={"required": True}, + ) + address.state = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/pscloud/azext_pscloud/aaz/latest/pscloud/storagepool/__cmd_group.py b/src/pscloud/azext_pscloud/aaz/latest/pscloud/storagepool/__cmd_group.py new file mode 100644 index 00000000000..5506636463c --- /dev/null +++ b/src/pscloud/azext_pscloud/aaz/latest/pscloud/storagepool/__cmd_group.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "pscloud storagepool", + is_preview=True, +) +class __CMDGroup(AAZCommandGroup): + """Manage Storage Pool + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/pscloud/azext_pscloud/aaz/latest/pscloud/storagepool/__init__.py b/src/pscloud/azext_pscloud/aaz/latest/pscloud/storagepool/__init__.py new file mode 100644 index 00000000000..3aa479319b8 --- /dev/null +++ b/src/pscloud/azext_pscloud/aaz/latest/pscloud/storagepool/__init__.py @@ -0,0 +1,19 @@ +# -------------------------------------------------------------------------------------------- +# 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 ._get_avs_status import * +from ._get_health_status import * +from ._list import * +from ._show import * +from ._update import * +from ._wait import * diff --git a/src/pscloud/azext_pscloud/aaz/latest/pscloud/storagepool/_create.py b/src/pscloud/azext_pscloud/aaz/latest/pscloud/storagepool/_create.py new file mode 100644 index 00000000000..0909866bffb --- /dev/null +++ b/src/pscloud/azext_pscloud/aaz/latest/pscloud/storagepool/_create.py @@ -0,0 +1,434 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "pscloud storagepool create", + is_preview=True, +) +class Create(AAZCommand): + """Create a storage pool + + :example: StoragePools_Create + az pscloud storagepool create --resource-group rgpurestorage --storage-pool-name storagePoolname --availability-zone Zone3 --vnet-injection "{subnet-id:subnet_resource_id,vnet-id:vnet_resource_id}" --provisioned-bandwidth 992 --reservation-id reservation_resource_id --tags "{key7593:vsyiygyurvwlfaezpuqu}" --location Central US + """ + + _aaz_info = { + "version": "2024-11-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/purestorage.block/storagepools/{}", "2024-11-01-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.storage_pool_name = AAZStrArg( + options=["-n", "--name", "--storage-pool-name"], + help="Name of the storage pool", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9\\-_]{1,127}$", + max_length=127, + min_length=1, + ), + ) + + # 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.availability_zone = AAZStrArg( + options=["--availability-zone"], + arg_group="Properties", + help="Azure Availability Zone the Pool is located in", + ) + _args_schema.provisioned_bandwidth = AAZIntArg( + options=["--provisioned-bandwidth"], + arg_group="Properties", + help="Total bandwidth provisioned for the pool, in MB/s", + ) + _args_schema.reservation_id = AAZStrArg( + options=["--reservation-id"], + arg_group="Properties", + help="Azure resource ID of the Pure Storage Cloud service (reservation resource) this storage pool belongs to", + ) + _args_schema.vnet_injection = AAZObjectArg( + options=["--vnet-injection"], + arg_group="Properties", + help="Network properties of the storage pool", + ) + + vnet_injection = cls._args_schema.vnet_injection + vnet_injection.subnet_id = AAZStrArg( + options=["subnet-id"], + help="Azure resource ID of the Virtual Network subnet where the storage pool will be connected", + required=True, + ) + vnet_injection.vnet_id = AAZStrArg( + options=["vnet-id"], + help="Azure resource ID of the Virtual Network in which the subnet is located", + required=True, + ) + + # define Arg Group "Resource" + + _args_schema = cls._args_schema + _args_schema.location = AAZResourceLocationArg( + arg_group="Resource", + help="The geo-location where the resource lives", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Resource", + help="Resource tags.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.StoragePoolsCreate(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 StoragePoolsCreate(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/PureStorage.Block/storagePools/{storagePoolName}", + **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( + "storagePoolName", self.ctx.args.storage_pool_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", "2024-11-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("identity", AAZIdentityObjectType) + _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + _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("availabilityZone", AAZStrType, ".availability_zone", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("provisionedBandwidthMbPerSec", AAZIntType, ".provisioned_bandwidth", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("reservationResourceId", AAZStrType, ".reservation_id", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("vnetInjection", AAZObjectType, ".vnet_injection", typ_kwargs={"flags": {"required": True}}) + + vnet_injection = _builder.get(".properties.vnetInjection") + if vnet_injection is not None: + vnet_injection.set_prop("subnetId", AAZStrType, ".subnet_id", typ_kwargs={"flags": {"required": True}}) + vnet_injection.set_prop("vnetId", AAZStrType, ".vnet_id", typ_kwargs={"flags": {"required": True}}) + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.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( + flags={"client_flatten": True}, + ) + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + 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.availability_zone = AAZStrType( + serialized_name="availabilityZone", + flags={"required": True}, + ) + properties.avs = AAZObjectType( + flags={"read_only": True}, + ) + properties.data_retention_period = AAZIntType( + serialized_name="dataRetentionPeriod", + flags={"read_only": True}, + ) + properties.provisioned_bandwidth_mb_per_sec = AAZIntType( + serialized_name="provisionedBandwidthMbPerSec", + flags={"required": True}, + ) + properties.provisioned_iops = AAZIntType( + serialized_name="provisionedIops", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.reservation_resource_id = AAZStrType( + serialized_name="reservationResourceId", + flags={"required": True}, + ) + properties.storage_pool_internal_id = AAZStrType( + serialized_name="storagePoolInternalId", + flags={"read_only": True}, + ) + properties.vnet_injection = AAZObjectType( + serialized_name="vnetInjection", + flags={"required": True}, + ) + + avs = cls._schema_on_200_201.properties.avs + avs.avs_enabled = AAZBoolType( + serialized_name="avsEnabled", + flags={"required": True}, + ) + avs.sddc_resource_id = AAZStrType( + serialized_name="sddcResourceId", + ) + + vnet_injection = cls._schema_on_200_201.properties.vnet_injection + vnet_injection.subnet_id = AAZStrType( + serialized_name="subnetId", + flags={"required": True}, + ) + vnet_injection.vnet_id = AAZStrType( + serialized_name="vnetId", + flags={"required": True}, + ) + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200_201.tags + tags.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/pscloud/azext_pscloud/aaz/latest/pscloud/storagepool/_delete.py b/src/pscloud/azext_pscloud/aaz/latest/pscloud/storagepool/_delete.py new file mode 100644 index 00000000000..56872644320 --- /dev/null +++ b/src/pscloud/azext_pscloud/aaz/latest/pscloud/storagepool/_delete.py @@ -0,0 +1,169 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "pscloud storagepool delete", + is_preview=True, + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete a storage pool + + :example: StoragePools_Delete + az pscloud storagepool delete --resource-group rgpurestorage --storage-pool-name storagePoolname + """ + + _aaz_info = { + "version": "2024-11-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/purestorage.block/storagepools/{}", "2024-11-01-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.storage_pool_name = AAZStrArg( + options=["-n", "--name", "--storage-pool-name"], + help="Name of the storage pool", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9\\-_]{1,127}$", + max_length=127, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.StoragePoolsDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class StoragePoolsDelete(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/PureStorage.Block/storagePools/{storagePoolName}", + **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( + "storagePoolName", self.ctx.args.storage_pool_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", "2024-11-01-preview", + required=True, + ), + } + return parameters + + def on_204(self, session): + pass + + def on_200_201(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/pscloud/azext_pscloud/aaz/latest/pscloud/storagepool/_get_avs_status.py b/src/pscloud/azext_pscloud/aaz/latest/pscloud/storagepool/_get_avs_status.py new file mode 100644 index 00000000000..2459b38c26a --- /dev/null +++ b/src/pscloud/azext_pscloud/aaz/latest/pscloud/storagepool/_get_avs_status.py @@ -0,0 +1,181 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "pscloud storagepool get-avs-status", + is_preview=True, +) +class GetAvsStatus(AAZCommand): + """Returns the status of the storage pool connection to AVS + + :example: StoragePools_GetAvsStatus + az pscloud storagepool get-avs-status --resource-group rgpurestorage --storage-pool-name storagePoolname + """ + + _aaz_info = { + "version": "2024-11-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/purestorage.block/storagepools/{}/getavsstatus", "2024-11-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.storage_pool_name = AAZStrArg( + options=["--storage-pool-name"], + help="Name of the storage pool", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9\\-_]{1,127}$", + max_length=127, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.StoragePoolsGetAvsStatus(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 StoragePoolsGetAvsStatus(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/PureStorage.Block/storagePools/{storagePoolName}/getAvsStatus", + **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( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "storagePoolName", self.ctx.args.storage_pool_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", "2024-11-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.avs_enabled = AAZBoolType( + serialized_name="avsEnabled", + flags={"required": True}, + ) + _schema_on_200.current_connection_status = AAZStrType( + serialized_name="currentConnectionStatus", + flags={"required": True}, + ) + _schema_on_200.sddc_resource_id = AAZStrType( + serialized_name="sddcResourceId", + ) + + return cls._schema_on_200 + + +class _GetAvsStatusHelper: + """Helper class for GetAvsStatus""" + + +__all__ = ["GetAvsStatus"] diff --git a/src/pscloud/azext_pscloud/aaz/latest/pscloud/storagepool/_get_health_status.py b/src/pscloud/azext_pscloud/aaz/latest/pscloud/storagepool/_get_health_status.py new file mode 100644 index 00000000000..57de988268c --- /dev/null +++ b/src/pscloud/azext_pscloud/aaz/latest/pscloud/storagepool/_get_health_status.py @@ -0,0 +1,249 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "pscloud storagepool get-health-status", + is_preview=True, +) +class GetHealthStatus(AAZCommand): + """Retrieve health metrics of a storage pool + + :example: StoragePools_GetHealthStatus + az pscloud storagepool get-health-status --resource-group rgpurestorage --storage-pool-name storagePoolname + """ + + _aaz_info = { + "version": "2024-11-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/purestorage.block/storagepools/{}/gethealthstatus", "2024-11-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.storage_pool_name = AAZStrArg( + options=["--storage-pool-name"], + help="Name of the storage pool", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9\\-_]{1,127}$", + max_length=127, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.StoragePoolsGetHealthStatus(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 StoragePoolsGetHealthStatus(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/PureStorage.Block/storagePools/{storagePoolName}/getHealthStatus", + **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( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "storagePoolName", self.ctx.args.storage_pool_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", "2024-11-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.alerts = AAZListType( + flags={"required": True}, + ) + _schema_on_200.health = AAZObjectType( + flags={"required": True}, + ) + + alerts = cls._schema_on_200.alerts + alerts.Element = AAZObjectType() + + _element = cls._schema_on_200.alerts.Element + _element.level = AAZStrType( + flags={"required": True}, + ) + _element.message = AAZStrType( + flags={"required": True}, + ) + + health = cls._schema_on_200.health + health.bandwidth_usage = AAZObjectType( + serialized_name="bandwidthUsage", + flags={"required": True}, + ) + health.data_reduction_ratio = AAZFloatType( + serialized_name="dataReductionRatio", + flags={"required": True}, + ) + health.estimated_max_capacity = AAZIntType( + serialized_name="estimatedMaxCapacity", + flags={"required": True}, + ) + health.iops_usage = AAZObjectType( + serialized_name="iopsUsage", + flags={"required": True}, + ) + health.space = AAZObjectType( + flags={"required": True}, + ) + health.used_capacity_percentage = AAZFloatType( + serialized_name="usedCapacityPercentage", + flags={"required": True}, + ) + + bandwidth_usage = cls._schema_on_200.health.bandwidth_usage + bandwidth_usage.current = AAZFloatType( + flags={"required": True}, + ) + bandwidth_usage.max = AAZFloatType( + flags={"required": True}, + ) + bandwidth_usage.provisioned = AAZFloatType( + flags={"required": True}, + ) + + iops_usage = cls._schema_on_200.health.iops_usage + iops_usage.current = AAZFloatType( + flags={"required": True}, + ) + iops_usage.max = AAZFloatType( + flags={"required": True}, + ) + iops_usage.provisioned = AAZFloatType( + flags={"required": True}, + ) + + space = cls._schema_on_200.health.space + space.shared = AAZIntType( + flags={"required": True}, + ) + space.snapshots = AAZIntType( + flags={"required": True}, + ) + space.total_used = AAZIntType( + serialized_name="totalUsed", + flags={"required": True}, + ) + space.unique = AAZIntType( + flags={"required": True}, + ) + + return cls._schema_on_200 + + +class _GetHealthStatusHelper: + """Helper class for GetHealthStatus""" + + +__all__ = ["GetHealthStatus"] diff --git a/src/pscloud/azext_pscloud/aaz/latest/pscloud/storagepool/_list.py b/src/pscloud/azext_pscloud/aaz/latest/pscloud/storagepool/_list.py new file mode 100644 index 00000000000..83347da4831 --- /dev/null +++ b/src/pscloud/azext_pscloud/aaz/latest/pscloud/storagepool/_list.py @@ -0,0 +1,521 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "pscloud storagepool list", + is_preview=True, +) +class List(AAZCommand): + """List storage pools by Azure subscription ID + + :example: StoragePools_ListBySubscription + az pscloud storagepool list + """ + + _aaz_info = { + "version": "2024-11-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/purestorage.block/storagepools", "2024-11-01-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/purestorage.block/storagepools", "2024-11-01-preview"], + ] + } + + AZ_SUPPORT_PAGINATION = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) + if condition_0: + self.StoragePoolsListBySubscription(ctx=self.ctx)() + if condition_1: + self.StoragePoolsListByResourceGroup(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 StoragePoolsListBySubscription(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/PureStorage.Block/storagePools", + **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", "2024-11-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType( + flags={"required": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.identity = AAZIdentityObjectType() + _element.location = AAZStrType( + flags={"required": 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.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.availability_zone = AAZStrType( + serialized_name="availabilityZone", + flags={"required": True}, + ) + properties.avs = AAZObjectType( + flags={"read_only": True}, + ) + properties.data_retention_period = AAZIntType( + serialized_name="dataRetentionPeriod", + flags={"read_only": True}, + ) + properties.provisioned_bandwidth_mb_per_sec = AAZIntType( + serialized_name="provisionedBandwidthMbPerSec", + flags={"required": True}, + ) + properties.provisioned_iops = AAZIntType( + serialized_name="provisionedIops", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.reservation_resource_id = AAZStrType( + serialized_name="reservationResourceId", + flags={"required": True}, + ) + properties.storage_pool_internal_id = AAZStrType( + serialized_name="storagePoolInternalId", + flags={"read_only": True}, + ) + properties.vnet_injection = AAZObjectType( + serialized_name="vnetInjection", + flags={"required": True}, + ) + + avs = cls._schema_on_200.value.Element.properties.avs + avs.avs_enabled = AAZBoolType( + serialized_name="avsEnabled", + flags={"required": True}, + ) + avs.sddc_resource_id = AAZStrType( + serialized_name="sddcResourceId", + ) + + vnet_injection = cls._schema_on_200.value.Element.properties.vnet_injection + vnet_injection.subnet_id = AAZStrType( + serialized_name="subnetId", + flags={"required": True}, + ) + vnet_injection.vnet_id = AAZStrType( + serialized_name="vnetId", + flags={"required": True}, + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + class StoragePoolsListByResourceGroup(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/PureStorage.Block/storagePools", + **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", "2024-11-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType( + flags={"required": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.identity = AAZIdentityObjectType() + _element.location = AAZStrType( + flags={"required": 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.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.availability_zone = AAZStrType( + serialized_name="availabilityZone", + flags={"required": True}, + ) + properties.avs = AAZObjectType( + flags={"read_only": True}, + ) + properties.data_retention_period = AAZIntType( + serialized_name="dataRetentionPeriod", + flags={"read_only": True}, + ) + properties.provisioned_bandwidth_mb_per_sec = AAZIntType( + serialized_name="provisionedBandwidthMbPerSec", + flags={"required": True}, + ) + properties.provisioned_iops = AAZIntType( + serialized_name="provisionedIops", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.reservation_resource_id = AAZStrType( + serialized_name="reservationResourceId", + flags={"required": True}, + ) + properties.storage_pool_internal_id = AAZStrType( + serialized_name="storagePoolInternalId", + flags={"read_only": True}, + ) + properties.vnet_injection = AAZObjectType( + serialized_name="vnetInjection", + flags={"required": True}, + ) + + avs = cls._schema_on_200.value.Element.properties.avs + avs.avs_enabled = AAZBoolType( + serialized_name="avsEnabled", + flags={"required": True}, + ) + avs.sddc_resource_id = AAZStrType( + serialized_name="sddcResourceId", + ) + + vnet_injection = cls._schema_on_200.value.Element.properties.vnet_injection + vnet_injection.subnet_id = AAZStrType( + serialized_name="subnetId", + flags={"required": True}, + ) + vnet_injection.vnet_id = AAZStrType( + serialized_name="vnetId", + flags={"required": True}, + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/pscloud/azext_pscloud/aaz/latest/pscloud/storagepool/_show.py b/src/pscloud/azext_pscloud/aaz/latest/pscloud/storagepool/_show.py new file mode 100644 index 00000000000..4afba3bfbec --- /dev/null +++ b/src/pscloud/azext_pscloud/aaz/latest/pscloud/storagepool/_show.py @@ -0,0 +1,301 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "pscloud storagepool show", + is_preview=True, +) +class Show(AAZCommand): + """Get a storage pool + + :example: StoragePools_Get + az pscloud storagepool show --resource-group rgpurestorage --storage-pool-name storagePoolname + """ + + _aaz_info = { + "version": "2024-11-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/purestorage.block/storagepools/{}", "2024-11-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.storage_pool_name = AAZStrArg( + options=["-n", "--name", "--storage-pool-name"], + help="Name of the storage pool", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9\\-_]{1,127}$", + max_length=127, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.StoragePoolsGet(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 StoragePoolsGet(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/PureStorage.Block/storagePools/{storagePoolName}", + **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( + "storagePoolName", self.ctx.args.storage_pool_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", "2024-11-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.identity = AAZIdentityObjectType() + _schema_on_200.location = AAZStrType( + flags={"required": 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.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.availability_zone = AAZStrType( + serialized_name="availabilityZone", + flags={"required": True}, + ) + properties.avs = AAZObjectType( + flags={"read_only": True}, + ) + properties.data_retention_period = AAZIntType( + serialized_name="dataRetentionPeriod", + flags={"read_only": True}, + ) + properties.provisioned_bandwidth_mb_per_sec = AAZIntType( + serialized_name="provisionedBandwidthMbPerSec", + flags={"required": True}, + ) + properties.provisioned_iops = AAZIntType( + serialized_name="provisionedIops", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.reservation_resource_id = AAZStrType( + serialized_name="reservationResourceId", + flags={"required": True}, + ) + properties.storage_pool_internal_id = AAZStrType( + serialized_name="storagePoolInternalId", + flags={"read_only": True}, + ) + properties.vnet_injection = AAZObjectType( + serialized_name="vnetInjection", + flags={"required": True}, + ) + + avs = cls._schema_on_200.properties.avs + avs.avs_enabled = AAZBoolType( + serialized_name="avsEnabled", + flags={"required": True}, + ) + avs.sddc_resource_id = AAZStrType( + serialized_name="sddcResourceId", + ) + + vnet_injection = cls._schema_on_200.properties.vnet_injection + vnet_injection.subnet_id = AAZStrType( + serialized_name="subnetId", + flags={"required": True}, + ) + vnet_injection.vnet_id = AAZStrType( + serialized_name="vnetId", + flags={"required": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/pscloud/azext_pscloud/aaz/latest/pscloud/storagepool/_update.py b/src/pscloud/azext_pscloud/aaz/latest/pscloud/storagepool/_update.py new file mode 100644 index 00000000000..c7e24e6c03c --- /dev/null +++ b/src/pscloud/azext_pscloud/aaz/latest/pscloud/storagepool/_update.py @@ -0,0 +1,514 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "pscloud storagepool update", + is_preview=True, +) +class Update(AAZCommand): + """Update a storage pool + + :example: update_example + az pscloud storagepool update --resource-group rgpurestorage --name storagePoolName --provisioned-bandwidth 1024 + """ + + _aaz_info = { + "version": "2024-11-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/purestorage.block/storagepools/{}", "2024-11-01-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + AZ_SUPPORT_GENERIC_UPDATE = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.storage_pool_name = AAZStrArg( + options=["-n", "--name", "--storage-pool-name"], + help="Name of the storage pool", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9\\-_]{1,127}$", + max_length=127, + min_length=1, + ), + ) + + # define Arg Group "Identity" + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.provisioned_bandwidth = AAZIntArg( + options=["--provisioned-bandwidth"], + arg_group="Properties", + help="Total bandwidth provisioned for the pool, in MB/s", + ) + + # 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.StoragePoolsGet(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.StoragePoolsCreate(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 StoragePoolsGet(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/PureStorage.Block/storagePools/{storagePoolName}", + **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( + "storagePoolName", self.ctx.args.storage_pool_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", "2024-11-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + _UpdateHelper._build_schema_storage_pool_read(cls._schema_on_200) + + return cls._schema_on_200 + + class StoragePoolsCreate(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/PureStorage.Block/storagePools/{storagePoolName}", + **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( + "storagePoolName", self.ctx.args.storage_pool_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", "2024-11-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + value=self.ctx.vars.instance, + ) + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + _UpdateHelper._build_schema_storage_pool_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, typ_kwargs={"flags": {"client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("provisionedBandwidthMbPerSec", AAZIntType, ".provisioned_bandwidth", typ_kwargs={"flags": {"required": True}}) + + 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_storage_pool_read = None + + @classmethod + def _build_schema_storage_pool_read(cls, _schema): + if cls._schema_storage_pool_read is not None: + _schema.id = cls._schema_storage_pool_read.id + _schema.identity = cls._schema_storage_pool_read.identity + _schema.location = cls._schema_storage_pool_read.location + _schema.name = cls._schema_storage_pool_read.name + _schema.properties = cls._schema_storage_pool_read.properties + _schema.system_data = cls._schema_storage_pool_read.system_data + _schema.tags = cls._schema_storage_pool_read.tags + _schema.type = cls._schema_storage_pool_read.type + return + + cls._schema_storage_pool_read = _schema_storage_pool_read = AAZObjectType() + + storage_pool_read = _schema_storage_pool_read + storage_pool_read.id = AAZStrType( + flags={"read_only": True}, + ) + storage_pool_read.identity = AAZIdentityObjectType() + storage_pool_read.location = AAZStrType( + flags={"required": True}, + ) + storage_pool_read.name = AAZStrType( + flags={"read_only": True}, + ) + storage_pool_read.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + storage_pool_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + storage_pool_read.tags = AAZDictType() + storage_pool_read.type = AAZStrType( + flags={"read_only": True}, + ) + + identity = _schema_storage_pool_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_storage_pool_read.identity.user_assigned_identities + user_assigned_identities.Element = AAZObjectType( + nullable=True, + ) + + _element = _schema_storage_pool_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_storage_pool_read.properties + properties.availability_zone = AAZStrType( + serialized_name="availabilityZone", + flags={"required": True}, + ) + properties.avs = AAZObjectType( + flags={"read_only": True}, + ) + properties.data_retention_period = AAZIntType( + serialized_name="dataRetentionPeriod", + flags={"read_only": True}, + ) + properties.provisioned_bandwidth_mb_per_sec = AAZIntType( + serialized_name="provisionedBandwidthMbPerSec", + flags={"required": True}, + ) + properties.provisioned_iops = AAZIntType( + serialized_name="provisionedIops", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.reservation_resource_id = AAZStrType( + serialized_name="reservationResourceId", + flags={"required": True}, + ) + properties.storage_pool_internal_id = AAZStrType( + serialized_name="storagePoolInternalId", + flags={"read_only": True}, + ) + properties.vnet_injection = AAZObjectType( + serialized_name="vnetInjection", + flags={"required": True}, + ) + + avs = _schema_storage_pool_read.properties.avs + avs.avs_enabled = AAZBoolType( + serialized_name="avsEnabled", + flags={"required": True}, + ) + avs.sddc_resource_id = AAZStrType( + serialized_name="sddcResourceId", + ) + + vnet_injection = _schema_storage_pool_read.properties.vnet_injection + vnet_injection.subnet_id = AAZStrType( + serialized_name="subnetId", + flags={"required": True}, + ) + vnet_injection.vnet_id = AAZStrType( + serialized_name="vnetId", + flags={"required": True}, + ) + + system_data = _schema_storage_pool_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", + ) + + tags = _schema_storage_pool_read.tags + tags.Element = AAZStrType() + + _schema.id = cls._schema_storage_pool_read.id + _schema.identity = cls._schema_storage_pool_read.identity + _schema.location = cls._schema_storage_pool_read.location + _schema.name = cls._schema_storage_pool_read.name + _schema.properties = cls._schema_storage_pool_read.properties + _schema.system_data = cls._schema_storage_pool_read.system_data + _schema.tags = cls._schema_storage_pool_read.tags + _schema.type = cls._schema_storage_pool_read.type + + +__all__ = ["Update"] diff --git a/src/pscloud/azext_pscloud/aaz/latest/pscloud/storagepool/_wait.py b/src/pscloud/azext_pscloud/aaz/latest/pscloud/storagepool/_wait.py new file mode 100644 index 00000000000..ba0613cf537 --- /dev/null +++ b/src/pscloud/azext_pscloud/aaz/latest/pscloud/storagepool/_wait.py @@ -0,0 +1,296 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "pscloud storagepool wait", +) +class Wait(AAZWaitCommand): + """Place the CLI in a waiting state until a condition is met. + """ + + _aaz_info = { + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/purestorage.block/storagepools/{}", "2024-11-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.storage_pool_name = AAZStrArg( + options=["-n", "--name", "--storage-pool-name"], + help="Name of the storage pool", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9\\-_]{1,127}$", + max_length=127, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.StoragePoolsGet(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 StoragePoolsGet(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/PureStorage.Block/storagePools/{storagePoolName}", + **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( + "storagePoolName", self.ctx.args.storage_pool_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", "2024-11-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.identity = AAZIdentityObjectType() + _schema_on_200.location = AAZStrType( + flags={"required": 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.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.availability_zone = AAZStrType( + serialized_name="availabilityZone", + flags={"required": True}, + ) + properties.avs = AAZObjectType( + flags={"read_only": True}, + ) + properties.data_retention_period = AAZIntType( + serialized_name="dataRetentionPeriod", + flags={"read_only": True}, + ) + properties.provisioned_bandwidth_mb_per_sec = AAZIntType( + serialized_name="provisionedBandwidthMbPerSec", + flags={"required": True}, + ) + properties.provisioned_iops = AAZIntType( + serialized_name="provisionedIops", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.reservation_resource_id = AAZStrType( + serialized_name="reservationResourceId", + flags={"required": True}, + ) + properties.storage_pool_internal_id = AAZStrType( + serialized_name="storagePoolInternalId", + flags={"read_only": True}, + ) + properties.vnet_injection = AAZObjectType( + serialized_name="vnetInjection", + flags={"required": True}, + ) + + avs = cls._schema_on_200.properties.avs + avs.avs_enabled = AAZBoolType( + serialized_name="avsEnabled", + flags={"required": True}, + ) + avs.sddc_resource_id = AAZStrType( + serialized_name="sddcResourceId", + ) + + vnet_injection = cls._schema_on_200.properties.vnet_injection + vnet_injection.subnet_id = AAZStrType( + serialized_name="subnetId", + flags={"required": True}, + ) + vnet_injection.vnet_id = AAZStrType( + serialized_name="vnetId", + flags={"required": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/pscloud/azext_pscloud/azext_metadata.json b/src/pscloud/azext_pscloud/azext_metadata.json new file mode 100644 index 00000000000..e506328978c --- /dev/null +++ b/src/pscloud/azext_pscloud/azext_metadata.json @@ -0,0 +1,4 @@ +{ + "azext.isPreview": true, + "azext.minCliCoreVersion": "2.70.0" +} \ No newline at end of file diff --git a/src/pscloud/azext_pscloud/commands.py b/src/pscloud/azext_pscloud/commands.py new file mode 100644 index 00000000000..b0d842e4993 --- /dev/null +++ b/src/pscloud/azext_pscloud/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/pscloud/azext_pscloud/custom.py b/src/pscloud/azext_pscloud/custom.py new file mode 100644 index 00000000000..86df1e48ef5 --- /dev/null +++ b/src/pscloud/azext_pscloud/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/pscloud/azext_pscloud/tests/__init__.py b/src/pscloud/azext_pscloud/tests/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/pscloud/azext_pscloud/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/pscloud/azext_pscloud/tests/latest/__init__.py b/src/pscloud/azext_pscloud/tests/latest/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/pscloud/azext_pscloud/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/pscloud/azext_pscloud/tests/latest/recordings/test_pscloud_reservation_crud.yaml b/src/pscloud/azext_pscloud/tests/latest/recordings/test_pscloud_reservation_crud.yaml new file mode 100644 index 00000000000..602265e34f9 --- /dev/null +++ b/src/pscloud/azext_pscloud/tests/latest/recordings/test_pscloud_reservation_crud.yaml @@ -0,0 +1,101 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - pscloud reservation list + Connection: + - keep-alive + User-Agent: + - AZURECLI/2.75.0 azsdk-python-core/1.35.0 Python/3.12.11 (Linux-6.8.0-1027-azure-x86_64-with-glibc2.36) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/PureStorage.Block/reservations?api-version=2024-11-01-preview + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S1RG1/providers/PureStorage.Block/reservations/cliTestReservation","name":"cliTestReservation","type":"purestorage.block/reservations","location":"centralus","tags":{"key1110":"euhfdmtfpucwurtu"},"systemData":{"createdBy":"test@example.com","createdByType":"User","createdAt":"2025-07-08T12:04:52.0352337Z","lastModifiedBy":"test@example.com","lastModifiedByType":"User","lastModifiedAt":"2025-07-09T11:33:35.9076285Z"},"properties":{"reservationInternalId":"524469f1-fe39-421a-9398-9e1589b01012","marketplace":{"subscriptionId":"660093d0-6674-40ea-cfee-edcedffdd61f","subscriptionStatus":"Subscribed","offerDetails":{"publisherId":"purestoragemarketplaceadmin","offerId":"krypton_3_plan","planId":"private_preview_zero","termUnit":"P1M","termId":"gmz7xq9ge3py"}},"user":{"firstName":"ritika","lastName":"joshi","emailAddress":"test@example.com","companyDetails":{"companyName":"Microsoft","address":{"addressLine1":"Street12s3","addressLine2":"h","city":"Redmond","state":"wa","postalCode":"98052-8300","country":"US"}}},"provisioningState":"Failed"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S1RG1/providers/PureStorage.Block/reservations/tempReservation2","name":"tempReservation2","type":"purestorage.block/reservations","location":"East + US 2 EUAP","tags":{},"systemData":{"createdBy":"test@example.com","createdByType":"User","createdAt":"2024-12-04T10:26:28.1607248Z","lastModifiedBy":"2ac806ef-bfc3-487f-b66a-ec5023c35730","lastModifiedByType":"Application","lastModifiedAt":"2024-12-04T10:34:48.3602751Z"},"properties":{"reservationInternalId":"424e84ac-6192-49c7-8bc3-35f04f8572e5","marketplace":{"subscriptionId":"0b66d8f8-1865-46fb-cc36-128799c89fb6","subscriptionStatus":"Subscribed","offerDetails":{"publisherId":"purestoragemarketplaceadmin","offerId":"krypton_3_plan","planId":"private_preview_zero","termUnit":"P1M","termId":"gmz7xq9ge3py"}},"user":{"firstName":"asd","lastName":"dsa","emailAddress":"test@example.com","companyDetails":{"companyName":"as","address":{"addressLine1":"Street123","addressLine2":"","city":"Redmond","state":"wa","postalCode":"98052-8300","country":"US"}}},"provisioningState":"Failed"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S1RG1/providers/PureStorage.Block/reservations/testbillingreservationV8","name":"testbillingreservationV8","type":"purestorage.block/reservations","location":"East + US 2 EUAP","systemData":{"createdBy":"test@example.com","createdByType":"User","createdAt":"2025-07-01T15:33:53.2883655Z","lastModifiedBy":"test@example.com","lastModifiedByType":"User","lastModifiedAt":"2025-07-08T11:19:08.5144745Z"},"properties":{"reservationInternalId":"e438766d-7ae6-4856-b595-fef7e671ba3a","marketplace":{"subscriptionId":"db772325-e094-44aa-c93d-2f01902e3b0c","subscriptionStatus":"Unsubscribed","offerDetails":{"publisherId":"purestoragemarketplaceadmin","offerId":"krypton_3_plan","planId":"private_preview_zero","termUnit":"P1M","termId":"gmz7xq9ge3py"}},"user":{"firstName":"ritika","lastName":"joshi","emailAddress":"test@example.com","companyDetails":{"companyName":"Microsoft","address":{"addressLine1":"Street12s3","addressLine2":"","city":"Redmond","state":"wa","postalCode":"98052-8300","country":"US"}}},"provisioningState":"Failed"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '3358' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Jul 2025 06:25:50 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-original-request-ids: + - 9ff56442-ec96-4b14-9ef4-7b11262fe140 + - d5910df7-4121-48cf-ad75-57718f255f26 + x-ms-ratelimit-remaining-subscription-global-reads: + - '3749' + x-msedge-ref: + - 'Ref A: E63A2D16CFE2415CB87AAB166E38D12B Ref B: PNQ231110908031 Ref C: 2025-07-23T06:25:49Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - pscloud reservation show + Connection: + - keep-alive + ParameterSetName: + - --resource-group --reservation-name + User-Agent: + - AZURECLI/2.75.0 azsdk-python-core/1.35.0 Python/3.12.11 (Linux-6.8.0-1027-azure-x86_64-with-glibc2.36) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S1RG1/providers/PureStorage.Block/reservations/cliTestReservation?api-version=2024-11-01-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S1RG1/providers/PureStorage.Block/reservations/cliTestReservation","name":"cliTestReservation","type":"purestorage.block/reservations","location":"centralus","tags":{"key1110":"euhfdmtfpucwurtu"},"systemData":{"createdBy":"test@example.com","createdByType":"User","createdAt":"2025-07-08T12:04:52.0352337Z","lastModifiedBy":"test@example.com","lastModifiedByType":"User","lastModifiedAt":"2025-07-09T11:33:35.9076285Z"},"properties":{"reservationInternalId":"524469f1-fe39-421a-9398-9e1589b01012","marketplace":{"subscriptionId":"660093d0-6674-40ea-cfee-edcedffdd61f","subscriptionStatus":"Subscribed","offerDetails":{"publisherId":"purestoragemarketplaceadmin","offerId":"krypton_3_plan","planId":"private_preview_zero","planName":null,"termUnit":"P1M","termId":"gmz7xq9ge3py"}},"user":{"firstName":"ritika","lastName":"joshi","emailAddress":"test@example.com","companyDetails":{"companyName":"Microsoft","address":{"addressLine1":"Street12s3","addressLine2":"h","city":"Redmond","state":"wa","postalCode":"98052-8300","country":"US"}}},"provisioningState":"Failed"}}' + headers: + cache-control: + - no-cache + content-length: + - '1142' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Jul 2025 06:25:52 GMT + etag: + - '"1201ba40-0000-0800-0000-687654fa0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-global-reads: + - '3749' + x-msedge-ref: + - 'Ref A: 3C5C06ECC87148BE93860804D0A9AE76 Ref B: PNQ231110907054 Ref C: 2025-07-23T06:25:51Z' + status: + code: 200 + message: OK +version: 1 diff --git a/src/pscloud/azext_pscloud/tests/latest/recordings/test_pscloud_storagepool_get.yaml b/src/pscloud/azext_pscloud/tests/latest/recordings/test_pscloud_storagepool_get.yaml new file mode 100644 index 00000000000..94f499bc01a --- /dev/null +++ b/src/pscloud/azext_pscloud/tests/latest/recordings/test_pscloud_storagepool_get.yaml @@ -0,0 +1,100 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - pscloud storagepool show + Connection: + - keep-alive + ParameterSetName: + - --resource-group --storage-pool-name + User-Agent: + - AZURECLI/2.75.0 azsdk-python-core/1.35.0 Python/3.12.11 (Linux-6.8.0-1027-azure-x86_64-with-glibc2.36) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S1RG1/providers/PureStorage.Block/storagePools/cliTestStoragePool8?api-version=2024-11-01-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S1RG1/providers/PureStorage.Block/storagePools/cliTestStoragePool8","name":"cliTestStoragePool8","type":"purestorage.block/storagepools","location":"centralus","systemData":{"createdBy":"91a99062-ab22-4fd2-a3b2-766d55d6f5c5","createdByType":"Application","createdAt":"2025-07-22T05:51:53.9286605Z","lastModifiedBy":"91a99062-ab22-4fd2-a3b2-766d55d6f5c5","lastModifiedByType":"Application","lastModifiedAt":"2025-07-22T05:51:53.9286605Z"},"identity":{"principalId":"c174b885-f681-40a4-a101-cb86ba4b1357","tenantId":"888d76fa-54b2-4ced-8ee5-aac1585adee7","type":"SystemAssigned"},"properties":{"storagePoolInternalId":"aaae317d-641d-4a6b-804a-a3dffd7cef99","availabilityZone":"1","vnetInjection":{"subnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pure-cli-testing-vnet/providers/Microsoft.Network/virtualNetworks/pure-cli-vnet/subnets/delg-subnet","vnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pure-cli-testing-vnet/providers/Microsoft.Network/virtualNetworks/pure-cli-vnet"},"dataRetentionPeriod":259200,"provisionedBandwidthMbPerSec":992,"provisionedIops":65384,"avs":{"avsEnabled":false,"sddcResourceId":""},"provisioningState":"Succeeded","reservationResourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S1RG1/providers/PureStorage.Block/reservations/cliTestReservation"}}' + headers: + cache-control: + - no-cache + content-length: + - '1435' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Jul 2025 06:26:14 GMT + etag: + - '"dd026d17-0000-0100-0000-687f2dee0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-global-reads: + - '3749' + x-msedge-ref: + - 'Ref A: 976A7E8137F64836BF9BE634038E1EC0 Ref B: PNQ231110908031 Ref C: 2025-07-23T06:26:14Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - pscloud storagepool list + Connection: + - keep-alive + User-Agent: + - AZURECLI/2.75.0 azsdk-python-core/1.35.0 Python/3.12.11 (Linux-6.8.0-1027-azure-x86_64-with-glibc2.36) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/PureStorage.Block/storagePools?api-version=2024-11-01-preview + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S1RG1/providers/PureStorage.Block/storagePools/cliTestStoragePool","name":"cliTestStoragePool","type":"purestorage.block/storagepools","location":"centralus","systemData":{"createdBy":"test@example.com","createdByType":"User","createdAt":"2025-07-09T12:19:19.325741Z","lastModifiedBy":"test@example.com","lastModifiedByType":"User","lastModifiedAt":"2025-07-09T12:19:19.325741Z"},"identity":{"principalId":"24506c88-6a32-49de-b5e2-42fdeb7cef2d","tenantId":"888d76fa-54b2-4ced-8ee5-aac1585adee7","type":"SystemAssigned"},"properties":{"availabilityZone":"1","vnetInjection":{"subnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pure-cli-testing-vnet/providers/Microsoft.Network/virtualNetworks/pure-cli-vnet/subnets/delg-subnet","vnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S1RG1/providers/PureStorage.Block/reservations/cliTestReservation"},"provisionedBandwidthMbPerSec":992,"provisioningState":"Failed","reservationResourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S1RG1/providers/PureStorage.Block/reservations/cliTestReservation"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S1RG1/providers/PureStorage.Block/storagePools/cliTestStoragePool2","name":"cliTestStoragePool2","type":"purestorage.block/storagepools","location":"centralus","systemData":{"createdBy":"91a99062-ab22-4fd2-a3b2-766d55d6f5c5","createdByType":"Application","createdAt":"2025-07-09T15:58:21.8096298Z","lastModifiedBy":"91a99062-ab22-4fd2-a3b2-766d55d6f5c5","lastModifiedByType":"Application","lastModifiedAt":"2025-07-09T15:58:21.8096298Z"},"identity":{"principalId":"c8198311-e769-4c40-9519-6412acbd06ac","tenantId":"888d76fa-54b2-4ced-8ee5-aac1585adee7","type":"SystemAssigned"},"properties":{"availabilityZone":"1","vnetInjection":{"subnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pure-cli-testing-vnet/providers/Microsoft.Network/virtualNetworks/pure-cli-vnet/subnets/delg-subnet","vnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S1RG1/providers/PureStorage.Block/reservations/cliTestReservation"},"provisionedBandwidthMbPerSec":992,"provisioningState":"Failed","reservationResourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S1RG1/providers/PureStorage.Block/reservations/cliTestReservation"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S1RG1/providers/PureStorage.Block/storagePools/cliTestStoragePool3","name":"cliTestStoragePool3","type":"purestorage.block/storagepools","location":"centralus","systemData":{"createdBy":"91a99062-ab22-4fd2-a3b2-766d55d6f5c5","createdByType":"Application","createdAt":"2025-07-09T16:13:10.4268388Z","lastModifiedBy":"91a99062-ab22-4fd2-a3b2-766d55d6f5c5","lastModifiedByType":"Application","lastModifiedAt":"2025-07-09T16:13:10.4268388Z"},"properties":{"availabilityZone":"1","vnetInjection":{"subnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pure-cli-testing-vnet/providers/Microsoft.Network/virtualNetworks/pure-cli-vnet/subnets/delg-subnet","vnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S1RG1/providers/PureStorage.Block/reservations/cliTestReservation"},"provisionedBandwidthMbPerSec":992,"provisioningState":"Failed","reservationResourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S1RG1/providers/PureStorage.Block/reservations/cliTestReservation"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S1RG1/providers/PureStorage.Block/storagePools/cliTestStoragePool6","name":"cliTestStoragePool6","type":"purestorage.block/storagepools","location":"centralus","systemData":{"createdBy":"91a99062-ab22-4fd2-a3b2-766d55d6f5c5","createdByType":"Application","createdAt":"2025-07-22T05:05:45.4507685Z","lastModifiedBy":"91a99062-ab22-4fd2-a3b2-766d55d6f5c5","lastModifiedByType":"Application","lastModifiedAt":"2025-07-22T05:05:45.4507685Z"},"properties":{"availabilityZone":"1","vnetInjection":{"subnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pure-cli-testing-vnet/providers/Microsoft.Network/virtualNetworks/pure-cli-vnet/subnets/delg-subnet","vnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S1RG1/providers/PureStorage.Block/reservations/cliTestReservation"},"provisionedBandwidthMbPerSec":992,"provisioningState":"Failed","reservationResourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S1RG1/providers/PureStorage.Block/reservations/cliTestReservation"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S1RG1/providers/PureStorage.Block/storagePools/cliTestStoragePool8","name":"cliTestStoragePool8","type":"purestorage.block/storagepools","location":"centralus","systemData":{"createdBy":"91a99062-ab22-4fd2-a3b2-766d55d6f5c5","createdByType":"Application","createdAt":"2025-07-22T05:51:53.9286605Z","lastModifiedBy":"91a99062-ab22-4fd2-a3b2-766d55d6f5c5","lastModifiedByType":"Application","lastModifiedAt":"2025-07-22T05:51:53.9286605Z"},"identity":{"principalId":"c174b885-f681-40a4-a101-cb86ba4b1357","tenantId":"888d76fa-54b2-4ced-8ee5-aac1585adee7","type":"SystemAssigned"},"properties":{"storagePoolInternalId":"aaae317d-641d-4a6b-804a-a3dffd7cef99","availabilityZone":"1","vnetInjection":{"subnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pure-cli-testing-vnet/providers/Microsoft.Network/virtualNetworks/pure-cli-vnet/subnets/delg-subnet","vnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pure-cli-testing-vnet/providers/Microsoft.Network/virtualNetworks/pure-cli-vnet"},"dataRetentionPeriod":259200,"provisionedBandwidthMbPerSec":992,"provisionedIops":65384,"avs":{"avsEnabled":false,"sddcResourceId":""},"provisioningState":"Succeeded","reservationResourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S1RG1/providers/PureStorage.Block/reservations/cliTestReservation"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S1RG1/providers/PureStorage.Block/storagePools/SeedKajal1","name":"SeedKajal1","type":"purestorage.block/storagepools","location":"eastus2euap","systemData":{"createdBy":"test@example.com","createdByType":"User","createdAt":"2024-12-03T10:37:06.6255072Z","lastModifiedBy":"test@example.com","lastModifiedByType":"User","lastModifiedAt":"2024-12-03T10:37:06.6255072Z"},"identity":{"principalId":"ffe8aea3-37a1-4d02-abf6-2eea6da25d15","tenantId":"888d76fa-54b2-4ced-8ee5-aac1585adee7","type":"SystemAssigned"},"properties":{"availabilityZone":"1","vnetInjection":{"subnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S1RG10/providers/Microsoft.Network/virtualNetworks/vnet01/subnets/subnet4","vnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S1RG10/providers/Microsoft.Network/virtualNetworks/vnet01"},"provisionedBandwidthMbPerSec":1024,"provisioningState":"Failed","reservationResourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S1RG1/providers/PureStorage.Block/reservations/CompleteSetup"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S1RG1/providers/PureStorage.Block/storagePools/deepak-sp-01","name":"deepak-sp-01","type":"purestorage.block/storagepools","location":"East + US 2 EUAP","tags":{"project":"alpha","env":"test"},"systemData":{"createdBy":"test@example.com","createdByType":"User","createdAt":"2025-05-05T07:04:14.2945985Z","lastModifiedBy":"test@example.com","lastModifiedByType":"User","lastModifiedAt":"2025-05-05T07:04:14.2945985Z"},"identity":{"principalId":"b09a9dd6-ae17-4634-86ae-65c4b0a00449","tenantId":"888d76fa-54b2-4ced-8ee5-aac1585adee7","type":"SystemAssigned"},"properties":{"storagePoolInternalId":"1fb5f324-540d-4e07-8496-d11d10002250","availabilityZone":"1","vnetInjection":{"subnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S1RG1/providers/Microsoft.Network/virtualNetworks/ritikavnet/subnets/ritikasubnet","vnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S1RG1/providers/Microsoft.Network/virtualNetworks/ritikavnet"},"dataRetentionPeriod":259200,"provisionedBandwidthMbPerSec":992,"provisionedIops":65384,"avs":{"avsEnabled":false,"sddcResourceId":""},"provisioningState":"Failed","reservationResourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S1RG1/providers/PureStorage.Block/reservations/tempReservation2"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '8652' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Jul 2025 06:26:15 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-original-request-ids: + - 62b59600-e218-4851-a5d6-a05749fc115a + - dbec2d97-320e-41b1-a593-eeec4c213524 + x-ms-ratelimit-remaining-subscription-global-reads: + - '3749' + x-msedge-ref: + - 'Ref A: DCAFEB63D619494F8DE159A378A2C056 Ref B: PNQ231110907054 Ref C: 2025-07-23T06:26:15Z' + status: + code: 200 + message: OK +version: 1 diff --git a/src/pscloud/azext_pscloud/tests/latest/recordings/test_pscloud_storagepool_postAction.yaml b/src/pscloud/azext_pscloud/tests/latest/recordings/test_pscloud_storagepool_postAction.yaml new file mode 100644 index 00000000000..ebe21959a30 --- /dev/null +++ b/src/pscloud/azext_pscloud/tests/latest/recordings/test_pscloud_storagepool_postAction.yaml @@ -0,0 +1,114 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - pscloud storagepool get-health-status + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --resource-group --storage-pool-name + User-Agent: + - AZURECLI/2.75.0 azsdk-python-core/1.35.0 Python/3.12.11 (Linux-6.8.0-1027-azure-x86_64-with-glibc2.36) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S1RG1/providers/PureStorage.Block/storagePools/cliTestStoragePool8/getHealthStatus?api-version=2024-11-01-preview + response: + body: + string: '{"health":{"usedCapacityPercentage":0.0,"bandwidthUsage":{"current":0.0,"provisioned":1040187392.0,"max":2147483648.0},"iopsUsage":{"current":0.0,"provisioned":65384.0,"max":150000.0},"space":{"totalUsed":613023744,"unique":0,"snapshots":0,"shared":613023744},"dataReductionRatio":1.0,"estimatedMaxCapacity":0},"alerts":[]}' + headers: + cache-control: + - no-cache + content-length: + - '323' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Jul 2025 07:00:16 GMT + expires: + - '-1' + mise-correlation-id: + - 30bcd825-0556-4413-bca3-6a849461a7ad + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-operation-identifier: + - appId=91a99062-ab22-4fd2-a3b2-766d55d6f5c5,tenantId=888d76fa-54b2-4ced-8ee5-aac1585adee7,objectId=d72e9d00-2ae6-4216-9c0f-ef425c71a2bc/southindia/14e9895a-1e5a-4627-aebc-7a1779146ab0 + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-global-writes: + - '2999' + x-ms-ratelimit-remaining-subscription-writes: + - '199' + x-msedge-ref: + - 'Ref A: 76B70449E52C4F08B1F14CA0CFBB1124 Ref B: PNQ231110908031 Ref C: 2025-07-23T07:00:13Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - pscloud storagepool get-avs-status + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --resource-group --storage-pool-name + User-Agent: + - AZURECLI/2.75.0 azsdk-python-core/1.35.0 Python/3.12.11 (Linux-6.8.0-1027-azure-x86_64-with-glibc2.36) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/S1RG1/providers/PureStorage.Block/storagePools/cliTestStoragePool8/getAvsStatus?api-version=2024-11-01-preview + response: + body: + string: '{"avsEnabled":false,"currentConnectionStatus":"NoAVS","sddcResourceId":""}' + headers: + cache-control: + - no-cache + content-length: + - '74' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 23 Jul 2025 07:00:19 GMT + expires: + - '-1' + mise-correlation-id: + - 5f16ddd8-8445-4cf2-ab47-b3431fb25c94 + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-operation-identifier: + - appId=91a99062-ab22-4fd2-a3b2-766d55d6f5c5,tenantId=888d76fa-54b2-4ced-8ee5-aac1585adee7,objectId=d72e9d00-2ae6-4216-9c0f-ef425c71a2bc/jioindiacentral/3fce6fc6-e763-4f65-8184-2040bc2cf85b + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-global-writes: + - '2999' + x-ms-ratelimit-remaining-subscription-writes: + - '199' + x-msedge-ref: + - 'Ref A: E4E735F0016B4B5CBEE41182766847FF Ref B: PNQ231110907054 Ref C: 2025-07-23T07:00:16Z' + status: + code: 200 + message: OK +version: 1 diff --git a/src/pscloud/azext_pscloud/tests/latest/test_pscloud.py b/src/pscloud/azext_pscloud/tests/latest/test_pscloud.py new file mode 100644 index 00000000000..0d915d59086 --- /dev/null +++ b/src/pscloud/azext_pscloud/tests/latest/test_pscloud.py @@ -0,0 +1,86 @@ +# -------------------------------------------------------------------------------------------- +# 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 ScenarioTest, JMESPathCheck + + +class PscloudScenario(ScenarioTest): + + def test_pscloud_reservation_crud(self): + self.cmd("az pscloud reservation list", checks=[ + self.greater_than('length(@)', 0) + ]) + self.cmd("az pscloud reservation show --resource-group S1RG1 --reservation-name cliTestReservation", checks=[ + self.check('reservationInternalId', '524469f1-fe39-421a-9398-9e1589b01012') + ]) + + def test_pscloud_storagepool_create(self): + """Test pscloud storagepool create command""" + # Create storagepool command with proper JSON quoting for vnet-injection + create_storagepool_cmd = """az pscloud storagepool create --resource-group S1RG1 --storage-pool-name cliTestStoragePool8 --location "Central US" --availability-zone "1" --vnet-injection '{{"subnet-id":"/subscriptions/3490e0a3-59fd-4ed4-baed-873d4e401b99/resourceGroups/pure-cli-testing-vnet/providers/Microsoft.Network/virtualNetworks/pure-cli-vnet/subnets/delg-subnet","vnet-id":"/subscriptions/3490e0a3-59fd-4ed4-baed-873d4e401b99/resourceGroups/pure-cli-testing-vnet/providers/Microsoft.Network/virtualNetworks/pure-cli-vnet"}}' --provisioned-bandwidth 992 --reservation-id "/subscriptions/3490e0a3-59fd-4ed4-baed-873d4e401b99/resourceGroups/S1RG1/providers/PureStorage.Block/reservations/cliTestReservation" --system-assigned --debug""" + + # Execute the create command + self.cmd(create_storagepool_cmd, checks=[ + self.exists('properties.vnetInjection'), + self.exists('properties') + ]) + + def test_pscloud_storagepool_get(self): + """Test storagepool show, list, and get-health-status commands with basic field checks""" + + # 1. Test storagepool show + self.cmd( + "az pscloud storagepool show --resource-group S1RG1 --storage-pool-name cliTestStoragePool8", + checks=[ + self.exists('id'), + self.exists('name'), + self.exists('location'), + self.exists('identity'), + self.exists('vnetInjection'), + self.exists('provisionedBandwidthMbPerSec') + ] + ) + + # 2. Test storagepool list + self.cmd( + "az pscloud storagepool list", + checks=[ + self.greater_than('length(@)', 0) + ] + ) + + def test_pscloud_storagepool_postAction(self): + # 3. Test storagepool get-health-status + self.cmd( + "az pscloud storagepool get-health-status --resource-group S1RG1 --storage-pool-name cliTestStoragePool8", + checks=[ + self.exists('health'), + self.exists('health.bandwidthUsage'), + self.exists('health.iopsUsage'), + self.exists('health.space') + ] + ) + self.cmd( + "az pscloud storagepool get-avs-status --resource-group S1RG1 --storage-pool-name cliTestStoragePool8", + checks=[ + self.exists('currentConnectionStatus') + ] + ) + + def test_pscloud_storagepool_update(self): + """Test pscloud storagepool update command""" + # Test updating provisioned bandwidth + self.cmd( + "az pscloud storagepool update --resource-group S1RG1 --name cliTestStoragePool8 --provisioned-bandwidth 1094", + checks=[ + self.exists('id'), + self.exists('name'), + self.check('name', 'cliTestStoragePool8'), + self.check('properties.provisionedBandwidthMbPerSec', 1094), + self.exists('properties') + ] + ) \ No newline at end of file diff --git a/src/pscloud/setup.cfg b/src/pscloud/setup.cfg new file mode 100644 index 00000000000..2fdd96e5d39 --- /dev/null +++ b/src/pscloud/setup.cfg @@ -0,0 +1 @@ +#setup.cfg \ No newline at end of file diff --git a/src/pscloud/setup.py b/src/pscloud/setup.py new file mode 100644 index 00000000000..645141195e0 --- /dev/null +++ b/src/pscloud/setup.py @@ -0,0 +1,49 @@ +# -------------------------------------------------------------------------------------------- +# 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.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + '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='pscloud', + version=VERSION, + description='Microsoft Azure Command-Line Tools Pscloud 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/pscloud', + classifiers=CLASSIFIERS, + packages=find_packages(exclude=["tests"]), + package_data={'azext_pscloud': ['azext_metadata.json']}, + install_requires=DEPENDENCIES +) diff --git a/src/service_name.json b/src/service_name.json index 8691323abd5..998d7b4004c 100644 --- a/src/service_name.json +++ b/src/service_name.json @@ -504,6 +504,11 @@ "AzureServiceName": "Provider Hub", "URL": "" }, + { + "Command": "az pscloud", + "AzureServiceName": "PureStorage Cloud", + "URL": "https://learn.microsoft.com/en-us/azure/partner-solutions/pure-storage/overview" + }, { "Command": "az quantum", "AzureServiceName": "Quantum",