diff --git a/src/self-help/HISTORY.rst b/src/self-help/HISTORY.rst index 8c34bccfff8..b69f89a3f89 100644 --- a/src/self-help/HISTORY.rst +++ b/src/self-help/HISTORY.rst @@ -5,4 +5,8 @@ Release History 0.1.0 ++++++ -* Initial release. \ No newline at end of file +* Initial release. + +0.2.0 +++++++ +* Added new commands troubleshooter and solution from public preview version v2023-09-01-preview. Updated contracts for responses. \ No newline at end of file diff --git a/src/self-help/README.md b/src/self-help/README.md index 8d5052843ae..03f78e24f8e 100644 --- a/src/self-help/README.md +++ b/src/self-help/README.md @@ -20,7 +20,7 @@ az extension add --name self-help ``` # Gets list of solution metadata for an azure resource. - az self-help discovery-solution list --scope {scope} + az self-help discovery-solution list --filter "ProblemClassificationId eq '00000000-0000-0000-0000-000000000000'" --scope 'subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read' ``` ### _"Diagnostic"_ commands @@ -31,7 +31,7 @@ az extension add --name self-help ``` # Creates a diagnostic for a resource - az self-help diagnostic create --diagnostic-name {diagnostic-name} --insights [{solutionId:Demo2InsightV2}] --scope {scope} + az self-help diagnostic create --diagnostic-name diagnostic-name --insights [{solutionId:Demo2InsightV2}] --scope 'subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read' ``` - #### Show Diagnostic for a resource @@ -39,8 +39,84 @@ az extension add --name self-help _Examples:_ ``` - # Show diagnostic for a resource. - az self-help diagnostic show --diagnostic-name {diagnostic-name} --scope {scope} + # Shows diagnostic for a resource. + az self-help diagnostic show --diagnostic-name diagnostic-name --scope 'subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read' + ``` + +### _"Solution"_ commands + +- #### Create Solution for a resource + + _Examples:_ + + ``` + # Creates a solution for a resource + az self-help solution create --solution-name solution-name --trigger-criteria [{name:solutionid,value:Demo2InsightV2}] --parameters {} --scope 'subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read' + ``` + +- #### Show Solution for a resource + + _Examples:_ + + ``` + # Shows solution for a resource. + az elf-help solution show --solution-name solution-name --scope 'subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read' + ``` + +- #### Update Solution for a resource + + _Examples:_ + + ``` + # Updates solution for a resource. + az self-help solution update --solution-name solution-name --trigger-criteria [{name:ReplacementKey,value:}] --parameters {SearchText:CanNotRDP,SymptomId:KeyVaultVaultNotFoundInsight} --scope 'subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read' + ``` + +### _"Troubleshooter"_ commands + +- #### Create Troubleshooter for a resource + + _Examples:_ + + ``` + # Creates a troubleshooter for a resource + az self-help troubleshooter create --troubleshooter-name 12345678-BBBb-cCCCC-0000-123456789012 --solution-id e104dbdf-9e14-4c9f-bc78-21ac90382231 --parameters {ResourceUri:'subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read'} --scope 'subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read' + ``` + +- #### Show troubleshooter for a resource + + _Examples:_ + + ``` + # Show troubleshooter for a resource. + az self-help troubleshooter show --troubleshooter-name 12345678-BBBb-cCCCC-0000-123456789012 --scope 'subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read' + ``` + +- #### Restart troubleshooter for a resource + + _Examples:_ + + ``` + # Restarts troubleshooter for a resource. + az self-help troubleshooter restart --troubleshooter-name 12345678-BBBb-cCCCC-0000-123456789012 --scope 'subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read' + ``` + +- #### End troubleshooter for a resource + + _Examples:_ + + ``` + # Ends troubleshooter for a resource. + az self-help troubleshooter end --troubleshooter-name 12345678-BBBb-cCCCC-0000-123456789012 --scope 'subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read' + ``` + +- #### Continue troubleshooter for a resource + + _Examples:_ + + ``` + # Continues troubleshooter for a resource. + az self-help troubleshooter continue --troubleshooter-name 12345678-BBBb-cCCCC-0000-123456789012 --step-id step-id --responses [] --scope 'subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read' ``` ### _"Check-Name-Availability"_ commands @@ -50,6 +126,8 @@ az extension add --name self-help _Examples:_ ``` - # Checks name available of a diagnostic resource. - az self-help check-name-availability --scope subscriptionId/{subId} --name {diagnostic-name} --type 'Microsoft.Help/diagnostics' + # Check Resource Uniqueness + az self-help check-name-availability --scope subscriptions/00000000-0000-0000-0000-000000000000 --name diagnostic-name --type 'Microsoft.Help/diagnostics' + az self-help check-name-availability --scope subscriptions/00000000-0000-0000-0000-000000000000 --name solution-name --type 'Microsoft.Help/solutions' + az self-help check-name-availability --scope subscriptions/00000000-0000-0000-0000-000000000000 --name 12345678-BBBb-cCCCC-0000-123456789012 --type 'Microsoft.Help/troubleshooters' ``` diff --git a/src/self-help/azext_self_help/aaz/latest/self_help/_check_name_availability.py b/src/self-help/azext_self_help/aaz/latest/self_help/_check_name_availability.py index 98fe88b2b81..97ffd0fcf93 100644 --- a/src/self-help/azext_self_help/aaz/latest/self_help/_check_name_availability.py +++ b/src/self-help/azext_self_help/aaz/latest/self_help/_check_name_availability.py @@ -16,16 +16,18 @@ is_preview=True, ) class CheckNameAvailability(AAZCommand): - """This API is used to check the uniqueness of a resource name used for a diagnostic check. + """This API is used to check the uniqueness of a resource name used for a diagnostic, troubleshooter or solutions - :example: Check Diagnostic Resource Uniqueness - az self-help check-name-availability --scope subscriptionId/{subId} --name {diagnostic-name} --type 'Microsoft.Help/diagnostics' + :example: Check Resource Uniqueness + az self-help check-name-availability --scope subscriptions/00000000-0000-0000-0000-000000000000 --name diagnostic-name --type 'Microsoft.Help/diagnostics' + az self-help check-name-availability --scope subscriptions/00000000-0000-0000-0000-000000000000 --name solution-name --type 'Microsoft.Help/solutions' + az self-help check-name-availability --scope subscriptions/00000000-0000-0000-0000-000000000000 --name 12345678-BBBb-cCCCC-0000-123456789012 --type 'Microsoft.Help/troubleshooters' """ _aaz_info = { - "version": "2023-01-01-preview", + "version": "2023-09-01-preview", "resources": [ - ["mgmt-plane", "/{scope}/providers/microsoft.help/checknameavailability", "2023-01-01-preview"], + ["mgmt-plane", "/{scope}/providers/microsoft.help/checknameavailability", "2023-09-01-preview"], ] } @@ -68,7 +70,7 @@ def _build_arguments_schema(cls, *args, **kwargs): def _execute_operations(self): self.pre_operations() - self.DiagnosticsCheckNameAvailability(ctx=self.ctx)() + self.CheckNameAvailabilityPost(ctx=self.ctx)() self.post_operations() @register_callback @@ -83,7 +85,7 @@ def _output(self, *args, **kwargs): result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) return result - class DiagnosticsCheckNameAvailability(AAZHttpOperation): + class CheckNameAvailabilityPost(AAZHttpOperation): CLIENT_TYPE = "MgmtClient" def __call__(self, *args, **kwargs): @@ -124,7 +126,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2023-01-01-preview", + "api-version", "2023-09-01-preview", required=True, ), } diff --git a/src/self-help/azext_self_help/aaz/latest/self_help/diagnostic/_create.py b/src/self-help/azext_self_help/aaz/latest/self_help/diagnostic/_create.py index 368f721b909..d3f1253dd2c 100644 --- a/src/self-help/azext_self_help/aaz/latest/self_help/diagnostic/_create.py +++ b/src/self-help/azext_self_help/aaz/latest/self_help/diagnostic/_create.py @@ -19,13 +19,13 @@ class Create(AAZCommand): """Creates a diagnostics that will help you troubleshoot an issue with your azure resource. :example: Create Diagnostic at Resource Level - az self-help diagnostic create --diagnostic-name {diagnostic-name} --insights [{solutionId:Demo2InsightV2}] --scope {scope} + az self-help diagnostic create --diagnostic-name diagnostic-name --insights [{solutionId:Demo2InsightV2}] --scope 'subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read' """ _aaz_info = { - "version": "2023-01-01-preview", + "version": "2023-09-01-preview", "resources": [ - ["mgmt-plane", "/{scope}/providers/microsoft.help/diagnostics/{}", "2023-01-01-preview"], + ["mgmt-plane", "/{scope}/providers/microsoft.help/diagnostics/{}", "2023-09-01-preview"], ] } @@ -48,7 +48,7 @@ def _build_arguments_schema(cls, *args, **kwargs): _args_schema = cls._args_schema _args_schema.diagnostic_name = AAZStrArg( options=["--diagnostic-name"], - help="unique resource name for diagnostic proxy resources.", + help="Unique resource name for insight resources", required=True, fmt=AAZStrArgFormat( pattern="^[A-Za-z0-9-+@()_]+$", @@ -123,16 +123,16 @@ def __call__(self, *args, **kwargs): return self.client.build_lro_polling( self.ctx.args.no_wait, session, - self.on_201, + 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 [201]: + if session.http_response.status_code in [200, 201]: return self.client.build_lro_polling( self.ctx.args.no_wait, session, - self.on_201, + self.on_200_201, self.on_error, lro_options={"final-state-via": "azure-async-operation"}, path_format_arguments=self.url_parameters, @@ -174,7 +174,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2023-01-01-preview", + "api-version", "2023-09-01-preview", required=True, ), } @@ -225,42 +225,42 @@ def content(self): return self.serialize_content(_content_value) - def on_201(self, session): + def on_200_201(self, session): data = self.deserialize_http_content(session) self.ctx.set_var( "instance", data, - schema_builder=self._build_schema_on_201 + schema_builder=self._build_schema_on_200_201 ) - _schema_on_201 = None + _schema_on_200_201 = None @classmethod - def _build_schema_on_201(cls): - if cls._schema_on_201 is not None: - return cls._schema_on_201 + 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_201 = AAZObjectType() + cls._schema_on_200_201 = AAZObjectType() - _schema_on_201 = cls._schema_on_201 - _schema_on_201.id = AAZStrType( + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.id = AAZStrType( flags={"read_only": True}, ) - _schema_on_201.name = AAZStrType( + _schema_on_200_201.name = AAZStrType( flags={"read_only": True}, ) - _schema_on_201.properties = AAZObjectType( + _schema_on_200_201.properties = AAZObjectType( flags={"client_flatten": True}, ) - _schema_on_201.system_data = AAZObjectType( + _schema_on_200_201.system_data = AAZObjectType( serialized_name="systemData", flags={"read_only": True}, ) - _schema_on_201.type = AAZStrType( + _schema_on_200_201.type = AAZStrType( flags={"read_only": True}, ) - properties = cls._schema_on_201.properties + properties = cls._schema_on_200_201.properties properties.accepted_at = AAZStrType( serialized_name="acceptedAt", flags={"read_only": True}, @@ -277,10 +277,10 @@ def _build_schema_on_201(cls): flags={"read_only": True}, ) - diagnostics = cls._schema_on_201.properties.diagnostics + diagnostics = cls._schema_on_200_201.properties.diagnostics diagnostics.Element = AAZObjectType() - _element = cls._schema_on_201.properties.diagnostics.Element + _element = cls._schema_on_200_201.properties.diagnostics.Element _element.error = AAZObjectType() _CreateHelper._build_schema_error_read(_element.error) _element.insights = AAZListType() @@ -289,10 +289,10 @@ def _build_schema_on_201(cls): ) _element.status = AAZStrType() - insights = cls._schema_on_201.properties.diagnostics.Element.insights + insights = cls._schema_on_200_201.properties.diagnostics.Element.insights insights.Element = AAZObjectType() - _element = cls._schema_on_201.properties.diagnostics.Element.insights.Element + _element = cls._schema_on_200_201.properties.diagnostics.Element.insights.Element _element.id = AAZStrType() _element.importance_level = AAZStrType( serialized_name="importanceLevel", @@ -300,13 +300,13 @@ def _build_schema_on_201(cls): _element.results = AAZStrType() _element.title = AAZStrType() - global_parameters = cls._schema_on_201.properties.global_parameters + global_parameters = cls._schema_on_200_201.properties.global_parameters global_parameters.Element = AAZStrType() - insights = cls._schema_on_201.properties.insights + insights = cls._schema_on_200_201.properties.insights insights.Element = AAZObjectType() - _element = cls._schema_on_201.properties.insights.Element + _element = cls._schema_on_200_201.properties.insights.Element _element.additional_parameters = AAZDictType( serialized_name="additionalParameters", ) @@ -314,10 +314,10 @@ def _build_schema_on_201(cls): serialized_name="solutionId", ) - additional_parameters = cls._schema_on_201.properties.insights.Element.additional_parameters + additional_parameters = cls._schema_on_200_201.properties.insights.Element.additional_parameters additional_parameters.Element = AAZStrType() - system_data = cls._schema_on_201.system_data + system_data = cls._schema_on_200_201.system_data system_data.created_at = AAZStrType( serialized_name="createdAt", ) @@ -337,7 +337,7 @@ def _build_schema_on_201(cls): serialized_name="lastModifiedByType", ) - return cls._schema_on_201 + return cls._schema_on_200_201 class _CreateHelper: diff --git a/src/self-help/azext_self_help/aaz/latest/self_help/diagnostic/_show.py b/src/self-help/azext_self_help/aaz/latest/self_help/diagnostic/_show.py index 0e3e54b74e7..731d86baca4 100644 --- a/src/self-help/azext_self_help/aaz/latest/self_help/diagnostic/_show.py +++ b/src/self-help/azext_self_help/aaz/latest/self_help/diagnostic/_show.py @@ -19,13 +19,13 @@ class Show(AAZCommand): """Get the diagnostics using the 'diagnosticsResourceName' you chose while creating the diagnostic. :example: Show Diagnostic at Resource Level - az self-help diagnostic show --diagnostic-name {diagnostic-name} --scope {scope} + az self-help diagnostic show --diagnostic-name diagnostic-name --scope 'subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read' """ _aaz_info = { - "version": "2023-01-01-preview", + "version": "2023-09-01-preview", "resources": [ - ["mgmt-plane", "/{scope}/providers/microsoft.help/diagnostics/{}", "2023-01-01-preview"], + ["mgmt-plane", "/{scope}/providers/microsoft.help/diagnostics/{}", "2023-09-01-preview"], ] } @@ -47,7 +47,7 @@ def _build_arguments_schema(cls, *args, **kwargs): _args_schema = cls._args_schema _args_schema.diagnostic_name = AAZStrArg( options=["--diagnostic-name"], - help="unique resource name for diagnostic proxy resources", + help="Unique resource name for insight resources", required=True, fmt=AAZStrArgFormat( pattern="^[A-Za-z0-9-+@()_]+$", @@ -124,7 +124,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2023-01-01-preview", + "api-version", "2023-09-01-preview", required=True, ), } diff --git a/src/self-help/azext_self_help/aaz/latest/self_help/diagnostic/_wait.py b/src/self-help/azext_self_help/aaz/latest/self_help/diagnostic/_wait.py index 448eff3e54a..4b8ee8b3261 100644 --- a/src/self-help/azext_self_help/aaz/latest/self_help/diagnostic/_wait.py +++ b/src/self-help/azext_self_help/aaz/latest/self_help/diagnostic/_wait.py @@ -20,7 +20,7 @@ class Wait(AAZWaitCommand): _aaz_info = { "resources": [ - ["mgmt-plane", "/{scope}/providers/microsoft.help/diagnostics/{}", "2023-01-01-preview"], + ["mgmt-plane", "/{scope}/providers/microsoft.help/diagnostics/{}", "2023-09-01-preview"], ] } @@ -42,7 +42,7 @@ def _build_arguments_schema(cls, *args, **kwargs): _args_schema = cls._args_schema _args_schema.diagnostic_name = AAZStrArg( options=["--diagnostic-name"], - help="unique resource name for diagnostic proxy resources", + help="Unique resource name for insight resources", required=True, fmt=AAZStrArgFormat( pattern="^[A-Za-z0-9-+@()_]+$", @@ -119,7 +119,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2023-01-01-preview", + "api-version", "2023-09-01-preview", required=True, ), } diff --git a/src/self-help/azext_self_help/aaz/latest/self_help/discovery_solution/_list.py b/src/self-help/azext_self_help/aaz/latest/self_help/discovery_solution/_list.py index a583f41191e..d847a61a1cd 100644 --- a/src/self-help/azext_self_help/aaz/latest/self_help/discovery_solution/_list.py +++ b/src/self-help/azext_self_help/aaz/latest/self_help/discovery_solution/_list.py @@ -16,19 +16,21 @@ is_preview=True, ) class List(AAZCommand): - """list the existing available solutions for the problemClassificationId or the resourceUri for the Azure resource. + """List the relevant Azure diagnostics and solutions using problemClassificationId API AND resourceUri or resourceType. :example: List DiscoverySolution results for a resource - az self-help discovery-solution list --scope {scope} + az self-help discovery-solution list --filter "ProblemClassificationId eq '00000000-0000-0000-0000-000000000000'" --scope 'subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read' """ _aaz_info = { - "version": "2023-01-01-preview", + "version": "2023-09-01-preview", "resources": [ - ["mgmt-plane", "/{scope}/providers/microsoft.help/discoverysolutions", "2023-01-01-preview"], + ["mgmt-plane", "/{scope}/providers/microsoft.help/discoverysolutions", "2023-09-01-preview"], ] } + AZ_SUPPORT_PAGINATION = True + def _handler(self, command_args): super()._handler(command_args) return self.build_paging(self._execute_operations, self._output) @@ -51,11 +53,11 @@ def _build_arguments_schema(cls, *args, **kwargs): ) _args_schema.filter = AAZStrArg( options=["--filter"], - help="Can be used to filter solutionIds by 'ProblemClassificationId'. The filter supports only 'and' and 'eq' operators. Example: $filter=ProblemClassificationId eq '1ddda5b4-cf6c-4d4f-91ad-bc38ab0e811e' and ProblemClassificationId eq '0a9673c2-7af6-4e19-90d3-4ee2461076d9'.", + help="'ProblemClassificationId' or 'Id' is a mandatory filter to get solutions ids. It also supports optional 'ResourceType' and 'SolutionType' filters. The filter supports only 'and', 'or' and 'eq' operators. Example: $filter=ProblemClassificationId eq '1ddda5b4-cf6c-4d4f-91ad-bc38ab0e811e'", ) _args_schema.skiptoken = AAZStrArg( options=["--skiptoken"], - help="Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls.", + help="Skiptoken is only used if a previous operation returned a partial result.", ) return cls._args_schema @@ -124,7 +126,7 @@ def query_parameters(self): "$skiptoken", self.ctx.args.skiptoken, ), **self.serialize_query_param( - "api-version", "2023-01-01-preview", + "api-version", "2023-09-01-preview", required=True, ), } @@ -184,22 +186,29 @@ def _build_schema_on_200(cls): ) properties = cls._schema_on_200.value.Element.properties - properties.description = AAZStrType() - properties.required_parameter_sets = AAZListType( - serialized_name="requiredParameterSets", + properties.solutions = AAZListType() + + solutions = cls._schema_on_200.value.Element.properties.solutions + solutions.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.solutions.Element + _element.description = AAZStrType( + flags={"read_only": True}, ) - properties.solution_id = AAZStrType( + _element.required_inputs = AAZListType( + serialized_name="requiredInputs", + flags={"read_only": True}, + ) + _element.solution_id = AAZStrType( serialized_name="solutionId", ) - properties.solution_type = AAZStrType( + _element.solution_type = AAZStrType( serialized_name="solutionType", + flags={"read_only": True}, ) - required_parameter_sets = cls._schema_on_200.value.Element.properties.required_parameter_sets - required_parameter_sets.Element = AAZListType() - - _element = cls._schema_on_200.value.Element.properties.required_parameter_sets.Element - _element.Element = AAZStrType() + required_inputs = cls._schema_on_200.value.Element.properties.solutions.Element.required_inputs + required_inputs.Element = AAZStrType() system_data = cls._schema_on_200.value.Element.system_data system_data.created_at = AAZStrType( diff --git a/src/self-help/azext_self_help/aaz/latest/self_help/solution/__cmd_group.py b/src/self-help/azext_self_help/aaz/latest/self_help/solution/__cmd_group.py new file mode 100644 index 00000000000..099696d9cee --- /dev/null +++ b/src/self-help/azext_self_help/aaz/latest/self_help/solution/__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( + "self-help solution", + is_preview=True, +) +class __CMDGroup(AAZCommandGroup): + """solution command will help you create solutions for azure resources. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/self-help/azext_self_help/aaz/latest/self_help/solution/__init__.py b/src/self-help/azext_self_help/aaz/latest/self_help/solution/__init__.py new file mode 100644 index 00000000000..57f3778e840 --- /dev/null +++ b/src/self-help/azext_self_help/aaz/latest/self_help/solution/__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 ._create import * +from ._show import * +from ._update import * +from ._wait import * diff --git a/src/self-help/azext_self_help/aaz/latest/self_help/solution/_create.py b/src/self-help/azext_self_help/aaz/latest/self_help/solution/_create.py new file mode 100644 index 00000000000..87b1e32e001 --- /dev/null +++ b/src/self-help/azext_self_help/aaz/latest/self_help/solution/_create.py @@ -0,0 +1,922 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "self-help solution create", + is_preview=True, +) +class Create(AAZCommand): + """Create a solution for the specific Azure resource or subscription using the triggering criteria from discovery solutions. + + :example: Create Solution at Resource Level + az self-help solution create --solution-name solution-name --trigger-criteria [{name:solutionid,value:Demo2InsightV2}] --parameters {} --scope 'subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read' + """ + + _aaz_info = { + "version": "2023-09-01-preview", + "resources": [ + ["mgmt-plane", "/{scope}/providers/microsoft.help/solutions/{}", "2023-09-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.scope = AAZStrArg( + options=["--scope"], + help="This is an extension resource provider and only resource level extension is supported at the moment.", + required=True, + ) + _args_schema.solution_name = AAZStrArg( + options=["--solution-name"], + help="Solution resource Name.", + required=True, + fmt=AAZStrArgFormat( + pattern="^[A-Za-z0-9-+@()_]+$", + max_length=100, + min_length=1, + ), + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.content = AAZStrArg( + options=["--content"], + arg_group="Properties", + help="The HTML content that needs to be rendered and shown to customer.", + ) + _args_schema.parameters = AAZDictArg( + options=["--parameters"], + arg_group="Properties", + help="Client input parameters to run Solution", + ) + _args_schema.provisioning_state = AAZStrArg( + options=["--provisioning-state"], + arg_group="Properties", + help="Status of solution provisioning.", + enum={"Canceled": "Canceled", "Failed": "Failed", "Succeeded": "Succeeded"}, + ) + _args_schema.replacement_maps = AAZObjectArg( + options=["--replacement-maps"], + arg_group="Properties", + help="Solution replacement maps.", + ) + cls._build_args_replacement_maps_create(_args_schema.replacement_maps) + _args_schema.sections = AAZListArg( + options=["--sections"], + arg_group="Properties", + help="List of section object.", + ) + _args_schema.solution_id = AAZStrArg( + options=["--solution-id"], + arg_group="Properties", + help="Solution Id to identify single solution.", + ) + _args_schema.title = AAZStrArg( + options=["--title"], + arg_group="Properties", + help="The title.", + ) + _args_schema.trigger_criteria = AAZListArg( + options=["--trigger-criteria"], + arg_group="Properties", + help="Solution request trigger criteria", + ) + + parameters = cls._args_schema.parameters + parameters.Element = AAZStrArg() + + sections = cls._args_schema.sections + sections.Element = AAZObjectArg() + + _element = cls._args_schema.sections.Element + _element.content = AAZStrArg( + options=["content"], + help="Solution sections content.", + ) + _element.replacement_maps = AAZObjectArg( + options=["replacement-maps"], + ) + cls._build_args_replacement_maps_create(_element.replacement_maps) + _element.title = AAZStrArg( + options=["title"], + help="Solution sections title.", + ) + + trigger_criteria = cls._args_schema.trigger_criteria + trigger_criteria.Element = AAZObjectArg() + + _element = cls._args_schema.trigger_criteria.Element + _element.name = AAZStrArg( + options=["name"], + help="Trigger criterion name.", + enum={"ProblemClassificationId": "ProblemClassificationId", "ReplacementKey": "ReplacementKey", "SolutionId": "SolutionId"}, + ) + _element.value = AAZStrArg( + options=["value"], + help="Trigger criterion value.", + ) + return cls._args_schema + + _args_replacement_maps_create = None + + @classmethod + def _build_args_replacement_maps_create(cls, _schema): + if cls._args_replacement_maps_create is not None: + _schema.diagnostics = cls._args_replacement_maps_create.diagnostics + _schema.metrics_based_charts = cls._args_replacement_maps_create.metrics_based_charts + _schema.troubleshooters = cls._args_replacement_maps_create.troubleshooters + _schema.video_groups = cls._args_replacement_maps_create.video_groups + _schema.videos = cls._args_replacement_maps_create.videos + _schema.web_results = cls._args_replacement_maps_create.web_results + return + + cls._args_replacement_maps_create = AAZObjectArg() + + replacement_maps_create = cls._args_replacement_maps_create + replacement_maps_create.diagnostics = AAZListArg( + options=["diagnostics"], + help="Solution diagnostics results.", + ) + replacement_maps_create.metrics_based_charts = AAZListArg( + options=["metrics-based-charts"], + help="Solution metrics based charts", + ) + replacement_maps_create.troubleshooters = AAZListArg( + options=["troubleshooters"], + help="Solutions Troubleshooters", + ) + replacement_maps_create.video_groups = AAZListArg( + options=["video-groups"], + help="Group of Videos", + ) + replacement_maps_create.videos = AAZListArg( + options=["videos"], + help="Video solutions, which have the power to engage the customer by stimulating their senses", + ) + replacement_maps_create.web_results = AAZListArg( + options=["web-results"], + help="Solution AzureKB results", + ) + + diagnostics = cls._args_replacement_maps_create.diagnostics + diagnostics.Element = AAZObjectArg() + + _element = cls._args_replacement_maps_create.diagnostics.Element + _element.insights = AAZListArg( + options=["insights"], + help="Diagnostic insights", + ) + _element.replacement_key = AAZStrArg( + options=["replacement-key"], + help="Place holder used in HTML Content replace control with the content", + ) + _element.required_parameters = AAZListArg( + options=["required-parameters"], + help="Required parameters of this item", + ) + _element.solution_id = AAZStrArg( + options=["solution-id"], + help="Solution Id to identify single Solutions Diagnostic", + ) + _element.status = AAZStrArg( + options=["status"], + help="The status of the resource.", + enum={"Failed": "Failed", "MissingInputs": "MissingInputs", "Running": "Running", "Succeeded": "Succeeded", "Timeout": "Timeout"}, + ) + _element.status_details = AAZStrArg( + options=["status-details"], + help="Details of the status", + ) + + insights = cls._args_replacement_maps_create.diagnostics.Element.insights + insights.Element = AAZObjectArg() + + _element = cls._args_replacement_maps_create.diagnostics.Element.insights.Element + _element.id = AAZStrArg( + options=["id"], + help="Article id.", + ) + _element.importance_level = AAZStrArg( + options=["importance-level"], + help="Importance level of the insight.", + enum={"Critical": "Critical", "Information": "Information", "Warning": "Warning"}, + ) + _element.results = AAZStrArg( + options=["results"], + help="Detailed result content.", + ) + _element.title = AAZStrArg( + options=["title"], + help="This insight's title.", + ) + + required_parameters = cls._args_replacement_maps_create.diagnostics.Element.required_parameters + required_parameters.Element = AAZStrArg() + + metrics_based_charts = cls._args_replacement_maps_create.metrics_based_charts + metrics_based_charts.Element = AAZObjectArg() + + _element = cls._args_replacement_maps_create.metrics_based_charts.Element + _element.aggregation_type = AAZStrArg( + options=["aggregation-type"], + help="Allowed values are Sum, Avg, Count, Min, Max. Default is Sum", + enum={"Avg": "Avg", "Count": "Count", "Max": "Max", "Min": "Min", "Sum": "Sum"}, + ) + _element.filter_group = AAZObjectArg( + options=["filter-group"], + help="Filter group", + ) + _element.name = AAZStrArg( + options=["name"], + help="Chart name", + ) + _element.replacement_key = AAZStrArg( + options=["replacement-key"], + help="Place holder used in HTML Content replace control with the content", + ) + _element.time_span_duration = AAZStrArg( + options=["time-span-duration"], + help="Time span duration", + ) + _element.title = AAZStrArg( + options=["title"], + help="Chart title", + ) + + filter_group = cls._args_replacement_maps_create.metrics_based_charts.Element.filter_group + filter_group.filter = AAZListArg( + options=["filter"], + help="List of filters", + ) + + filter = cls._args_replacement_maps_create.metrics_based_charts.Element.filter_group.filter + filter.Element = AAZObjectArg() + + _element = cls._args_replacement_maps_create.metrics_based_charts.Element.filter_group.filter.Element + _element.name = AAZStrArg( + options=["name"], + help="Filter name", + ) + _element.operator = AAZStrArg( + options=["operator"], + help="Filter operator", + ) + _element.values = AAZStrArg( + options=["values"], + help="Filter values", + ) + + troubleshooters = cls._args_replacement_maps_create.troubleshooters + troubleshooters.Element = AAZObjectArg() + + _element = cls._args_replacement_maps_create.troubleshooters.Element + _element.solution_id = AAZStrArg( + options=["solution-id"], + help="Solution Id to identify single Solutions Troubleshooter", + ) + _element.summary = AAZStrArg( + options=["summary"], + help="Troubleshooter summary", + ) + _element.title = AAZStrArg( + options=["title"], + help="Troubleshooter title", + ) + + video_groups = cls._args_replacement_maps_create.video_groups + video_groups.Element = AAZObjectArg() + + _element = cls._args_replacement_maps_create.video_groups.Element + _element.replacement_key = AAZStrArg( + options=["replacement-key"], + help="Place holder used in HTML Content replace control with the insight content", + ) + _element.videos = AAZListArg( + options=["videos"], + help="List of videos will be shown to customers", + ) + + videos = cls._args_replacement_maps_create.video_groups.Element.videos + videos.Element = AAZObjectArg() + + _element = cls._args_replacement_maps_create.video_groups.Element.videos.Element + _element.src = AAZStrArg( + options=["src"], + help="Link to the video", + ) + _element.title = AAZStrArg( + options=["title"], + help="Title of the video", + ) + + videos = cls._args_replacement_maps_create.videos + videos.Element = AAZObjectArg() + + _element = cls._args_replacement_maps_create.videos.Element + _element.replacement_key = AAZStrArg( + options=["replacement-key"], + help="Place holder used in HTML Content replace control with the insight content", + ) + _element.src = AAZStrArg( + options=["src"], + help="Link to the video", + ) + _element.title = AAZStrArg( + options=["title"], + help="Title of the video", + ) + + web_results = cls._args_replacement_maps_create.web_results + web_results.Element = AAZObjectArg() + + _element = cls._args_replacement_maps_create.web_results.Element + _element.replacement_key = AAZStrArg( + options=["replacement-key"], + help="Place holder used in HTML Content replace control with the content", + ) + _element.search_results = AAZListArg( + options=["search-results"], + help="AzureKB search results", + ) + + search_results = cls._args_replacement_maps_create.web_results.Element.search_results + search_results.Element = AAZObjectArg() + + _element = cls._args_replacement_maps_create.web_results.Element.search_results.Element + _element.confidence = AAZStrArg( + options=["confidence"], + help="Confidence of the search result.", + enum={"High": "High", "Low": "Low", "Medium": "Medium"}, + ) + _element.content = AAZStrArg( + options=["content"], + help="Content of the search result.", + ) + _element.link = AAZStrArg( + options=["link"], + help="Link to the document.", + ) + _element.rank = AAZIntArg( + options=["rank"], + help="rank of the search result", + ) + _element.result_type = AAZStrArg( + options=["result-type"], + help="Result type of the search result.", + enum={"Community": "Community", "Documentation": "Documentation"}, + ) + _element.solution_id = AAZStrArg( + options=["solution-id"], + help="Unique id of the result.", + ) + _element.source = AAZStrArg( + options=["source"], + help="Source of the search result.", + ) + _element.title = AAZStrArg( + options=["title"], + help="Title of the search result.", + ) + + _schema.diagnostics = cls._args_replacement_maps_create.diagnostics + _schema.metrics_based_charts = cls._args_replacement_maps_create.metrics_based_charts + _schema.troubleshooters = cls._args_replacement_maps_create.troubleshooters + _schema.video_groups = cls._args_replacement_maps_create.video_groups + _schema.videos = cls._args_replacement_maps_create.videos + _schema.web_results = cls._args_replacement_maps_create.web_results + + def _execute_operations(self): + self.pre_operations() + yield self.SolutionCreate(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 SolutionCreate(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( + "/{scope}/providers/Microsoft.Help/solutions/{solutionResourceName}", + **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( + "scope", self.ctx.args.scope, + skip_quote=True, + required=True, + ), + **self.serialize_url_param( + "solutionResourceName", self.ctx.args.solution_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2023-09-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": {"client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("content", AAZStrType, ".content") + properties.set_prop("parameters", AAZDictType, ".parameters") + properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") + _CreateHelper._build_schema_replacement_maps_create(properties.set_prop("replacementMaps", AAZObjectType, ".replacement_maps")) + properties.set_prop("sections", AAZListType, ".sections") + properties.set_prop("solutionId", AAZStrType, ".solution_id") + properties.set_prop("title", AAZStrType, ".title") + properties.set_prop("triggerCriteria", AAZListType, ".trigger_criteria") + + parameters = _builder.get(".properties.parameters") + if parameters is not None: + parameters.set_elements(AAZStrType, ".") + + sections = _builder.get(".properties.sections") + if sections is not None: + sections.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.sections[]") + if _elements is not None: + _elements.set_prop("content", AAZStrType, ".content") + _CreateHelper._build_schema_replacement_maps_create(_elements.set_prop("replacementMaps", AAZObjectType, ".replacement_maps")) + _elements.set_prop("title", AAZStrType, ".title") + + trigger_criteria = _builder.get(".properties.triggerCriteria") + if trigger_criteria is not None: + trigger_criteria.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.triggerCriteria[]") + if _elements is not None: + _elements.set_prop("name", AAZStrType, ".name") + _elements.set_prop("value", AAZStrType, ".value") + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.content = AAZStrType() + properties.parameters = AAZDictType() + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + ) + properties.replacement_maps = AAZObjectType( + serialized_name="replacementMaps", + ) + _CreateHelper._build_schema_replacement_maps_read(properties.replacement_maps) + properties.sections = AAZListType() + properties.solution_id = AAZStrType( + serialized_name="solutionId", + ) + properties.title = AAZStrType() + properties.trigger_criteria = AAZListType( + serialized_name="triggerCriteria", + ) + + parameters = cls._schema_on_200_201.properties.parameters + parameters.Element = AAZStrType() + + sections = cls._schema_on_200_201.properties.sections + sections.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.sections.Element + _element.content = AAZStrType() + _element.replacement_maps = AAZObjectType( + serialized_name="replacementMaps", + ) + _CreateHelper._build_schema_replacement_maps_read(_element.replacement_maps) + _element.title = AAZStrType() + + trigger_criteria = cls._schema_on_200_201.properties.trigger_criteria + trigger_criteria.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.trigger_criteria.Element + _element.name = AAZStrType() + _element.value = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + @classmethod + def _build_schema_replacement_maps_create(cls, _builder): + if _builder is None: + return + _builder.set_prop("diagnostics", AAZListType, ".diagnostics") + _builder.set_prop("metricsBasedCharts", AAZListType, ".metrics_based_charts") + _builder.set_prop("troubleshooters", AAZListType, ".troubleshooters") + _builder.set_prop("videoGroups", AAZListType, ".video_groups") + _builder.set_prop("videos", AAZListType, ".videos") + _builder.set_prop("webResults", AAZListType, ".web_results") + + diagnostics = _builder.get(".diagnostics") + if diagnostics is not None: + diagnostics.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".diagnostics[]") + if _elements is not None: + _elements.set_prop("insights", AAZListType, ".insights") + _elements.set_prop("replacementKey", AAZStrType, ".replacement_key") + _elements.set_prop("requiredParameters", AAZListType, ".required_parameters") + _elements.set_prop("solutionId", AAZStrType, ".solution_id") + _elements.set_prop("status", AAZStrType, ".status") + _elements.set_prop("statusDetails", AAZStrType, ".status_details") + + insights = _builder.get(".diagnostics[].insights") + if insights is not None: + insights.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".diagnostics[].insights[]") + if _elements is not None: + _elements.set_prop("id", AAZStrType, ".id") + _elements.set_prop("importanceLevel", AAZStrType, ".importance_level") + _elements.set_prop("results", AAZStrType, ".results") + _elements.set_prop("title", AAZStrType, ".title") + + required_parameters = _builder.get(".diagnostics[].requiredParameters") + if required_parameters is not None: + required_parameters.set_elements(AAZStrType, ".") + + metrics_based_charts = _builder.get(".metricsBasedCharts") + if metrics_based_charts is not None: + metrics_based_charts.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".metricsBasedCharts[]") + if _elements is not None: + _elements.set_prop("aggregationType", AAZStrType, ".aggregation_type") + _elements.set_prop("filterGroup", AAZObjectType, ".filter_group") + _elements.set_prop("name", AAZStrType, ".name") + _elements.set_prop("replacementKey", AAZStrType, ".replacement_key") + _elements.set_prop("timeSpanDuration", AAZStrType, ".time_span_duration") + _elements.set_prop("title", AAZStrType, ".title") + + filter_group = _builder.get(".metricsBasedCharts[].filterGroup") + if filter_group is not None: + filter_group.set_prop("filter", AAZListType, ".filter") + + filter = _builder.get(".metricsBasedCharts[].filterGroup.filter") + if filter is not None: + filter.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".metricsBasedCharts[].filterGroup.filter[]") + if _elements is not None: + _elements.set_prop("name", AAZStrType, ".name") + _elements.set_prop("operator", AAZStrType, ".operator") + _elements.set_prop("values", AAZStrType, ".values") + + troubleshooters = _builder.get(".troubleshooters") + if troubleshooters is not None: + troubleshooters.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".troubleshooters[]") + if _elements is not None: + _elements.set_prop("solutionId", AAZStrType, ".solution_id") + _elements.set_prop("summary", AAZStrType, ".summary") + _elements.set_prop("title", AAZStrType, ".title") + + video_groups = _builder.get(".videoGroups") + if video_groups is not None: + video_groups.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".videoGroups[]") + if _elements is not None: + _elements.set_prop("replacementKey", AAZStrType, ".replacement_key") + _elements.set_prop("videos", AAZListType, ".videos") + + videos = _builder.get(".videoGroups[].videos") + if videos is not None: + videos.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".videoGroups[].videos[]") + if _elements is not None: + _elements.set_prop("src", AAZStrType, ".src") + _elements.set_prop("title", AAZStrType, ".title") + + videos = _builder.get(".videos") + if videos is not None: + videos.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".videos[]") + if _elements is not None: + _elements.set_prop("replacementKey", AAZStrType, ".replacement_key") + _elements.set_prop("src", AAZStrType, ".src") + _elements.set_prop("title", AAZStrType, ".title") + + web_results = _builder.get(".webResults") + if web_results is not None: + web_results.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".webResults[]") + if _elements is not None: + _elements.set_prop("replacementKey", AAZStrType, ".replacement_key") + _elements.set_prop("searchResults", AAZListType, ".search_results") + + search_results = _builder.get(".webResults[].searchResults") + if search_results is not None: + search_results.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".webResults[].searchResults[]") + if _elements is not None: + _elements.set_prop("confidence", AAZStrType, ".confidence") + _elements.set_prop("content", AAZStrType, ".content") + _elements.set_prop("link", AAZStrType, ".link") + _elements.set_prop("rank", AAZIntType, ".rank") + _elements.set_prop("resultType", AAZStrType, ".result_type") + _elements.set_prop("solutionId", AAZStrType, ".solution_id") + _elements.set_prop("source", AAZStrType, ".source") + _elements.set_prop("title", AAZStrType, ".title") + + _schema_replacement_maps_read = None + + @classmethod + def _build_schema_replacement_maps_read(cls, _schema): + if cls._schema_replacement_maps_read is not None: + _schema.diagnostics = cls._schema_replacement_maps_read.diagnostics + _schema.metrics_based_charts = cls._schema_replacement_maps_read.metrics_based_charts + _schema.troubleshooters = cls._schema_replacement_maps_read.troubleshooters + _schema.video_groups = cls._schema_replacement_maps_read.video_groups + _schema.videos = cls._schema_replacement_maps_read.videos + _schema.web_results = cls._schema_replacement_maps_read.web_results + return + + cls._schema_replacement_maps_read = _schema_replacement_maps_read = AAZObjectType() + + replacement_maps_read = _schema_replacement_maps_read + replacement_maps_read.diagnostics = AAZListType() + replacement_maps_read.metrics_based_charts = AAZListType( + serialized_name="metricsBasedCharts", + ) + replacement_maps_read.troubleshooters = AAZListType() + replacement_maps_read.video_groups = AAZListType( + serialized_name="videoGroups", + ) + replacement_maps_read.videos = AAZListType() + replacement_maps_read.web_results = AAZListType( + serialized_name="webResults", + ) + + diagnostics = _schema_replacement_maps_read.diagnostics + diagnostics.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.diagnostics.Element + _element.insights = AAZListType() + _element.replacement_key = AAZStrType( + serialized_name="replacementKey", + ) + _element.required_parameters = AAZListType( + serialized_name="requiredParameters", + ) + _element.solution_id = AAZStrType( + serialized_name="solutionId", + ) + _element.status = AAZStrType() + _element.status_details = AAZStrType( + serialized_name="statusDetails", + ) + + insights = _schema_replacement_maps_read.diagnostics.Element.insights + insights.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.diagnostics.Element.insights.Element + _element.id = AAZStrType() + _element.importance_level = AAZStrType( + serialized_name="importanceLevel", + ) + _element.results = AAZStrType() + _element.title = AAZStrType() + + required_parameters = _schema_replacement_maps_read.diagnostics.Element.required_parameters + required_parameters.Element = AAZStrType() + + metrics_based_charts = _schema_replacement_maps_read.metrics_based_charts + metrics_based_charts.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.metrics_based_charts.Element + _element.aggregation_type = AAZStrType( + serialized_name="aggregationType", + ) + _element.filter_group = AAZObjectType( + serialized_name="filterGroup", + ) + _element.name = AAZStrType() + _element.replacement_key = AAZStrType( + serialized_name="replacementKey", + ) + _element.time_span_duration = AAZStrType( + serialized_name="timeSpanDuration", + ) + _element.title = AAZStrType() + + filter_group = _schema_replacement_maps_read.metrics_based_charts.Element.filter_group + filter_group.filter = AAZListType() + + filter = _schema_replacement_maps_read.metrics_based_charts.Element.filter_group.filter + filter.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.metrics_based_charts.Element.filter_group.filter.Element + _element.name = AAZStrType() + _element.operator = AAZStrType() + _element.values = AAZStrType() + + troubleshooters = _schema_replacement_maps_read.troubleshooters + troubleshooters.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.troubleshooters.Element + _element.solution_id = AAZStrType( + serialized_name="solutionId", + ) + _element.summary = AAZStrType() + _element.title = AAZStrType() + + video_groups = _schema_replacement_maps_read.video_groups + video_groups.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.video_groups.Element + _element.replacement_key = AAZStrType( + serialized_name="replacementKey", + ) + _element.videos = AAZListType() + + videos = _schema_replacement_maps_read.video_groups.Element.videos + videos.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.video_groups.Element.videos.Element + _element.src = AAZStrType() + _element.title = AAZStrType() + + videos = _schema_replacement_maps_read.videos + videos.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.videos.Element + _element.replacement_key = AAZStrType( + serialized_name="replacementKey", + ) + _element.src = AAZStrType() + _element.title = AAZStrType() + + web_results = _schema_replacement_maps_read.web_results + web_results.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.web_results.Element + _element.replacement_key = AAZStrType( + serialized_name="replacementKey", + ) + _element.search_results = AAZListType( + serialized_name="searchResults", + ) + + search_results = _schema_replacement_maps_read.web_results.Element.search_results + search_results.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.web_results.Element.search_results.Element + _element.confidence = AAZStrType() + _element.content = AAZStrType() + _element.link = AAZStrType() + _element.rank = AAZIntType() + _element.result_type = AAZStrType( + serialized_name="resultType", + ) + _element.solution_id = AAZStrType( + serialized_name="solutionId", + ) + _element.source = AAZStrType() + _element.title = AAZStrType() + + _schema.diagnostics = cls._schema_replacement_maps_read.diagnostics + _schema.metrics_based_charts = cls._schema_replacement_maps_read.metrics_based_charts + _schema.troubleshooters = cls._schema_replacement_maps_read.troubleshooters + _schema.video_groups = cls._schema_replacement_maps_read.video_groups + _schema.videos = cls._schema_replacement_maps_read.videos + _schema.web_results = cls._schema_replacement_maps_read.web_results + + +__all__ = ["Create"] diff --git a/src/self-help/azext_self_help/aaz/latest/self_help/solution/_show.py b/src/self-help/azext_self_help/aaz/latest/self_help/solution/_show.py new file mode 100644 index 00000000000..070e95c954e --- /dev/null +++ b/src/self-help/azext_self_help/aaz/latest/self_help/solution/_show.py @@ -0,0 +1,381 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "self-help solution show", + is_preview=True, +) +class Show(AAZCommand): + """Get the solution using the applicable solutionResourceName while creating the solution. + + :example: Show Solution at Resource Level + az self-help solution show --solution-name solution-name --scope 'subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read' + """ + + _aaz_info = { + "version": "2023-09-01-preview", + "resources": [ + ["mgmt-plane", "/{scope}/providers/microsoft.help/solutions/{}", "2023-09-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.scope = AAZStrArg( + options=["--scope"], + help="This is an extension resource provider and only resource level extension is supported at the moment.", + required=True, + ) + _args_schema.solution_name = AAZStrArg( + options=["--solution-name"], + help="Solution resource Name.", + required=True, + fmt=AAZStrArgFormat( + pattern="^[A-Za-z0-9-+@()_]+$", + max_length=100, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.SolutionGet(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 SolutionGet(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( + "/{scope}/providers/Microsoft.Help/solutions/{solutionResourceName}", + **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( + "scope", self.ctx.args.scope, + skip_quote=True, + required=True, + ), + **self.serialize_url_param( + "solutionResourceName", self.ctx.args.solution_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2023-09-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.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.content = AAZStrType() + properties.parameters = AAZDictType() + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + ) + properties.replacement_maps = AAZObjectType( + serialized_name="replacementMaps", + ) + _ShowHelper._build_schema_replacement_maps_read(properties.replacement_maps) + properties.sections = AAZListType() + properties.solution_id = AAZStrType( + serialized_name="solutionId", + ) + properties.title = AAZStrType() + properties.trigger_criteria = AAZListType( + serialized_name="triggerCriteria", + ) + + parameters = cls._schema_on_200.properties.parameters + parameters.Element = AAZStrType() + + sections = cls._schema_on_200.properties.sections + sections.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.sections.Element + _element.content = AAZStrType() + _element.replacement_maps = AAZObjectType( + serialized_name="replacementMaps", + ) + _ShowHelper._build_schema_replacement_maps_read(_element.replacement_maps) + _element.title = AAZStrType() + + trigger_criteria = cls._schema_on_200.properties.trigger_criteria + trigger_criteria.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.trigger_criteria.Element + _element.name = AAZStrType() + _element.value = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + _schema_replacement_maps_read = None + + @classmethod + def _build_schema_replacement_maps_read(cls, _schema): + if cls._schema_replacement_maps_read is not None: + _schema.diagnostics = cls._schema_replacement_maps_read.diagnostics + _schema.metrics_based_charts = cls._schema_replacement_maps_read.metrics_based_charts + _schema.troubleshooters = cls._schema_replacement_maps_read.troubleshooters + _schema.video_groups = cls._schema_replacement_maps_read.video_groups + _schema.videos = cls._schema_replacement_maps_read.videos + _schema.web_results = cls._schema_replacement_maps_read.web_results + return + + cls._schema_replacement_maps_read = _schema_replacement_maps_read = AAZObjectType() + + replacement_maps_read = _schema_replacement_maps_read + replacement_maps_read.diagnostics = AAZListType() + replacement_maps_read.metrics_based_charts = AAZListType( + serialized_name="metricsBasedCharts", + ) + replacement_maps_read.troubleshooters = AAZListType() + replacement_maps_read.video_groups = AAZListType( + serialized_name="videoGroups", + ) + replacement_maps_read.videos = AAZListType() + replacement_maps_read.web_results = AAZListType( + serialized_name="webResults", + ) + + diagnostics = _schema_replacement_maps_read.diagnostics + diagnostics.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.diagnostics.Element + _element.insights = AAZListType() + _element.replacement_key = AAZStrType( + serialized_name="replacementKey", + ) + _element.required_parameters = AAZListType( + serialized_name="requiredParameters", + ) + _element.solution_id = AAZStrType( + serialized_name="solutionId", + ) + _element.status = AAZStrType() + _element.status_details = AAZStrType( + serialized_name="statusDetails", + ) + + insights = _schema_replacement_maps_read.diagnostics.Element.insights + insights.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.diagnostics.Element.insights.Element + _element.id = AAZStrType() + _element.importance_level = AAZStrType( + serialized_name="importanceLevel", + ) + _element.results = AAZStrType() + _element.title = AAZStrType() + + required_parameters = _schema_replacement_maps_read.diagnostics.Element.required_parameters + required_parameters.Element = AAZStrType() + + metrics_based_charts = _schema_replacement_maps_read.metrics_based_charts + metrics_based_charts.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.metrics_based_charts.Element + _element.aggregation_type = AAZStrType( + serialized_name="aggregationType", + ) + _element.filter_group = AAZObjectType( + serialized_name="filterGroup", + ) + _element.name = AAZStrType() + _element.replacement_key = AAZStrType( + serialized_name="replacementKey", + ) + _element.time_span_duration = AAZStrType( + serialized_name="timeSpanDuration", + ) + _element.title = AAZStrType() + + filter_group = _schema_replacement_maps_read.metrics_based_charts.Element.filter_group + filter_group.filter = AAZListType() + + filter = _schema_replacement_maps_read.metrics_based_charts.Element.filter_group.filter + filter.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.metrics_based_charts.Element.filter_group.filter.Element + _element.name = AAZStrType() + _element.operator = AAZStrType() + _element.values = AAZStrType() + + troubleshooters = _schema_replacement_maps_read.troubleshooters + troubleshooters.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.troubleshooters.Element + _element.solution_id = AAZStrType( + serialized_name="solutionId", + ) + _element.summary = AAZStrType() + _element.title = AAZStrType() + + video_groups = _schema_replacement_maps_read.video_groups + video_groups.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.video_groups.Element + _element.replacement_key = AAZStrType( + serialized_name="replacementKey", + ) + _element.videos = AAZListType() + + videos = _schema_replacement_maps_read.video_groups.Element.videos + videos.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.video_groups.Element.videos.Element + _element.src = AAZStrType() + _element.title = AAZStrType() + + videos = _schema_replacement_maps_read.videos + videos.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.videos.Element + _element.replacement_key = AAZStrType( + serialized_name="replacementKey", + ) + _element.src = AAZStrType() + _element.title = AAZStrType() + + web_results = _schema_replacement_maps_read.web_results + web_results.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.web_results.Element + _element.replacement_key = AAZStrType( + serialized_name="replacementKey", + ) + _element.search_results = AAZListType( + serialized_name="searchResults", + ) + + search_results = _schema_replacement_maps_read.web_results.Element.search_results + search_results.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.web_results.Element.search_results.Element + _element.confidence = AAZStrType() + _element.content = AAZStrType() + _element.link = AAZStrType() + _element.rank = AAZIntType() + _element.result_type = AAZStrType( + serialized_name="resultType", + ) + _element.solution_id = AAZStrType( + serialized_name="solutionId", + ) + _element.source = AAZStrType() + _element.title = AAZStrType() + + _schema.diagnostics = cls._schema_replacement_maps_read.diagnostics + _schema.metrics_based_charts = cls._schema_replacement_maps_read.metrics_based_charts + _schema.troubleshooters = cls._schema_replacement_maps_read.troubleshooters + _schema.video_groups = cls._schema_replacement_maps_read.video_groups + _schema.videos = cls._schema_replacement_maps_read.videos + _schema.web_results = cls._schema_replacement_maps_read.web_results + + +__all__ = ["Show"] diff --git a/src/self-help/azext_self_help/aaz/latest/self_help/solution/_update.py b/src/self-help/azext_self_help/aaz/latest/self_help/solution/_update.py new file mode 100644 index 00000000000..04f03f49de8 --- /dev/null +++ b/src/self-help/azext_self_help/aaz/latest/self_help/solution/_update.py @@ -0,0 +1,1146 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "self-help solution update", + is_preview=True, +) +class Update(AAZCommand): + """Update a solution for the specific Azure resource or subscription using the triggering criteria from discovery solutions. + + :example: Update Solution at Resource Level + az self-help solution update --solution-name solution-name --trigger-criteria [{name:ReplacementKey,value:}] --parameters {SearchText:CanNotRDP,SymptomId:KeyVaultVaultNotFoundInsight} --scope 'subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read' + """ + + _aaz_info = { + "version": "2023-09-01-preview", + "resources": [ + ["mgmt-plane", "/{scope}/providers/microsoft.help/solutions/{}", "2023-09-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.scope = AAZStrArg( + options=["--scope"], + help="This is an extension resource provider and only resource level extension is supported at the moment.", + required=True, + ) + _args_schema.solution_name = AAZStrArg( + options=["--solution-name"], + help="Solution resource Name.", + required=True, + fmt=AAZStrArgFormat( + pattern="^[A-Za-z0-9-+@()_]+$", + max_length=100, + min_length=1, + ), + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.content = AAZStrArg( + options=["--content"], + arg_group="Properties", + help="The HTML content that needs to be rendered and shown to customer.", + nullable=True, + ) + _args_schema.parameters = AAZDictArg( + options=["--parameters"], + arg_group="Properties", + help="Client input parameters to run Solution", + nullable=True, + ) + _args_schema.provisioning_state = AAZStrArg( + options=["--provisioning-state"], + arg_group="Properties", + help="Status of solution provisioning.", + nullable=True, + enum={"Canceled": "Canceled", "Failed": "Failed", "Succeeded": "Succeeded"}, + ) + _args_schema.replacement_maps = AAZObjectArg( + options=["--replacement-maps"], + arg_group="Properties", + help="Solution replacement maps.", + nullable=True, + ) + cls._build_args_replacement_maps_update(_args_schema.replacement_maps) + _args_schema.sections = AAZListArg( + options=["--sections"], + arg_group="Properties", + help="List of section object.", + nullable=True, + ) + _args_schema.solution_id = AAZStrArg( + options=["--solution-id"], + arg_group="Properties", + help="Solution Id to identify single solution.", + nullable=True, + ) + _args_schema.title = AAZStrArg( + options=["--title"], + arg_group="Properties", + help="The title.", + nullable=True, + ) + _args_schema.trigger_criteria = AAZListArg( + options=["--trigger-criteria"], + arg_group="Properties", + help="Solution request trigger criteria", + nullable=True, + ) + + parameters = cls._args_schema.parameters + parameters.Element = AAZStrArg( + nullable=True, + ) + + sections = cls._args_schema.sections + sections.Element = AAZObjectArg( + nullable=True, + ) + + _element = cls._args_schema.sections.Element + _element.content = AAZStrArg( + options=["content"], + help="Solution sections content.", + nullable=True, + ) + _element.replacement_maps = AAZObjectArg( + options=["replacement-maps"], + nullable=True, + ) + cls._build_args_replacement_maps_update(_element.replacement_maps) + _element.title = AAZStrArg( + options=["title"], + help="Solution sections title.", + nullable=True, + ) + + trigger_criteria = cls._args_schema.trigger_criteria + trigger_criteria.Element = AAZObjectArg( + nullable=True, + ) + + _element = cls._args_schema.trigger_criteria.Element + _element.name = AAZStrArg( + options=["name"], + help="Trigger criterion name.", + nullable=True, + enum={"ProblemClassificationId": "ProblemClassificationId", "ReplacementKey": "ReplacementKey", "SolutionId": "SolutionId"}, + ) + _element.value = AAZStrArg( + options=["value"], + help="Trigger criterion value.", + nullable=True, + ) + return cls._args_schema + + _args_replacement_maps_update = None + + @classmethod + def _build_args_replacement_maps_update(cls, _schema): + if cls._args_replacement_maps_update is not None: + _schema.diagnostics = cls._args_replacement_maps_update.diagnostics + _schema.metrics_based_charts = cls._args_replacement_maps_update.metrics_based_charts + _schema.troubleshooters = cls._args_replacement_maps_update.troubleshooters + _schema.video_groups = cls._args_replacement_maps_update.video_groups + _schema.videos = cls._args_replacement_maps_update.videos + _schema.web_results = cls._args_replacement_maps_update.web_results + return + + cls._args_replacement_maps_update = AAZObjectArg( + nullable=True, + ) + + replacement_maps_update = cls._args_replacement_maps_update + replacement_maps_update.diagnostics = AAZListArg( + options=["diagnostics"], + help="Solution diagnostics results.", + nullable=True, + ) + replacement_maps_update.metrics_based_charts = AAZListArg( + options=["metrics-based-charts"], + help="Solution metrics based charts", + nullable=True, + ) + replacement_maps_update.troubleshooters = AAZListArg( + options=["troubleshooters"], + help="Solutions Troubleshooters", + nullable=True, + ) + replacement_maps_update.video_groups = AAZListArg( + options=["video-groups"], + help="Group of Videos", + nullable=True, + ) + replacement_maps_update.videos = AAZListArg( + options=["videos"], + help="Video solutions, which have the power to engage the customer by stimulating their senses", + nullable=True, + ) + replacement_maps_update.web_results = AAZListArg( + options=["web-results"], + help="Solution AzureKB results", + nullable=True, + ) + + diagnostics = cls._args_replacement_maps_update.diagnostics + diagnostics.Element = AAZObjectArg( + nullable=True, + ) + + _element = cls._args_replacement_maps_update.diagnostics.Element + _element.insights = AAZListArg( + options=["insights"], + help="Diagnostic insights", + nullable=True, + ) + _element.replacement_key = AAZStrArg( + options=["replacement-key"], + help="Place holder used in HTML Content replace control with the content", + nullable=True, + ) + _element.required_parameters = AAZListArg( + options=["required-parameters"], + help="Required parameters of this item", + nullable=True, + ) + _element.solution_id = AAZStrArg( + options=["solution-id"], + help="Solution Id to identify single Solutions Diagnostic", + nullable=True, + ) + _element.status = AAZStrArg( + options=["status"], + help="The status of the resource.", + nullable=True, + enum={"Failed": "Failed", "MissingInputs": "MissingInputs", "Running": "Running", "Succeeded": "Succeeded", "Timeout": "Timeout"}, + ) + _element.status_details = AAZStrArg( + options=["status-details"], + help="Details of the status", + nullable=True, + ) + + insights = cls._args_replacement_maps_update.diagnostics.Element.insights + insights.Element = AAZObjectArg( + nullable=True, + ) + + _element = cls._args_replacement_maps_update.diagnostics.Element.insights.Element + _element.id = AAZStrArg( + options=["id"], + help="Article id.", + nullable=True, + ) + _element.importance_level = AAZStrArg( + options=["importance-level"], + help="Importance level of the insight.", + nullable=True, + enum={"Critical": "Critical", "Information": "Information", "Warning": "Warning"}, + ) + _element.results = AAZStrArg( + options=["results"], + help="Detailed result content.", + nullable=True, + ) + _element.title = AAZStrArg( + options=["title"], + help="This insight's title.", + nullable=True, + ) + + required_parameters = cls._args_replacement_maps_update.diagnostics.Element.required_parameters + required_parameters.Element = AAZStrArg( + nullable=True, + ) + + metrics_based_charts = cls._args_replacement_maps_update.metrics_based_charts + metrics_based_charts.Element = AAZObjectArg( + nullable=True, + ) + + _element = cls._args_replacement_maps_update.metrics_based_charts.Element + _element.aggregation_type = AAZStrArg( + options=["aggregation-type"], + help="Allowed values are Sum, Avg, Count, Min, Max. Default is Sum", + nullable=True, + enum={"Avg": "Avg", "Count": "Count", "Max": "Max", "Min": "Min", "Sum": "Sum"}, + ) + _element.filter_group = AAZObjectArg( + options=["filter-group"], + help="Filter group", + nullable=True, + ) + _element.name = AAZStrArg( + options=["name"], + help="Chart name", + nullable=True, + ) + _element.replacement_key = AAZStrArg( + options=["replacement-key"], + help="Place holder used in HTML Content replace control with the content", + nullable=True, + ) + _element.time_span_duration = AAZStrArg( + options=["time-span-duration"], + help="Time span duration", + nullable=True, + ) + _element.title = AAZStrArg( + options=["title"], + help="Chart title", + nullable=True, + ) + + filter_group = cls._args_replacement_maps_update.metrics_based_charts.Element.filter_group + filter_group.filter = AAZListArg( + options=["filter"], + help="List of filters", + nullable=True, + ) + + filter = cls._args_replacement_maps_update.metrics_based_charts.Element.filter_group.filter + filter.Element = AAZObjectArg( + nullable=True, + ) + + _element = cls._args_replacement_maps_update.metrics_based_charts.Element.filter_group.filter.Element + _element.name = AAZStrArg( + options=["name"], + help="Filter name", + nullable=True, + ) + _element.operator = AAZStrArg( + options=["operator"], + help="Filter operator", + nullable=True, + ) + _element.values = AAZStrArg( + options=["values"], + help="Filter values", + nullable=True, + ) + + troubleshooters = cls._args_replacement_maps_update.troubleshooters + troubleshooters.Element = AAZObjectArg( + nullable=True, + ) + + _element = cls._args_replacement_maps_update.troubleshooters.Element + _element.solution_id = AAZStrArg( + options=["solution-id"], + help="Solution Id to identify single Solutions Troubleshooter", + nullable=True, + ) + _element.summary = AAZStrArg( + options=["summary"], + help="Troubleshooter summary", + nullable=True, + ) + _element.title = AAZStrArg( + options=["title"], + help="Troubleshooter title", + nullable=True, + ) + + video_groups = cls._args_replacement_maps_update.video_groups + video_groups.Element = AAZObjectArg( + nullable=True, + ) + + _element = cls._args_replacement_maps_update.video_groups.Element + _element.replacement_key = AAZStrArg( + options=["replacement-key"], + help="Place holder used in HTML Content replace control with the insight content", + nullable=True, + ) + _element.videos = AAZListArg( + options=["videos"], + help="List of videos will be shown to customers", + nullable=True, + ) + + videos = cls._args_replacement_maps_update.video_groups.Element.videos + videos.Element = AAZObjectArg( + nullable=True, + ) + + _element = cls._args_replacement_maps_update.video_groups.Element.videos.Element + _element.src = AAZStrArg( + options=["src"], + help="Link to the video", + nullable=True, + ) + _element.title = AAZStrArg( + options=["title"], + help="Title of the video", + nullable=True, + ) + + videos = cls._args_replacement_maps_update.videos + videos.Element = AAZObjectArg( + nullable=True, + ) + + _element = cls._args_replacement_maps_update.videos.Element + _element.replacement_key = AAZStrArg( + options=["replacement-key"], + help="Place holder used in HTML Content replace control with the insight content", + nullable=True, + ) + _element.src = AAZStrArg( + options=["src"], + help="Link to the video", + nullable=True, + ) + _element.title = AAZStrArg( + options=["title"], + help="Title of the video", + nullable=True, + ) + + web_results = cls._args_replacement_maps_update.web_results + web_results.Element = AAZObjectArg( + nullable=True, + ) + + _element = cls._args_replacement_maps_update.web_results.Element + _element.replacement_key = AAZStrArg( + options=["replacement-key"], + help="Place holder used in HTML Content replace control with the content", + nullable=True, + ) + _element.search_results = AAZListArg( + options=["search-results"], + help="AzureKB search results", + nullable=True, + ) + + search_results = cls._args_replacement_maps_update.web_results.Element.search_results + search_results.Element = AAZObjectArg( + nullable=True, + ) + + _element = cls._args_replacement_maps_update.web_results.Element.search_results.Element + _element.confidence = AAZStrArg( + options=["confidence"], + help="Confidence of the search result.", + nullable=True, + enum={"High": "High", "Low": "Low", "Medium": "Medium"}, + ) + _element.content = AAZStrArg( + options=["content"], + help="Content of the search result.", + nullable=True, + ) + _element.link = AAZStrArg( + options=["link"], + help="Link to the document.", + nullable=True, + ) + _element.rank = AAZIntArg( + options=["rank"], + help="rank of the search result", + nullable=True, + ) + _element.result_type = AAZStrArg( + options=["result-type"], + help="Result type of the search result.", + nullable=True, + enum={"Community": "Community", "Documentation": "Documentation"}, + ) + _element.solution_id = AAZStrArg( + options=["solution-id"], + help="Unique id of the result.", + nullable=True, + ) + _element.source = AAZStrArg( + options=["source"], + help="Source of the search result.", + nullable=True, + ) + _element.title = AAZStrArg( + options=["title"], + help="Title of the search result.", + nullable=True, + ) + + _schema.diagnostics = cls._args_replacement_maps_update.diagnostics + _schema.metrics_based_charts = cls._args_replacement_maps_update.metrics_based_charts + _schema.troubleshooters = cls._args_replacement_maps_update.troubleshooters + _schema.video_groups = cls._args_replacement_maps_update.video_groups + _schema.videos = cls._args_replacement_maps_update.videos + _schema.web_results = cls._args_replacement_maps_update.web_results + + def _execute_operations(self): + self.pre_operations() + self.SolutionGet(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.SolutionUpdate(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 SolutionGet(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( + "/{scope}/providers/Microsoft.Help/solutions/{solutionResourceName}", + **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( + "scope", self.ctx.args.scope, + skip_quote=True, + required=True, + ), + **self.serialize_url_param( + "solutionResourceName", self.ctx.args.solution_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2023-09-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_solution_resource_read(cls._schema_on_200) + + return cls._schema_on_200 + + class SolutionUpdate(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( + "/{scope}/providers/Microsoft.Help/solutions/{solutionResourceName}", + **self.url_parameters + ) + + @property + def method(self): + return "PATCH" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "scope", self.ctx.args.scope, + skip_quote=True, + required=True, + ), + **self.serialize_url_param( + "solutionResourceName", self.ctx.args.solution_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2023-09-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_solution_resource_read(cls._schema_on_200_201) + + return cls._schema_on_200_201 + + class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance(self.ctx.vars.instance) + + def _update_instance(self, instance): + _instance_value, _builder = self.new_content_builder( + self.ctx.args, + value=instance, + typ=AAZObjectType + ) + _builder.set_prop("properties", AAZObjectType) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("content", AAZStrType, ".content") + properties.set_prop("parameters", AAZDictType, ".parameters") + properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") + _UpdateHelper._build_schema_replacement_maps_update(properties.set_prop("replacementMaps", AAZObjectType, ".replacement_maps")) + properties.set_prop("sections", AAZListType, ".sections") + properties.set_prop("solutionId", AAZStrType, ".solution_id") + properties.set_prop("title", AAZStrType, ".title") + properties.set_prop("triggerCriteria", AAZListType, ".trigger_criteria") + + parameters = _builder.get(".properties.parameters") + if parameters is not None: + parameters.set_elements(AAZStrType, ".") + + sections = _builder.get(".properties.sections") + if sections is not None: + sections.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.sections[]") + if _elements is not None: + _elements.set_prop("content", AAZStrType, ".content") + _UpdateHelper._build_schema_replacement_maps_update(_elements.set_prop("replacementMaps", AAZObjectType, ".replacement_maps")) + _elements.set_prop("title", AAZStrType, ".title") + + trigger_criteria = _builder.get(".properties.triggerCriteria") + if trigger_criteria is not None: + trigger_criteria.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.triggerCriteria[]") + if _elements is not None: + _elements.set_prop("name", AAZStrType, ".name") + _elements.set_prop("value", AAZStrType, ".value") + + 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""" + + @classmethod + def _build_schema_replacement_maps_update(cls, _builder): + if _builder is None: + return + _builder.set_prop("diagnostics", AAZListType, ".diagnostics") + _builder.set_prop("metricsBasedCharts", AAZListType, ".metrics_based_charts") + _builder.set_prop("troubleshooters", AAZListType, ".troubleshooters") + _builder.set_prop("videoGroups", AAZListType, ".video_groups") + _builder.set_prop("videos", AAZListType, ".videos") + _builder.set_prop("webResults", AAZListType, ".web_results") + + diagnostics = _builder.get(".diagnostics") + if diagnostics is not None: + diagnostics.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".diagnostics[]") + if _elements is not None: + _elements.set_prop("insights", AAZListType, ".insights") + _elements.set_prop("replacementKey", AAZStrType, ".replacement_key") + _elements.set_prop("requiredParameters", AAZListType, ".required_parameters") + _elements.set_prop("solutionId", AAZStrType, ".solution_id") + _elements.set_prop("status", AAZStrType, ".status") + _elements.set_prop("statusDetails", AAZStrType, ".status_details") + + insights = _builder.get(".diagnostics[].insights") + if insights is not None: + insights.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".diagnostics[].insights[]") + if _elements is not None: + _elements.set_prop("id", AAZStrType, ".id") + _elements.set_prop("importanceLevel", AAZStrType, ".importance_level") + _elements.set_prop("results", AAZStrType, ".results") + _elements.set_prop("title", AAZStrType, ".title") + + required_parameters = _builder.get(".diagnostics[].requiredParameters") + if required_parameters is not None: + required_parameters.set_elements(AAZStrType, ".") + + metrics_based_charts = _builder.get(".metricsBasedCharts") + if metrics_based_charts is not None: + metrics_based_charts.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".metricsBasedCharts[]") + if _elements is not None: + _elements.set_prop("aggregationType", AAZStrType, ".aggregation_type") + _elements.set_prop("filterGroup", AAZObjectType, ".filter_group") + _elements.set_prop("name", AAZStrType, ".name") + _elements.set_prop("replacementKey", AAZStrType, ".replacement_key") + _elements.set_prop("timeSpanDuration", AAZStrType, ".time_span_duration") + _elements.set_prop("title", AAZStrType, ".title") + + filter_group = _builder.get(".metricsBasedCharts[].filterGroup") + if filter_group is not None: + filter_group.set_prop("filter", AAZListType, ".filter") + + filter = _builder.get(".metricsBasedCharts[].filterGroup.filter") + if filter is not None: + filter.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".metricsBasedCharts[].filterGroup.filter[]") + if _elements is not None: + _elements.set_prop("name", AAZStrType, ".name") + _elements.set_prop("operator", AAZStrType, ".operator") + _elements.set_prop("values", AAZStrType, ".values") + + troubleshooters = _builder.get(".troubleshooters") + if troubleshooters is not None: + troubleshooters.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".troubleshooters[]") + if _elements is not None: + _elements.set_prop("solutionId", AAZStrType, ".solution_id") + _elements.set_prop("summary", AAZStrType, ".summary") + _elements.set_prop("title", AAZStrType, ".title") + + video_groups = _builder.get(".videoGroups") + if video_groups is not None: + video_groups.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".videoGroups[]") + if _elements is not None: + _elements.set_prop("replacementKey", AAZStrType, ".replacement_key") + _elements.set_prop("videos", AAZListType, ".videos") + + videos = _builder.get(".videoGroups[].videos") + if videos is not None: + videos.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".videoGroups[].videos[]") + if _elements is not None: + _elements.set_prop("src", AAZStrType, ".src") + _elements.set_prop("title", AAZStrType, ".title") + + videos = _builder.get(".videos") + if videos is not None: + videos.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".videos[]") + if _elements is not None: + _elements.set_prop("replacementKey", AAZStrType, ".replacement_key") + _elements.set_prop("src", AAZStrType, ".src") + _elements.set_prop("title", AAZStrType, ".title") + + web_results = _builder.get(".webResults") + if web_results is not None: + web_results.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".webResults[]") + if _elements is not None: + _elements.set_prop("replacementKey", AAZStrType, ".replacement_key") + _elements.set_prop("searchResults", AAZListType, ".search_results") + + search_results = _builder.get(".webResults[].searchResults") + if search_results is not None: + search_results.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".webResults[].searchResults[]") + if _elements is not None: + _elements.set_prop("confidence", AAZStrType, ".confidence") + _elements.set_prop("content", AAZStrType, ".content") + _elements.set_prop("link", AAZStrType, ".link") + _elements.set_prop("rank", AAZIntType, ".rank") + _elements.set_prop("resultType", AAZStrType, ".result_type") + _elements.set_prop("solutionId", AAZStrType, ".solution_id") + _elements.set_prop("source", AAZStrType, ".source") + _elements.set_prop("title", AAZStrType, ".title") + + _schema_replacement_maps_read = None + + @classmethod + def _build_schema_replacement_maps_read(cls, _schema): + if cls._schema_replacement_maps_read is not None: + _schema.diagnostics = cls._schema_replacement_maps_read.diagnostics + _schema.metrics_based_charts = cls._schema_replacement_maps_read.metrics_based_charts + _schema.troubleshooters = cls._schema_replacement_maps_read.troubleshooters + _schema.video_groups = cls._schema_replacement_maps_read.video_groups + _schema.videos = cls._schema_replacement_maps_read.videos + _schema.web_results = cls._schema_replacement_maps_read.web_results + return + + cls._schema_replacement_maps_read = _schema_replacement_maps_read = AAZObjectType() + + replacement_maps_read = _schema_replacement_maps_read + replacement_maps_read.diagnostics = AAZListType() + replacement_maps_read.metrics_based_charts = AAZListType( + serialized_name="metricsBasedCharts", + ) + replacement_maps_read.troubleshooters = AAZListType() + replacement_maps_read.video_groups = AAZListType( + serialized_name="videoGroups", + ) + replacement_maps_read.videos = AAZListType() + replacement_maps_read.web_results = AAZListType( + serialized_name="webResults", + ) + + diagnostics = _schema_replacement_maps_read.diagnostics + diagnostics.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.diagnostics.Element + _element.insights = AAZListType() + _element.replacement_key = AAZStrType( + serialized_name="replacementKey", + ) + _element.required_parameters = AAZListType( + serialized_name="requiredParameters", + ) + _element.solution_id = AAZStrType( + serialized_name="solutionId", + ) + _element.status = AAZStrType() + _element.status_details = AAZStrType( + serialized_name="statusDetails", + ) + + insights = _schema_replacement_maps_read.diagnostics.Element.insights + insights.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.diagnostics.Element.insights.Element + _element.id = AAZStrType() + _element.importance_level = AAZStrType( + serialized_name="importanceLevel", + ) + _element.results = AAZStrType() + _element.title = AAZStrType() + + required_parameters = _schema_replacement_maps_read.diagnostics.Element.required_parameters + required_parameters.Element = AAZStrType() + + metrics_based_charts = _schema_replacement_maps_read.metrics_based_charts + metrics_based_charts.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.metrics_based_charts.Element + _element.aggregation_type = AAZStrType( + serialized_name="aggregationType", + ) + _element.filter_group = AAZObjectType( + serialized_name="filterGroup", + ) + _element.name = AAZStrType() + _element.replacement_key = AAZStrType( + serialized_name="replacementKey", + ) + _element.time_span_duration = AAZStrType( + serialized_name="timeSpanDuration", + ) + _element.title = AAZStrType() + + filter_group = _schema_replacement_maps_read.metrics_based_charts.Element.filter_group + filter_group.filter = AAZListType() + + filter = _schema_replacement_maps_read.metrics_based_charts.Element.filter_group.filter + filter.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.metrics_based_charts.Element.filter_group.filter.Element + _element.name = AAZStrType() + _element.operator = AAZStrType() + _element.values = AAZStrType() + + troubleshooters = _schema_replacement_maps_read.troubleshooters + troubleshooters.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.troubleshooters.Element + _element.solution_id = AAZStrType( + serialized_name="solutionId", + ) + _element.summary = AAZStrType() + _element.title = AAZStrType() + + video_groups = _schema_replacement_maps_read.video_groups + video_groups.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.video_groups.Element + _element.replacement_key = AAZStrType( + serialized_name="replacementKey", + ) + _element.videos = AAZListType() + + videos = _schema_replacement_maps_read.video_groups.Element.videos + videos.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.video_groups.Element.videos.Element + _element.src = AAZStrType() + _element.title = AAZStrType() + + videos = _schema_replacement_maps_read.videos + videos.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.videos.Element + _element.replacement_key = AAZStrType( + serialized_name="replacementKey", + ) + _element.src = AAZStrType() + _element.title = AAZStrType() + + web_results = _schema_replacement_maps_read.web_results + web_results.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.web_results.Element + _element.replacement_key = AAZStrType( + serialized_name="replacementKey", + ) + _element.search_results = AAZListType( + serialized_name="searchResults", + ) + + search_results = _schema_replacement_maps_read.web_results.Element.search_results + search_results.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.web_results.Element.search_results.Element + _element.confidence = AAZStrType() + _element.content = AAZStrType() + _element.link = AAZStrType() + _element.rank = AAZIntType() + _element.result_type = AAZStrType( + serialized_name="resultType", + ) + _element.solution_id = AAZStrType( + serialized_name="solutionId", + ) + _element.source = AAZStrType() + _element.title = AAZStrType() + + _schema.diagnostics = cls._schema_replacement_maps_read.diagnostics + _schema.metrics_based_charts = cls._schema_replacement_maps_read.metrics_based_charts + _schema.troubleshooters = cls._schema_replacement_maps_read.troubleshooters + _schema.video_groups = cls._schema_replacement_maps_read.video_groups + _schema.videos = cls._schema_replacement_maps_read.videos + _schema.web_results = cls._schema_replacement_maps_read.web_results + + _schema_solution_resource_read = None + + @classmethod + def _build_schema_solution_resource_read(cls, _schema): + if cls._schema_solution_resource_read is not None: + _schema.id = cls._schema_solution_resource_read.id + _schema.name = cls._schema_solution_resource_read.name + _schema.properties = cls._schema_solution_resource_read.properties + _schema.type = cls._schema_solution_resource_read.type + return + + cls._schema_solution_resource_read = _schema_solution_resource_read = AAZObjectType() + + solution_resource_read = _schema_solution_resource_read + solution_resource_read.id = AAZStrType( + flags={"read_only": True}, + ) + solution_resource_read.name = AAZStrType( + flags={"read_only": True}, + ) + solution_resource_read.properties = AAZObjectType() + solution_resource_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_solution_resource_read.properties + properties.content = AAZStrType() + properties.parameters = AAZDictType() + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + ) + properties.replacement_maps = AAZObjectType( + serialized_name="replacementMaps", + ) + cls._build_schema_replacement_maps_read(properties.replacement_maps) + properties.sections = AAZListType() + properties.solution_id = AAZStrType( + serialized_name="solutionId", + ) + properties.title = AAZStrType() + properties.trigger_criteria = AAZListType( + serialized_name="triggerCriteria", + ) + + parameters = _schema_solution_resource_read.properties.parameters + parameters.Element = AAZStrType() + + sections = _schema_solution_resource_read.properties.sections + sections.Element = AAZObjectType() + + _element = _schema_solution_resource_read.properties.sections.Element + _element.content = AAZStrType() + _element.replacement_maps = AAZObjectType( + serialized_name="replacementMaps", + ) + cls._build_schema_replacement_maps_read(_element.replacement_maps) + _element.title = AAZStrType() + + trigger_criteria = _schema_solution_resource_read.properties.trigger_criteria + trigger_criteria.Element = AAZObjectType() + + _element = _schema_solution_resource_read.properties.trigger_criteria.Element + _element.name = AAZStrType() + _element.value = AAZStrType() + + _schema.id = cls._schema_solution_resource_read.id + _schema.name = cls._schema_solution_resource_read.name + _schema.properties = cls._schema_solution_resource_read.properties + _schema.type = cls._schema_solution_resource_read.type + + +__all__ = ["Update"] diff --git a/src/self-help/azext_self_help/aaz/latest/self_help/solution/_wait.py b/src/self-help/azext_self_help/aaz/latest/self_help/solution/_wait.py new file mode 100644 index 00000000000..ad6f22e040c --- /dev/null +++ b/src/self-help/azext_self_help/aaz/latest/self_help/solution/_wait.py @@ -0,0 +1,376 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "self-help solution wait", +) +class Wait(AAZWaitCommand): + """Place the CLI in a waiting state until a condition is met. + """ + + _aaz_info = { + "resources": [ + ["mgmt-plane", "/{scope}/providers/microsoft.help/solutions/{}", "2023-09-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.scope = AAZStrArg( + options=["--scope"], + help="This is an extension resource provider and only resource level extension is supported at the moment.", + required=True, + ) + _args_schema.solution_name = AAZStrArg( + options=["--solution-name"], + help="Solution resource Name.", + required=True, + fmt=AAZStrArgFormat( + pattern="^[A-Za-z0-9-+@()_]+$", + max_length=100, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.SolutionGet(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 SolutionGet(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( + "/{scope}/providers/Microsoft.Help/solutions/{solutionResourceName}", + **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( + "scope", self.ctx.args.scope, + skip_quote=True, + required=True, + ), + **self.serialize_url_param( + "solutionResourceName", self.ctx.args.solution_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2023-09-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.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.content = AAZStrType() + properties.parameters = AAZDictType() + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + ) + properties.replacement_maps = AAZObjectType( + serialized_name="replacementMaps", + ) + _WaitHelper._build_schema_replacement_maps_read(properties.replacement_maps) + properties.sections = AAZListType() + properties.solution_id = AAZStrType( + serialized_name="solutionId", + ) + properties.title = AAZStrType() + properties.trigger_criteria = AAZListType( + serialized_name="triggerCriteria", + ) + + parameters = cls._schema_on_200.properties.parameters + parameters.Element = AAZStrType() + + sections = cls._schema_on_200.properties.sections + sections.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.sections.Element + _element.content = AAZStrType() + _element.replacement_maps = AAZObjectType( + serialized_name="replacementMaps", + ) + _WaitHelper._build_schema_replacement_maps_read(_element.replacement_maps) + _element.title = AAZStrType() + + trigger_criteria = cls._schema_on_200.properties.trigger_criteria + trigger_criteria.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.trigger_criteria.Element + _element.name = AAZStrType() + _element.value = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + _schema_replacement_maps_read = None + + @classmethod + def _build_schema_replacement_maps_read(cls, _schema): + if cls._schema_replacement_maps_read is not None: + _schema.diagnostics = cls._schema_replacement_maps_read.diagnostics + _schema.metrics_based_charts = cls._schema_replacement_maps_read.metrics_based_charts + _schema.troubleshooters = cls._schema_replacement_maps_read.troubleshooters + _schema.video_groups = cls._schema_replacement_maps_read.video_groups + _schema.videos = cls._schema_replacement_maps_read.videos + _schema.web_results = cls._schema_replacement_maps_read.web_results + return + + cls._schema_replacement_maps_read = _schema_replacement_maps_read = AAZObjectType() + + replacement_maps_read = _schema_replacement_maps_read + replacement_maps_read.diagnostics = AAZListType() + replacement_maps_read.metrics_based_charts = AAZListType( + serialized_name="metricsBasedCharts", + ) + replacement_maps_read.troubleshooters = AAZListType() + replacement_maps_read.video_groups = AAZListType( + serialized_name="videoGroups", + ) + replacement_maps_read.videos = AAZListType() + replacement_maps_read.web_results = AAZListType( + serialized_name="webResults", + ) + + diagnostics = _schema_replacement_maps_read.diagnostics + diagnostics.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.diagnostics.Element + _element.insights = AAZListType() + _element.replacement_key = AAZStrType( + serialized_name="replacementKey", + ) + _element.required_parameters = AAZListType( + serialized_name="requiredParameters", + ) + _element.solution_id = AAZStrType( + serialized_name="solutionId", + ) + _element.status = AAZStrType() + _element.status_details = AAZStrType( + serialized_name="statusDetails", + ) + + insights = _schema_replacement_maps_read.diagnostics.Element.insights + insights.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.diagnostics.Element.insights.Element + _element.id = AAZStrType() + _element.importance_level = AAZStrType( + serialized_name="importanceLevel", + ) + _element.results = AAZStrType() + _element.title = AAZStrType() + + required_parameters = _schema_replacement_maps_read.diagnostics.Element.required_parameters + required_parameters.Element = AAZStrType() + + metrics_based_charts = _schema_replacement_maps_read.metrics_based_charts + metrics_based_charts.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.metrics_based_charts.Element + _element.aggregation_type = AAZStrType( + serialized_name="aggregationType", + ) + _element.filter_group = AAZObjectType( + serialized_name="filterGroup", + ) + _element.name = AAZStrType() + _element.replacement_key = AAZStrType( + serialized_name="replacementKey", + ) + _element.time_span_duration = AAZStrType( + serialized_name="timeSpanDuration", + ) + _element.title = AAZStrType() + + filter_group = _schema_replacement_maps_read.metrics_based_charts.Element.filter_group + filter_group.filter = AAZListType() + + filter = _schema_replacement_maps_read.metrics_based_charts.Element.filter_group.filter + filter.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.metrics_based_charts.Element.filter_group.filter.Element + _element.name = AAZStrType() + _element.operator = AAZStrType() + _element.values = AAZStrType() + + troubleshooters = _schema_replacement_maps_read.troubleshooters + troubleshooters.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.troubleshooters.Element + _element.solution_id = AAZStrType( + serialized_name="solutionId", + ) + _element.summary = AAZStrType() + _element.title = AAZStrType() + + video_groups = _schema_replacement_maps_read.video_groups + video_groups.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.video_groups.Element + _element.replacement_key = AAZStrType( + serialized_name="replacementKey", + ) + _element.videos = AAZListType() + + videos = _schema_replacement_maps_read.video_groups.Element.videos + videos.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.video_groups.Element.videos.Element + _element.src = AAZStrType() + _element.title = AAZStrType() + + videos = _schema_replacement_maps_read.videos + videos.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.videos.Element + _element.replacement_key = AAZStrType( + serialized_name="replacementKey", + ) + _element.src = AAZStrType() + _element.title = AAZStrType() + + web_results = _schema_replacement_maps_read.web_results + web_results.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.web_results.Element + _element.replacement_key = AAZStrType( + serialized_name="replacementKey", + ) + _element.search_results = AAZListType( + serialized_name="searchResults", + ) + + search_results = _schema_replacement_maps_read.web_results.Element.search_results + search_results.Element = AAZObjectType() + + _element = _schema_replacement_maps_read.web_results.Element.search_results.Element + _element.confidence = AAZStrType() + _element.content = AAZStrType() + _element.link = AAZStrType() + _element.rank = AAZIntType() + _element.result_type = AAZStrType( + serialized_name="resultType", + ) + _element.solution_id = AAZStrType( + serialized_name="solutionId", + ) + _element.source = AAZStrType() + _element.title = AAZStrType() + + _schema.diagnostics = cls._schema_replacement_maps_read.diagnostics + _schema.metrics_based_charts = cls._schema_replacement_maps_read.metrics_based_charts + _schema.troubleshooters = cls._schema_replacement_maps_read.troubleshooters + _schema.video_groups = cls._schema_replacement_maps_read.video_groups + _schema.videos = cls._schema_replacement_maps_read.videos + _schema.web_results = cls._schema_replacement_maps_read.web_results + + +__all__ = ["Wait"] diff --git a/src/self-help/azext_self_help/aaz/latest/self_help/troubleshooter/__cmd_group.py b/src/self-help/azext_self_help/aaz/latest/self_help/troubleshooter/__cmd_group.py new file mode 100644 index 00000000000..2debd960ad9 --- /dev/null +++ b/src/self-help/azext_self_help/aaz/latest/self_help/troubleshooter/__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( + "self-help troubleshooter", + is_preview=True, +) +class __CMDGroup(AAZCommandGroup): + """troubleshooter command will help you create troubleshooters for azure resources. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/self-help/azext_self_help/aaz/latest/self_help/troubleshooter/__init__.py b/src/self-help/azext_self_help/aaz/latest/self_help/troubleshooter/__init__.py new file mode 100644 index 00000000000..79df33032a0 --- /dev/null +++ b/src/self-help/azext_self_help/aaz/latest/self_help/troubleshooter/__init__.py @@ -0,0 +1,16 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._continue import * +from ._create import * +from ._end import * +from ._restart import * +from ._show import * diff --git a/src/self-help/azext_self_help/aaz/latest/self_help/troubleshooter/_continue.py b/src/self-help/azext_self_help/aaz/latest/self_help/troubleshooter/_continue.py new file mode 100644 index 00000000000..c1a72dd812f --- /dev/null +++ b/src/self-help/azext_self_help/aaz/latest/self_help/troubleshooter/_continue.py @@ -0,0 +1,199 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "self-help troubleshooter continue", + is_preview=True, +) +class Continue(AAZCommand): + """Uses stepId and responses as the trigger to continue the troubleshooting steps for the respective troubleshooter resource name. + + :example: Continue Troubleshooter at Resource Level + az self-help troubleshooter continue --troubleshooter-name 12345678-BBBb-cCCCC-0000-123456789012 --step-id step-id --responses [] --scope 'subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read' + """ + + _aaz_info = { + "version": "2023-09-01-preview", + "resources": [ + ["mgmt-plane", "/{scope}/providers/microsoft.help/troubleshooters/{}/continue", "2023-09-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return 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.scope = AAZStrArg( + options=["--scope"], + help="This is an extension resource provider and only resource level extension is supported at the moment.", + required=True, + ) + _args_schema.troubleshooter_name = AAZStrArg( + options=["--troubleshooter-name"], + help="Troubleshooter resource Name.", + required=True, + fmt=AAZStrArgFormat( + pattern="([A-Za-z0-9]+(-[A-Za-z0-9]+)+)", + max_length=100, + min_length=1, + ), + ) + + # define Arg Group "ContinueRequestBody" + + _args_schema = cls._args_schema + _args_schema.responses = AAZListArg( + options=["--responses"], + arg_group="ContinueRequestBody", + ) + _args_schema.step_id = AAZStrArg( + options=["--step-id"], + arg_group="ContinueRequestBody", + help="Unique id of the result.", + ) + + responses = cls._args_schema.responses + responses.Element = AAZObjectArg() + + _element = cls._args_schema.responses.Element + _element.question_id = AAZStrArg( + options=["question-id"], + help="id of the question.", + ) + _element.question_type = AAZStrArg( + options=["question-type"], + help="Text Input. Will be a single line input.", + enum={"Dropdown": "Dropdown", "MultiLineInfoBox": "MultiLineInfoBox", "RadioButton": "RadioButton", "TextInput": "TextInput"}, + ) + _element.response = AAZStrArg( + options=["response"], + help="Response key for SingleInput. For Multi-line test/open ended question it is free form text", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.TroubleshootersContinue(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class TroubleshootersContinue(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 [204]: + return self.on_204(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName}/continue", + **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( + "scope", self.ctx.args.scope, + skip_quote=True, + required=True, + ), + **self.serialize_url_param( + "troubleshooterName", self.ctx.args.troubleshooter_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2023-09-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"client_flatten": True}} + ) + _builder.set_prop("responses", AAZListType, ".responses") + _builder.set_prop("stepId", AAZStrType, ".step_id") + + responses = _builder.get(".responses") + if responses is not None: + responses.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".responses[]") + if _elements is not None: + _elements.set_prop("questionId", AAZStrType, ".question_id") + _elements.set_prop("questionType", AAZStrType, ".question_type") + _elements.set_prop("response", AAZStrType, ".response") + + return self.serialize_content(_content_value) + + def on_204(self, session): + pass + + +class _ContinueHelper: + """Helper class for Continue""" + + +__all__ = ["Continue"] diff --git a/src/self-help/azext_self_help/aaz/latest/self_help/troubleshooter/_create.py b/src/self-help/azext_self_help/aaz/latest/self_help/troubleshooter/_create.py new file mode 100644 index 00000000000..6d636fb1c0f --- /dev/null +++ b/src/self-help/azext_self_help/aaz/latest/self_help/troubleshooter/_create.py @@ -0,0 +1,402 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "self-help troubleshooter create", + is_preview=True, +) +class Create(AAZCommand): + """Create the specific troubleshooter action under a resource or subscription. + + :example: Create Troubleshooter at Resource Level + az self-help troubleshooter create --troubleshooter-name 12345678-BBBb-cCCCC-0000-123456789012 --solution-id e104dbdf-9e14-4c9f-bc78-21ac90382231 --parameters {ResourceUri:'subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read'} --scope 'subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read' + """ + + _aaz_info = { + "version": "2023-09-01-preview", + "resources": [ + ["mgmt-plane", "/{scope}/providers/microsoft.help/troubleshooters/{}", "2023-09-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.scope = AAZStrArg( + options=["--scope"], + help="This is an extension resource provider and only resource level extension is supported at the moment.", + required=True, + ) + _args_schema.troubleshooter_name = AAZStrArg( + options=["--troubleshooter-name"], + help="Troubleshooter resource Name.", + required=True, + fmt=AAZStrArgFormat( + pattern="([A-Za-z0-9]+(-[A-Za-z0-9]+)+)", + max_length=100, + min_length=1, + ), + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.parameters = AAZDictArg( + options=["--parameters"], + arg_group="Properties", + help="Client input parameters to run Troubleshooter Resource", + ) + _args_schema.solution_id = AAZStrArg( + options=["--solution-id"], + arg_group="Properties", + help="Solution Id to identify single troubleshooter.", + ) + + parameters = cls._args_schema.parameters + parameters.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.TroubleshootersCreate(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 TroubleshootersCreate(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, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName}", + **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( + "scope", self.ctx.args.scope, + skip_quote=True, + required=True, + ), + **self.serialize_url_param( + "troubleshooterName", self.ctx.args.troubleshooter_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2023-09-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": {"client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("parameters", AAZDictType, ".parameters") + properties.set_prop("solutionId", AAZStrType, ".solution_id") + + parameters = _builder.get(".properties.parameters") + if parameters is not None: + parameters.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.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.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.parameters = AAZDictType() + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.solution_id = AAZStrType( + serialized_name="solutionId", + ) + properties.steps = AAZListType( + flags={"read_only": True}, + ) + + parameters = cls._schema_on_200_201.properties.parameters + parameters.Element = AAZStrType() + + steps = cls._schema_on_200_201.properties.steps + steps.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.steps.Element + _element.automated_check_results = AAZObjectType( + serialized_name="automatedCheckResults", + ) + _element.description = AAZStrType() + _element.error = AAZObjectType() + _CreateHelper._build_schema_error_detail_read(_element.error) + _element.execution_status = AAZStrType( + serialized_name="executionStatus", + ) + _element.execution_status_description = AAZStrType( + serialized_name="executionStatusDescription", + ) + _element.guidance = AAZStrType() + _element.id = AAZStrType() + _element.inputs = AAZListType() + _element.insights = AAZListType() + _element.is_last_step = AAZBoolType( + serialized_name="isLastStep", + ) + _element.title = AAZStrType() + _element.type = AAZStrType() + + automated_check_results = cls._schema_on_200_201.properties.steps.Element.automated_check_results + automated_check_results.result = AAZStrType() + automated_check_results.type = AAZStrType() + + inputs = cls._schema_on_200_201.properties.steps.Element.inputs + inputs.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.steps.Element.inputs.Element + _element.question_content = AAZStrType( + serialized_name="questionContent", + ) + _element.question_content_type = AAZStrType( + serialized_name="questionContentType", + ) + _element.question_id = AAZStrType( + serialized_name="questionId", + ) + _element.question_type = AAZStrType( + serialized_name="questionType", + ) + _element.recommended_option = AAZStrType( + serialized_name="recommendedOption", + ) + _element.response_hint = AAZStrType( + serialized_name="responseHint", + ) + _element.response_options = AAZListType( + serialized_name="responseOptions", + ) + _element.response_validation_properties = AAZObjectType( + serialized_name="responseValidationProperties", + ) + _element.selected_option_value = AAZStrType( + serialized_name="selectedOptionValue", + ) + + response_options = cls._schema_on_200_201.properties.steps.Element.inputs.Element.response_options + response_options.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.steps.Element.inputs.Element.response_options.Element + _element.key = AAZStrType() + _element.value = AAZStrType() + + response_validation_properties = cls._schema_on_200_201.properties.steps.Element.inputs.Element.response_validation_properties + response_validation_properties.is_required = AAZBoolType( + serialized_name="isRequired", + ) + response_validation_properties.max_length = AAZIntType( + serialized_name="maxLength", + ) + response_validation_properties.regex = AAZStrType() + response_validation_properties.validation_error_message = AAZStrType( + serialized_name="validationErrorMessage", + ) + + insights = cls._schema_on_200_201.properties.steps.Element.insights + insights.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.steps.Element.insights.Element + _element.id = AAZStrType() + _element.importance_level = AAZStrType( + serialized_name="importanceLevel", + ) + _element.results = AAZStrType() + _element.title = AAZStrType() + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + _schema_error_detail_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType() + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + +__all__ = ["Create"] diff --git a/src/self-help/azext_self_help/aaz/latest/self_help/troubleshooter/_end.py b/src/self-help/azext_self_help/aaz/latest/self_help/troubleshooter/_end.py new file mode 100644 index 00000000000..afc948cdedb --- /dev/null +++ b/src/self-help/azext_self_help/aaz/latest/self_help/troubleshooter/_end.py @@ -0,0 +1,137 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "self-help troubleshooter end", + is_preview=True, +) +class End(AAZCommand): + """Ends the troubleshooter action + + :example: End Troubleshooter at Resource Level + az self-help troubleshooter end --troubleshooter-name 12345678-BBBb-cCCCC-0000-123456789012 --scope 'subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read' + """ + + _aaz_info = { + "version": "2023-09-01-preview", + "resources": [ + ["mgmt-plane", "/{scope}/providers/microsoft.help/troubleshooters/{}/end", "2023-09-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return 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.scope = AAZStrArg( + options=["--scope"], + help="This is an extension resource provider and only resource level extension is supported at the moment.", + required=True, + ) + _args_schema.troubleshooter_name = AAZStrArg( + options=["--troubleshooter-name"], + help="Troubleshooter resource Name.", + required=True, + fmt=AAZStrArgFormat( + pattern="([A-Za-z0-9]+(-[A-Za-z0-9]+)+)", + max_length=100, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.TroubleshootersEnd(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class TroubleshootersEnd(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 [204]: + return self.on_204(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName}/end", + **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( + "scope", self.ctx.args.scope, + skip_quote=True, + required=True, + ), + **self.serialize_url_param( + "troubleshooterName", self.ctx.args.troubleshooter_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2023-09-01-preview", + required=True, + ), + } + return parameters + + def on_204(self, session): + pass + + +class _EndHelper: + """Helper class for End""" + + +__all__ = ["End"] diff --git a/src/self-help/azext_self_help/aaz/latest/self_help/troubleshooter/_restart.py b/src/self-help/azext_self_help/aaz/latest/self_help/troubleshooter/_restart.py new file mode 100644 index 00000000000..2a41320f3cc --- /dev/null +++ b/src/self-help/azext_self_help/aaz/latest/self_help/troubleshooter/_restart.py @@ -0,0 +1,172 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "self-help troubleshooter restart", + is_preview=True, +) +class Restart(AAZCommand): + """Restarts the troubleshooter API using applicable troubleshooter resource name as the input. + + :example: Restart Troubleshooter at Resource Level + az self-help troubleshooter restart --troubleshooter-name 12345678-BBBb-cCCCC-0000-123456789012 --scope 'subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read' + """ + + _aaz_info = { + "version": "2023-09-01-preview", + "resources": [ + ["mgmt-plane", "/{scope}/providers/microsoft.help/troubleshooters/{}/restart", "2023-09-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.scope = AAZStrArg( + options=["--scope"], + help="This is an extension resource provider and only resource level extension is supported at the moment.", + required=True, + ) + _args_schema.troubleshooter_name = AAZStrArg( + options=["--troubleshooter-name"], + help="Troubleshooter resource Name.", + required=True, + fmt=AAZStrArgFormat( + pattern="([A-Za-z0-9]+(-[A-Za-z0-9]+)+)", + max_length=100, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.TroubleshootersRestart(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 TroubleshootersRestart(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( + "/{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName}/restart", + **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( + "scope", self.ctx.args.scope, + skip_quote=True, + required=True, + ), + **self.serialize_url_param( + "troubleshooterName", self.ctx.args.troubleshooter_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2023-09-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.troubleshooter_resource_name = AAZStrType( + serialized_name="troubleshooterResourceName", + flags={"read_only": True}, + ) + + return cls._schema_on_200 + + +class _RestartHelper: + """Helper class for Restart""" + + +__all__ = ["Restart"] diff --git a/src/self-help/azext_self_help/aaz/latest/self_help/troubleshooter/_show.py b/src/self-help/azext_self_help/aaz/latest/self_help/troubleshooter/_show.py new file mode 100644 index 00000000000..978e1b35e95 --- /dev/null +++ b/src/self-help/azext_self_help/aaz/latest/self_help/troubleshooter/_show.py @@ -0,0 +1,362 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "self-help troubleshooter show", + is_preview=True, +) +class Show(AAZCommand): + """Get troubleshooter instance result which includes the step status/result of the troubleshooter resource name that is being executed. + + :example: Show Troubleshooter at Resource Level + az self-help troubleshooter show --troubleshooter-name 12345678-BBBb-cCCCC-0000-123456789012 --scope 'subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read' + """ + + _aaz_info = { + "version": "2023-09-01-preview", + "resources": [ + ["mgmt-plane", "/{scope}/providers/microsoft.help/troubleshooters/{}", "2023-09-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.scope = AAZStrArg( + options=["--scope"], + help="This is an extension resource provider and only resource level extension is supported at the moment.", + required=True, + ) + _args_schema.troubleshooter_name = AAZStrArg( + options=["--troubleshooter-name"], + help="Troubleshooter resource Name.", + required=True, + fmt=AAZStrArgFormat( + pattern="([A-Za-z0-9]+(-[A-Za-z0-9]+)+)", + max_length=100, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.TroubleshootersGet(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 TroubleshootersGet(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( + "/{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName}", + **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( + "scope", self.ctx.args.scope, + skip_quote=True, + required=True, + ), + **self.serialize_url_param( + "troubleshooterName", self.ctx.args.troubleshooter_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2023-09-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.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.parameters = AAZDictType() + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.solution_id = AAZStrType( + serialized_name="solutionId", + ) + properties.steps = AAZListType( + flags={"read_only": True}, + ) + + parameters = cls._schema_on_200.properties.parameters + parameters.Element = AAZStrType() + + steps = cls._schema_on_200.properties.steps + steps.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.steps.Element + _element.automated_check_results = AAZObjectType( + serialized_name="automatedCheckResults", + ) + _element.description = AAZStrType() + _element.error = AAZObjectType() + _ShowHelper._build_schema_error_detail_read(_element.error) + _element.execution_status = AAZStrType( + serialized_name="executionStatus", + ) + _element.execution_status_description = AAZStrType( + serialized_name="executionStatusDescription", + ) + _element.guidance = AAZStrType() + _element.id = AAZStrType() + _element.inputs = AAZListType() + _element.insights = AAZListType() + _element.is_last_step = AAZBoolType( + serialized_name="isLastStep", + ) + _element.title = AAZStrType() + _element.type = AAZStrType() + + automated_check_results = cls._schema_on_200.properties.steps.Element.automated_check_results + automated_check_results.result = AAZStrType() + automated_check_results.type = AAZStrType() + + inputs = cls._schema_on_200.properties.steps.Element.inputs + inputs.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.steps.Element.inputs.Element + _element.question_content = AAZStrType( + serialized_name="questionContent", + ) + _element.question_content_type = AAZStrType( + serialized_name="questionContentType", + ) + _element.question_id = AAZStrType( + serialized_name="questionId", + ) + _element.question_type = AAZStrType( + serialized_name="questionType", + ) + _element.recommended_option = AAZStrType( + serialized_name="recommendedOption", + ) + _element.response_hint = AAZStrType( + serialized_name="responseHint", + ) + _element.response_options = AAZListType( + serialized_name="responseOptions", + ) + _element.response_validation_properties = AAZObjectType( + serialized_name="responseValidationProperties", + ) + _element.selected_option_value = AAZStrType( + serialized_name="selectedOptionValue", + ) + + response_options = cls._schema_on_200.properties.steps.Element.inputs.Element.response_options + response_options.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.steps.Element.inputs.Element.response_options.Element + _element.key = AAZStrType() + _element.value = AAZStrType() + + response_validation_properties = cls._schema_on_200.properties.steps.Element.inputs.Element.response_validation_properties + response_validation_properties.is_required = AAZBoolType( + serialized_name="isRequired", + ) + response_validation_properties.max_length = AAZIntType( + serialized_name="maxLength", + ) + response_validation_properties.regex = AAZStrType() + response_validation_properties.validation_error_message = AAZStrType( + serialized_name="validationErrorMessage", + ) + + insights = cls._schema_on_200.properties.steps.Element.insights + insights.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.steps.Element.insights.Element + _element.id = AAZStrType() + _element.importance_level = AAZStrType( + serialized_name="importanceLevel", + ) + _element.results = AAZStrType() + _element.title = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + _schema_error_detail_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType() + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + +__all__ = ["Show"] diff --git a/src/self-help/azext_self_help/azext_metadata.json b/src/self-help/azext_self_help/azext_metadata.json index be5de02d927..24862c32571 100644 --- a/src/self-help/azext_self_help/azext_metadata.json +++ b/src/self-help/azext_self_help/azext_metadata.json @@ -1,4 +1,4 @@ { "azext.isPreview": true, - "azext.minCliCoreVersion": "2.45.0" + "azext.minCliCoreVersion": "2.51.0" } \ No newline at end of file diff --git a/src/self-help/azext_self_help/tests/latest/recordings/test_help_check_name_diagnostics.yaml b/src/self-help/azext_self_help/tests/latest/recordings/test_help_check_name_diagnostics.yaml index 85c5463d8be..2cd883f65fa 100644 --- a/src/self-help/azext_self_help/tests/latest/recordings/test_help_check_name_diagnostics.yaml +++ b/src/self-help/azext_self_help/tests/latest/recordings/test_help_check_name_diagnostics.yaml @@ -17,9 +17,9 @@ interactions: ParameterSetName: - --scope --name --type User-Agent: - - AZURECLI/2.47.0 (AAZ) azsdk-python-core/1.24.0 Python/3.10.11 (Windows-10-10.0.22621-SP0) + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.9.13 (Windows-10-10.0.22621-SP0) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Help/checkNameAvailability?api-version=2023-01-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Help/checkNameAvailability?api-version=2023-09-01-preview response: body: string: '{"nameAvailable":true}' @@ -31,7 +31,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 21 Apr 2023 20:03:32 GMT + - Fri, 13 Oct 2023 17:07:51 GMT expires: - '-1' pragma: diff --git a/src/self-help/azext_self_help/tests/latest/recordings/test_help_check_name_solutions.yaml b/src/self-help/azext_self_help/tests/latest/recordings/test_help_check_name_solutions.yaml new file mode 100644 index 00000000000..80219ccf9d8 --- /dev/null +++ b/src/self-help/azext_self_help/tests/latest/recordings/test_help_check_name_solutions.yaml @@ -0,0 +1,54 @@ +interactions: +- request: + body: '{"name": "cli_test000001", "type": "Microsoft.Help/solutions"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - self-help check-name-availability + Connection: + - keep-alive + Content-Length: + - '62' + Content-Type: + - application/json + ParameterSetName: + - --scope --name --type + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.9.13 (Windows-10-10.0.22621-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Help/checkNameAvailability?api-version=2023-09-01-preview + response: + body: + string: '{"nameAvailable":true}' + headers: + cache-control: + - no-cache + content-length: + - '22' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 13 Oct 2023 17:08:24 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +version: 1 diff --git a/src/self-help/azext_self_help/tests/latest/recordings/test_help_check_name_troubleshooters.yaml b/src/self-help/azext_self_help/tests/latest/recordings/test_help_check_name_troubleshooters.yaml new file mode 100644 index 00000000000..1bab37c9af6 --- /dev/null +++ b/src/self-help/azext_self_help/tests/latest/recordings/test_help_check_name_troubleshooters.yaml @@ -0,0 +1,56 @@ +interactions: +- request: + body: '{"name": "a5c1a001-98dc-4738-8047-220fa8cb0632", "type": "Microsoft.Help/troubleshooters"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - self-help check-name-availability + Connection: + - keep-alive + Content-Length: + - '90' + Content-Type: + - application/json + ParameterSetName: + - --scope --name --type + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.9.13 (Windows-10-10.0.22621-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Help/checkNameAvailability?api-version=2023-09-01-preview + response: + body: + string: '{"nameAvailable":true}' + headers: + cache-control: + - no-cache + content-length: + - '22' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 13 Oct 2023 17:08:39 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +version: 1 diff --git a/src/self-help/azext_self_help/tests/latest/recordings/test_help_diagnostics.yaml b/src/self-help/azext_self_help/tests/latest/recordings/test_help_diagnostics.yaml index 84454315a71..aee7120c974 100644 --- a/src/self-help/azext_self_help/tests/latest/recordings/test_help_diagnostics.yaml +++ b/src/self-help/azext_self_help/tests/latest/recordings/test_help_diagnostics.yaml @@ -17,15 +17,15 @@ interactions: ParameterSetName: - --diagnostic-name --insights --scope User-Agent: - - AZURECLI/2.47.0 (AAZ) azsdk-python-core/1.24.0 Python/3.10.11 (Windows-10-10.0.22621-SP0) + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.9.13 (Windows-10-10.0.22621-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/diagnostics/cli_test000003?api-version=2023-01-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/diagnostics/cli_test000003?api-version=2023-09-01-preview response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/diagnostics/cli_test000003","name":"cli_test000003","type":"Microsoft.Help/Diagnostics","properties":{"provisioningState":"Running","acceptedAt":"2023-04-21T20:04:10.8597072Z"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/diagnostics/cli_test000003","name":"cli_test000003","type":"Microsoft.Help/Diagnostics","properties":{"provisioningState":"Running","acceptedAt":"2023-10-13T16:58:44.5034966Z"}}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Help/Diagnostics/cli_test000003/operationResults/2dd5b8b0-3417-4634-add6-a966ab23b4a6?api-version=2023-01-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Help/Diagnostics/cli_test000003/operationResults/b4c0bf75-5a8a-4028-8441-8463a7b83945?api-version=2023-09-01-preview cache-control: - no-cache content-length: @@ -33,11 +33,11 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 21 Apr 2023 20:04:10 GMT + - Fri, 13 Oct 2023 16:58:43 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Help/Diagnostics/cli_test000003/operationResults/2dd5b8b0-3417-4634-add6-a966ab23b4a6?api-version=2023-01-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Help/Diagnostics/cli_test000003/operationResults/b4c0bf75-5a8a-4028-8441-8463a7b83945?api-version=2023-09-01-preview pragma: - no-cache server: @@ -67,12 +67,60 @@ interactions: ParameterSetName: - --diagnostic-name --insights --scope User-Agent: - - AZURECLI/2.47.0 (AAZ) azsdk-python-core/1.24.0 Python/3.10.11 (Windows-10-10.0.22621-SP0) + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.9.13 (Windows-10-10.0.22621-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Help/Diagnostics/cli_test000003/operationResults/2dd5b8b0-3417-4634-add6-a966ab23b4a6?api-version=2023-01-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Help/Diagnostics/cli_test000003/operationResults/b4c0bf75-5a8a-4028-8441-8463a7b83945?api-version=2023-09-01-preview response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Help/Diagnostics/cli_test000003/operationResults/2dd5b8b0-3417-4634-add6-a966ab23b4a6","name":"2dd5b8b0-3417-4634-add6-a966ab23b4a6","status":"Succeeded"}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Help/Diagnostics/cli_test000003/operationResults/b4c0bf75-5a8a-4028-8441-8463a7b83945","name":"b4c0bf75-5a8a-4028-8441-8463a7b83945","status":"Running"}' + headers: + cache-control: + - no-cache + content-length: + - '231' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 13 Oct 2023 16:58:43 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - self-help diagnostic create + Connection: + - keep-alive + ParameterSetName: + - --diagnostic-name --insights --scope + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.9.13 (Windows-10-10.0.22621-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Help/Diagnostics/cli_test000003/operationResults/b4c0bf75-5a8a-4028-8441-8463a7b83945?api-version=2023-09-01-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Help/Diagnostics/cli_test000003/operationResults/b4c0bf75-5a8a-4028-8441-8463a7b83945","name":"b4c0bf75-5a8a-4028-8441-8463a7b83945","status":"Succeeded"}' headers: cache-control: - no-cache @@ -81,7 +129,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 21 Apr 2023 20:04:40 GMT + - Fri, 13 Oct 2023 16:59:14 GMT expires: - '-1' pragma: @@ -115,12 +163,12 @@ interactions: ParameterSetName: - --diagnostic-name --insights --scope User-Agent: - - AZURECLI/2.47.0 (AAZ) azsdk-python-core/1.24.0 Python/3.10.11 (Windows-10-10.0.22621-SP0) + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.9.13 (Windows-10-10.0.22621-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/diagnostics/cli_test000003?api-version=2023-01-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/diagnostics/cli_test000003?api-version=2023-09-01-preview response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/diagnostics/cli_test000003","name":"cli_test000003","type":"Microsoft.Help/Diagnostics","properties":{"provisioningState":"Succeeded","acceptedAt":"2023-04-21T20:04:10.8597072Z","diagnostics":[{"solutionId":"Demo2InsightV2","status":"Succeeded","insights":[{"id":"perfinsights-available-linux","title":"Windows + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/diagnostics/cli_test000003","name":"cli_test000003","type":"Microsoft.Help/Diagnostics","properties":{"provisioningState":"Succeeded","acceptedAt":"2023-10-13T16:58:44.5034966Z","diagnostics":[{"solutionId":"Demo2InsightV2","status":"Succeeded","insights":[{"id":"perfinsights-available-linux","title":"Windows Unable to Boot Test hardcoded string for unknown resource (Demo Insight)","results":"\n

We have detected that PerfInsights is already installed on your VM. You can run PerfInsights on-demand through the Portal and view reports for your analysis.

\n\n

PerfInsights @@ -145,7 +193,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 21 Apr 2023 20:04:40 GMT + - Fri, 13 Oct 2023 16:59:15 GMT expires: - '-1' pragma: @@ -181,12 +229,12 @@ interactions: ParameterSetName: - --diagnostic-name --scope User-Agent: - - AZURECLI/2.47.0 (AAZ) azsdk-python-core/1.24.0 Python/3.10.11 (Windows-10-10.0.22621-SP0) + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.9.13 (Windows-10-10.0.22621-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/diagnostics/cli_test000003?api-version=2023-01-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/diagnostics/cli_test000003?api-version=2023-09-01-preview response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/diagnostics/cli_test000003","name":"cli_test000003","type":"Microsoft.Help/Diagnostics","properties":{"provisioningState":"Succeeded","acceptedAt":"2023-04-21T20:04:10.8597072Z","diagnostics":[{"solutionId":"Demo2InsightV2","status":"Succeeded","insights":[{"id":"perfinsights-available-linux","title":"Windows + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/diagnostics/cli_test000003","name":"cli_test000003","type":"Microsoft.Help/Diagnostics","properties":{"provisioningState":"Succeeded","acceptedAt":"2023-10-13T16:58:44.5034966Z","diagnostics":[{"solutionId":"Demo2InsightV2","status":"Succeeded","insights":[{"id":"perfinsights-available-linux","title":"Windows Unable to Boot Test hardcoded string for unknown resource (Demo Insight)","results":"\n

We have detected that PerfInsights is already installed on your VM. You can run PerfInsights on-demand through the Portal and view reports for your analysis.

\n\n

PerfInsights @@ -211,7 +259,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 21 Apr 2023 20:04:43 GMT + - Fri, 13 Oct 2023 16:59:16 GMT expires: - '-1' pragma: @@ -220,8 +268,10 @@ interactions: - Microsoft-IIS/10.0 strict-transport-security: - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked vary: - - Accept-Encoding + - Accept-Encoding,Accept-Encoding x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: diff --git a/src/self-help/azext_self_help/tests/latest/recordings/test_help_discoverysolutions.yaml b/src/self-help/azext_self_help/tests/latest/recordings/test_help_discoverysolutions.yaml index 0e5d3b03b81..c6d1f329a56 100644 --- a/src/self-help/azext_self_help/tests/latest/recordings/test_help_discoverysolutions.yaml +++ b/src/self-help/azext_self_help/tests/latest/recordings/test_help_discoverysolutions.yaml @@ -11,27 +11,24 @@ interactions: Connection: - keep-alive ParameterSetName: - - --scope + - --scope --filter User-Agent: - - AZURECLI/2.47.0 (AAZ) azsdk-python-core/1.24.0 Python/3.10.11 (Windows-10-10.0.22621-SP0) + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.9.13 (Windows-10-10.0.22621-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/discoverySolutions?api-version=2023-01-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/discoverySolutions?$filter=ProblemClassificationId%20eq%20%2700000000-0000-0000-0000-000000000000%27&api-version=2023-09-01-preview response: body: - string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/discoverySolutions/KeyVaultSoftDeleteNotEnabledInsight","name":"KeyVaultSoftDeleteNotEnabledInsight","type":"Microsoft.Help/discoverySolutions","properties":{"solutionId":"KeyVaultSoftDeleteNotEnabledInsight","solutionType":"Diagnostics","description":"Checks - a vault''s soft delete enabled setting.","requiredParameterSets":[["ResourceUri"]]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/discoverySolutions/KeyVaultThrottlingData","name":"KeyVaultThrottlingData","type":"Microsoft.Help/discoverySolutions","properties":{"solutionId":"KeyVaultThrottlingData","solutionType":"Diagnostics","description":"Checks - a vault''s throttling status.","requiredParameterSets":[["ResourceUri"]]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/discoverySolutions/KeyVaultUnauthorizedNetworkInsight","name":"KeyVaultUnauthorizedNetworkInsight","type":"Microsoft.Help/discoverySolutions","properties":{"solutionId":"KeyVaultUnauthorizedNetworkInsight","solutionType":"Diagnostics","description":"Checks - a vault for unauthorized network requests.","requiredParameterSets":[["ResourceUri"]]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/discoverySolutions/KeyVaultUnauthorizedAclInsight","name":"KeyVaultUnauthorizedAclInsight","type":"Microsoft.Help/discoverySolutions","properties":{"solutionId":"KeyVaultUnauthorizedAclInsight","solutionType":"Diagnostics","description":"Checks - a vault for unauthorized by ACLs requests.","requiredParameterSets":[["ResourceUri"]]}}],"nextLink":""}' + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/discoverySolutions/00000000-0000-0000-0000-000000000000","name":"00000000-0000-0000-0000-000000000000","type":"Microsoft.Help/discoverySolutions","properties":{"solutions":[{"solutionId":"StorageFailureTransactionInsight","solutionType":"Diagnostics","description":"Analyze + storage failure transaction details","requiredInputs":["SapId","ResourceUri"]}]}}]}' headers: cache-control: - no-cache content-length: - - '2006' + - '533' content-type: - application/json; charset=utf-8 date: - - Fri, 21 Apr 2023 20:04:10 GMT + - Fri, 13 Oct 2023 16:57:03 GMT expires: - '-1' pragma: diff --git a/src/self-help/azext_self_help/tests/latest/recordings/test_help_solutions.yaml b/src/self-help/azext_self_help/tests/latest/recordings/test_help_solutions.yaml new file mode 100644 index 00000000000..91250af0bb1 --- /dev/null +++ b/src/self-help/azext_self_help/tests/latest/recordings/test_help_solutions.yaml @@ -0,0 +1,418 @@ +interactions: +- request: + body: '{"properties": {"parameters": {}, "triggerCriteria": [{"name": "SolutionId", + "value": "Demo2InsightV2"}]}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - self-help solution create + Connection: + - keep-alive + Content-Length: + - '106' + Content-Type: + - application/json + ParameterSetName: + - --solution-name --trigger-criteria --parameters --scope + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.9.13 (Windows-10-10.0.22621-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/solutions/cli_test000003?api-version=2023-09-01-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/solutions/cli_test000003","name":"cli_test000003","type":"Microsoft.Help/Solutions","properties":{"title":"Recommended + Article(s)","content":"\n","replacementMaps":{"diagnostics":[],"webResults":[{"replacementKey":""}]},"solutionId":"ApolloAzureKBResult_","provisioningState":"Succeeded"}}' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Help/Solutions/cli_test000003/operationResults/d941b006-8445-4ecd-8d7d-53f2ccbcc9f2?api-version=2023-09-01-preview + cache-control: + - no-cache + content-length: + - '541' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Oct 2023 15:56:22 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Help/Solutions/cli_test000003/operationResults/d941b006-8445-4ecd-8d7d-53f2ccbcc9f2?api-version=2023-09-01-preview + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-resource-requests: + - '499' + x-powered-by: + - ASP.NET + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - self-help solution create + Connection: + - keep-alive + ParameterSetName: + - --solution-name --trigger-criteria --parameters --scope + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.9.13 (Windows-10-10.0.22621-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Help/Solutions/cli_test000003/operationResults/d941b006-8445-4ecd-8d7d-53f2ccbcc9f2?api-version=2023-09-01-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Help/Solutions/cli_test000003/operationResults/d941b006-8445-4ecd-8d7d-53f2ccbcc9f2","name":"d941b006-8445-4ecd-8d7d-53f2ccbcc9f2","status":"Succeeded"}' + headers: + cache-control: + - no-cache + content-length: + - '231' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Oct 2023 15:56:22 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - self-help solution create + Connection: + - keep-alive + ParameterSetName: + - --solution-name --trigger-criteria --parameters --scope + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.9.13 (Windows-10-10.0.22621-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/solutions/cli_test000003?api-version=2023-09-01-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/solutions/cli_test000003","name":"cli_test000003","type":"Microsoft.Help/Solutions","properties":{"title":"Recommended + Article(s)","content":"\n","replacementMaps":{"diagnostics":[],"webResults":[{"replacementKey":""}]},"solutionId":"ApolloAzureKBResult_","provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '541' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Oct 2023 15:56:22 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-resource-requests: + - '498' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - self-help solution show + Connection: + - keep-alive + ParameterSetName: + - --solution-name --scope + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.9.13 (Windows-10-10.0.22621-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/solutions/cli_test000003?api-version=2023-09-01-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/solutions/cli_test000003","name":"cli_test000003","type":"Microsoft.Help/Solutions","properties":{"title":"Recommended + Article(s)","content":"\n","replacementMaps":{"diagnostics":[],"webResults":[{"replacementKey":""}]},"solutionId":"ApolloAzureKBResult_","provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '541' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Oct 2023 15:56:23 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-resource-requests: + - '499' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - self-help solution update + Connection: + - keep-alive + ParameterSetName: + - --solution-name --trigger-criteria --parameters --scope + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.9.13 (Windows-10-10.0.22621-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/solutions/cli_test000003?api-version=2023-09-01-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/solutions/cli_test000003","name":"cli_test000003","type":"Microsoft.Help/Solutions","properties":{"title":"Recommended + Article(s)","content":"\n","replacementMaps":{"diagnostics":[],"webResults":[{"replacementKey":""}]},"solutionId":"ApolloAzureKBResult_","provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '541' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Oct 2023 15:56:24 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-resource-requests: + - '499' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"properties": {"content": "\n", + "parameters": {"SearchText": "CanNotRDP", "SymptomId": "KeyVaultVaultNotFoundInsight"}, + "provisioningState": "Succeeded", "replacementMaps": {"diagnostics": [], "webResults": + [{"replacementKey": ""}]}, "solutionId": + "ApolloAzureKBResult_", "title": "Recommended Article(s)", "triggerCriteria": + [{"name": "ReplacementKey", "value": ""}]}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - self-help solution update + Connection: + - keep-alive + Content-Length: + - '499' + Content-Type: + - application/json + ParameterSetName: + - --solution-name --trigger-criteria --parameters --scope + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.9.13 (Windows-10-10.0.22621-SP0) + method: PATCH + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/solutions/cli_test000003?api-version=2023-09-01-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/solutions/cli_test000003","name":"cli_test000003","type":"Microsoft.Help/Solutions","properties":{"title":"Recommended + Article(s)","content":"\n","replacementMaps":{"diagnostics":[],"webResults":[{"replacementKey":""}],"metricsBasedCharts":[]},"solutionId":"ApolloAzureKBResult_","provisioningState":"Succeeded"}}' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Help/Solutions/cli_test000003/operationResults/7c79a808-1811-4203-b49a-49764b5027c2?api-version=2023-09-01-preview + cache-control: + - no-cache + content-length: + - '565' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Oct 2023 15:56:24 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Help/Solutions/cli_test000003/operationResults/7c79a808-1811-4203-b49a-49764b5027c2?api-version=2023-09-01-preview + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-resource-requests: + - '498' + x-powered-by: + - ASP.NET + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - self-help solution update + Connection: + - keep-alive + ParameterSetName: + - --solution-name --trigger-criteria --parameters --scope + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.9.13 (Windows-10-10.0.22621-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Help/Solutions/cli_test000003/operationResults/7c79a808-1811-4203-b49a-49764b5027c2?api-version=2023-09-01-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Help/Solutions/cli_test000003/operationResults/7c79a808-1811-4203-b49a-49764b5027c2","name":"7c79a808-1811-4203-b49a-49764b5027c2","status":"Succeeded"}' + headers: + cache-control: + - no-cache + content-length: + - '231' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Oct 2023 15:56:24 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - self-help solution update + Connection: + - keep-alive + ParameterSetName: + - --solution-name --trigger-criteria --parameters --scope + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.9.13 (Windows-10-10.0.22621-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/solutions/cli_test000003?api-version=2023-09-01-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/solutions/cli_test000003","name":"cli_test000003","type":"Microsoft.Help/Solutions","properties":{"title":"Recommended + Article(s)","content":"\n","replacementMaps":{"diagnostics":[],"webResults":[{"replacementKey":""}],"metricsBasedCharts":[]},"solutionId":"ApolloAzureKBResult_","provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '565' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 Oct 2023 15:56:25 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-resource-requests: + - '497' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +version: 1 diff --git a/src/self-help/azext_self_help/tests/latest/recordings/test_help_troubleshooters.yaml b/src/self-help/azext_self_help/tests/latest/recordings/test_help_troubleshooters.yaml new file mode 100644 index 00000000000..587fdab69a5 --- /dev/null +++ b/src/self-help/azext_self_help/tests/latest/recordings/test_help_troubleshooters.yaml @@ -0,0 +1,247 @@ +interactions: +- request: + body: '{"properties": {"parameters": {"ResourceUri": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002"}, + "solutionId": "e104dbdf-9e14-4c9f-bc78-21ac90382231"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - self-help troubleshooter create + Connection: + - keep-alive + Content-Length: + - '238' + Content-Type: + - application/json + ParameterSetName: + - --troubleshooter-name --solution-id --parameters --scope + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.9.13 (Windows-10-10.0.22621-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/troubleshooters/f81d4fae-7dec-11d0-a765-00a0c91e6bf5?api-version=2023-09-01-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/troubleshooters/f81d4fae-7dec-11d0-a765-00a0c91e6bf5","name":"f81d4fae-7dec-11d0-a765-00a0c91e6bf5","type":"troubleshooters","properties":{"provisioningState":"AutoContinue","solutionId":"e104dbdf-9e14-4c9f-bc78-21ac90382231","steps":[{"id":"02ddfeb3-7d1b-4449-b78a-c1cd9bba1a97","title":"Intro + Step","type":"Decision","executionStatus":"Success","isLastStep":false,"inputs":[{"questionId":"0","questionType":"MultiLineInfoBox","questionContent":"{\"title\":\"Connectivity + Guided Troubleshooter\",\"content\":\"This guided troubleshooter will enable + you to self-troubleshoot your Virtual Machine (VM) SSH issues by checking + VM health state, network settings, CPU and memory usage, etc. It typically + takes between 3 to 5 minutes to complete the flow.\"}","questionContentType":"Text"}]}]}}' + headers: + cache-control: + - no-cache + content-length: + - '954' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 13 Oct 2023 17:32:38 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - self-help troubleshooter show + Connection: + - keep-alive + ParameterSetName: + - --troubleshooter-name --scope + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.9.13 (Windows-10-10.0.22621-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/troubleshooters/f81d4fae-7dec-11d0-a765-00a0c91e6bf5?api-version=2023-09-01-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/troubleshooters/f81d4fae-7dec-11d0-a765-00a0c91e6bf5","name":"f81d4fae-7dec-11d0-a765-00a0c91e6bf5","type":"troubleshooters","properties":{"provisioningState":"AutoContinue","solutionId":"e104dbdf-9e14-4c9f-bc78-21ac90382231","steps":[{"id":"02ddfeb3-7d1b-4449-b78a-c1cd9bba1a97","title":"Intro + Step","type":"Decision","executionStatus":"Success","isLastStep":false,"inputs":[{"questionId":"0","questionType":"MultiLineInfoBox","questionContent":"{\"title\":\"Connectivity + Guided Troubleshooter\",\"content\":\"This guided troubleshooter will enable + you to self-troubleshoot your Virtual Machine (VM) SSH issues by checking + VM health state, network settings, CPU and memory usage, etc. It typically + takes between 3 to 5 minutes to complete the flow.\"}","questionContentType":"Text"}]}]}}' + headers: + cache-control: + - no-cache + content-length: + - '954' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 13 Oct 2023 17:32:39 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - self-help troubleshooter end + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --troubleshooter-name --scope + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.9.13 (Windows-10-10.0.22621-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/troubleshooters/f81d4fae-7dec-11d0-a765-00a0c91e6bf5/end?api-version=2023-09-01-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + date: + - Fri, 13 Oct 2023 17:32:39 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 204 + message: No Content +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - self-help troubleshooter restart + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --troubleshooter-name --scope + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.9.13 (Windows-10-10.0.22621-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/troubleshooters/f81d4fae-7dec-11d0-a765-00a0c91e6bf5/restart?api-version=2023-09-01-preview + response: + body: + string: '{"troubleshooterResourceName":"0deff0ed-3194-4538-906b-62c9b487cfc6"}' + headers: + cache-control: + - no-cache + content-length: + - '69' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 13 Oct 2023 17:32:41 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"responses": [], "stepId": "02ddfeb3-7d1b-4449-b78a-c1cd9bba1a97"}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - self-help troubleshooter continue + Connection: + - keep-alive + Content-Length: + - '67' + Content-Type: + - application/json + ParameterSetName: + - --troubleshooter-name --step-id --responses --scope + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.9.13 (Windows-10-10.0.22621-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.KeyVault/vaults/clitest000002/providers/Microsoft.Help/troubleshooters/f81d4fae-7dec-11d0-a765-00a0c91e6bf5/continue?api-version=2023-09-01-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + date: + - Fri, 13 Oct 2023 17:32:42 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 204 + message: No Content +version: 1 diff --git a/src/self-help/azext_self_help/tests/latest/test_self_help.py b/src/self-help/azext_self_help/tests/latest/test_self_help.py index d0963968496..e694a651500 100644 --- a/src/self-help/azext_self_help/tests/latest/test_self_help.py +++ b/src/self-help/azext_self_help/tests/latest/test_self_help.py @@ -6,6 +6,7 @@ # -------------------------------------------------------------------------------------------- from azure.cli.testsdk import ScenarioTest, ResourceGroupPreparer, KeyVaultPreparer from msrestazure.tools import resource_id +import uuid class SelfHelpScenario(ScenarioTest): @@ -19,11 +20,12 @@ def test_help_discoverysolutions(self, resource_group, key_vault): subscription=self.get_subscription_id(), name=key_vault, namespace='Microsoft.KeyVault', - type='vaults') + type='vaults'), + 'filter': "\"ProblemClassificationId eq '00000000-0000-0000-0000-000000000000'\"" }) list_solution_discovery_result = self.cmd( - 'self-help discovery-solution list --scope {scope}', checks=[ + 'self-help discovery-solution list --scope {scope} --filter {filter}', checks=[ self.check( '[0].type', 'Microsoft.Help/discoverySolutions', case_sensitive=False) ]).get_output_in_json() @@ -70,7 +72,7 @@ def test_help_diagnostics(self, resource_group, key_vault): def test_help_check_name_diagnostics(self): - # Create diagnostic for keyVault resource. + # Check diagnostic name availability. self.kwargs.update({ 'scope': resource_id(subscription=self.get_subscription_id()), 'diagnostic-name': self.create_random_name(prefix='cli_test', length=15), @@ -78,5 +80,134 @@ def test_help_check_name_diagnostics(self): self.cmd( "self-help check-name-availability --scope {scope} --name {diagnostic-name} --type 'Microsoft.Help/diagnostics'", checks=[ - self.check('nameAvailable', True), - ]) + self.check('nameAvailable', 'True'),]) + + def test_help_check_name_solutions(self): + + # Check solution name availability. + self.kwargs.update({ + 'scope': resource_id(subscription=self.get_subscription_id()), + 'solution-name': self.create_random_name(prefix='cli_test', length=15), + }) + + self.cmd( + "self-help check-name-availability --scope {scope} --name {solution-name} --type 'Microsoft.Help/solutions'", checks=[ + self.check('nameAvailable', 'True'),]) + + def test_help_check_name_troubleshooters(self): + + # Check troubleshooter name availability. + self.kwargs.update({ + 'scope': resource_id(subscription=self.get_subscription_id()), + 'troubleshooter-name': str(uuid.uuid4()) + }) + + self.cmd( + "self-help check-name-availability --scope {scope} --name {troubleshooter-name} --type 'Microsoft.Help/troubleshooters'", checks=[ + self.check('nameAvailable', 'True'),]) + + + @ResourceGroupPreparer() + @KeyVaultPreparer() + def test_help_solutions(self, resource_group, key_vault): + + # Create solution for keyVault resource. + solution_name = self.create_random_name(prefix='cli_test', length=15) + self.kwargs.update({ + 'scope': resource_id(resource_group=resource_group, + subscription=self.get_subscription_id(), + name=key_vault, + namespace='Microsoft.KeyVault', + type='vaults'), + 'solution-name': solution_name, + 'trigger-criteria': "[{name:solutionid,value:Demo2InsightV2}]", + 'update-trigger-criteria': "[{name:ReplacementKey,value:}]", + 'parameters': '{}', + 'update-parameters': '{SearchText:CanNotRDP,SymptomId:KeyVaultVaultNotFoundInsight}' + }) + + create_solution_result = self.cmd( + "self-help solution create --solution-name {solution-name} --trigger-criteria {trigger-criteria} --parameters {parameters} --scope {scope}", checks=[ + self.check('name', '{solution-name}'), + self.check('type', 'Microsoft.Help/Solutions')]) + create_solution_result = create_solution_result.get_output_in_json() + self.assertTrue(create_solution_result is not None) + self.assertTrue(create_solution_result["id"] is not None) + self.assertTrue(create_solution_result["name"] is not None) + + # Get solution for keyVault resource. + get_solution_result = self.cmd( + "self-help solution show --solution-name {solution-name} --scope {scope}", checks=[ + self.check('name', '{solution-name}'), + self.check('type', 'Microsoft.Help/Solutions')]) + get_solution_result = get_solution_result.get_output_in_json() + self.assertTrue(get_solution_result is not None) + self.assertTrue(get_solution_result["id"] is not None) + self.assertTrue(get_solution_result["name"] is not None) + + # Update solution for keyVault resource. + update_solution_result = self.cmd( + "self-help solution update --solution-name {solution-name} --trigger-criteria {update-trigger-criteria} --parameters {update-parameters} --scope {scope}", checks=[ + self.check('name', '{solution-name}'), + self.check('type', 'Microsoft.Help/Solutions')]) + update_solution_result = update_solution_result.get_output_in_json() + self.assertTrue(update_solution_result is not None) + self.assertTrue(update_solution_result["id"] is not None) + self.assertTrue(update_solution_result["name"] is not None) + + + @ResourceGroupPreparer() + @KeyVaultPreparer() + def test_help_troubleshooters(self, resource_group, key_vault): + + # Create solution for keyVault resource. + resourceId = resource_id(resource_group=resource_group, + subscription=self.get_subscription_id(), + name=key_vault, + namespace='Microsoft.KeyVault', + type='vaults') + self.kwargs.update({ + 'scope': resourceId, + 'troubleshooter-name': 'f81d4fae-7dec-11d0-a765-00a0c91e6bf5', + 'solution-id': 'e104dbdf-9e14-4c9f-bc78-21ac90382231', + 'parameters': '{ResourceUri:' + resourceId + '}', + 'responses': '[]' + }) + + create_troubleshooter_result = self.cmd( + "self-help troubleshooter create --troubleshooter-name {troubleshooter-name} --solution-id {solution-id} --parameters {parameters} --scope {scope}", checks=[ + self.check('name', '{troubleshooter-name}'), + self.check('type', 'troubleshooters')]) + create_troubleshooter_result = create_troubleshooter_result.get_output_in_json() + self.assertTrue(create_troubleshooter_result is not None) + self.assertTrue(create_troubleshooter_result["id"] is not None) + self.assertTrue(create_troubleshooter_result["name"] is not None) + self.assertTrue(create_troubleshooter_result["steps"] is not None) + + + # Get solution for keyVault resource. + get_troubleshooter_result = self.cmd( + "self-help troubleshooter show --troubleshooter-name {troubleshooter-name} --scope {scope}", checks=[ + self.check('name', '{troubleshooter-name}'), + self.check('type', 'troubleshooters')]) + get_troubleshooter_result = get_troubleshooter_result.get_output_in_json() + self.assertTrue(get_troubleshooter_result is not None) + self.assertTrue(get_troubleshooter_result["id"] is not None) + self.assertTrue(get_troubleshooter_result["name"] is not None) + self.assertTrue(get_troubleshooter_result["steps"] is not None) + + self.kwargs.update({'step-id': get_troubleshooter_result["steps"][0]["id"]}) + + # End troubleshooter for keyVault resource. + self.cmd( + "self-help troubleshooter end --troubleshooter-name {troubleshooter-name} --scope {scope}") + + # Restart troubleshooter for keyVault resource. + restart_troubleshooter_result = self.cmd( + "self-help troubleshooter restart --troubleshooter-name {troubleshooter-name} --scope {scope}") + restart_troubleshooter_result = restart_troubleshooter_result.get_output_in_json() + self.assertTrue(restart_troubleshooter_result is not None) + + # Continue troubleshooter for keyVault resource. + self.cmd("self-help troubleshooter continue --troubleshooter-name {troubleshooter-name} --step-id {step-id} --responses {responses} --scope {scope}") + diff --git a/src/self-help/setup.py b/src/self-help/setup.py index cca9eb2d872..c7bf2b8a313 100644 --- a/src/self-help/setup.py +++ b/src/self-help/setup.py @@ -10,7 +10,7 @@ # HISTORY.rst entry. -VERSION = '0.1.0' +VERSION = '0.2.0' # The full list of classifiers is available at # https://pypi.python.org/pypi?%3Aaction=list_classifiers