|
32 | 32 | from ... import models as _models
|
33 | 33 | from ..._vendor import _convert_request
|
34 | 34 | from ...operations._configurations_operations import (
|
| 35 | + build_analysis_request, |
35 | 36 | build_create_or_update_request,
|
36 | 37 | build_delete_request,
|
37 | 38 | build_get_request,
|
@@ -607,3 +608,170 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
|
607 | 608 | begin_delete.metadata = {
|
608 | 609 | "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}"
|
609 | 610 | }
|
| 611 | + |
| 612 | + @overload |
| 613 | + async def analysis( |
| 614 | + self, |
| 615 | + resource_group_name: str, |
| 616 | + deployment_name: str, |
| 617 | + configuration_name: str, |
| 618 | + body: Optional[_models.AnalysisCreate] = None, |
| 619 | + *, |
| 620 | + content_type: str = "application/json", |
| 621 | + **kwargs: Any |
| 622 | + ) -> _models.AnalysisResult: |
| 623 | + """Analyze an NGINX configuration without applying it to the NGINXaaS deployment. |
| 624 | +
|
| 625 | + Analyze an NGINX configuration without applying it to the NGINXaaS deployment. |
| 626 | +
|
| 627 | + :param resource_group_name: The name of the resource group. The name is case insensitive. |
| 628 | + Required. |
| 629 | + :type resource_group_name: str |
| 630 | + :param deployment_name: The name of targeted NGINX deployment. Required. |
| 631 | + :type deployment_name: str |
| 632 | + :param configuration_name: The name of configuration, only 'default' is supported value due to |
| 633 | + the singleton of NGINX conf. Required. |
| 634 | + :type configuration_name: str |
| 635 | + :param body: The NGINX configuration to analyze. Default value is None. |
| 636 | + :type body: ~azure.mgmt.nginx.models.AnalysisCreate |
| 637 | + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. |
| 638 | + Default value is "application/json". |
| 639 | + :paramtype content_type: str |
| 640 | + :keyword callable cls: A custom type or function that will be passed the direct response |
| 641 | + :return: AnalysisResult or the result of cls(response) |
| 642 | + :rtype: ~azure.mgmt.nginx.models.AnalysisResult |
| 643 | + :raises ~azure.core.exceptions.HttpResponseError: |
| 644 | + """ |
| 645 | + |
| 646 | + @overload |
| 647 | + async def analysis( |
| 648 | + self, |
| 649 | + resource_group_name: str, |
| 650 | + deployment_name: str, |
| 651 | + configuration_name: str, |
| 652 | + body: Optional[IO] = None, |
| 653 | + *, |
| 654 | + content_type: str = "application/json", |
| 655 | + **kwargs: Any |
| 656 | + ) -> _models.AnalysisResult: |
| 657 | + """Analyze an NGINX configuration without applying it to the NGINXaaS deployment. |
| 658 | +
|
| 659 | + Analyze an NGINX configuration without applying it to the NGINXaaS deployment. |
| 660 | +
|
| 661 | + :param resource_group_name: The name of the resource group. The name is case insensitive. |
| 662 | + Required. |
| 663 | + :type resource_group_name: str |
| 664 | + :param deployment_name: The name of targeted NGINX deployment. Required. |
| 665 | + :type deployment_name: str |
| 666 | + :param configuration_name: The name of configuration, only 'default' is supported value due to |
| 667 | + the singleton of NGINX conf. Required. |
| 668 | + :type configuration_name: str |
| 669 | + :param body: The NGINX configuration to analyze. Default value is None. |
| 670 | + :type body: IO |
| 671 | + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. |
| 672 | + Default value is "application/json". |
| 673 | + :paramtype content_type: str |
| 674 | + :keyword callable cls: A custom type or function that will be passed the direct response |
| 675 | + :return: AnalysisResult or the result of cls(response) |
| 676 | + :rtype: ~azure.mgmt.nginx.models.AnalysisResult |
| 677 | + :raises ~azure.core.exceptions.HttpResponseError: |
| 678 | + """ |
| 679 | + |
| 680 | + @distributed_trace_async |
| 681 | + async def analysis( |
| 682 | + self, |
| 683 | + resource_group_name: str, |
| 684 | + deployment_name: str, |
| 685 | + configuration_name: str, |
| 686 | + body: Optional[Union[_models.AnalysisCreate, IO]] = None, |
| 687 | + **kwargs: Any |
| 688 | + ) -> _models.AnalysisResult: |
| 689 | + """Analyze an NGINX configuration without applying it to the NGINXaaS deployment. |
| 690 | +
|
| 691 | + Analyze an NGINX configuration without applying it to the NGINXaaS deployment. |
| 692 | +
|
| 693 | + :param resource_group_name: The name of the resource group. The name is case insensitive. |
| 694 | + Required. |
| 695 | + :type resource_group_name: str |
| 696 | + :param deployment_name: The name of targeted NGINX deployment. Required. |
| 697 | + :type deployment_name: str |
| 698 | + :param configuration_name: The name of configuration, only 'default' is supported value due to |
| 699 | + the singleton of NGINX conf. Required. |
| 700 | + :type configuration_name: str |
| 701 | + :param body: The NGINX configuration to analyze. Is either a AnalysisCreate type or a IO type. |
| 702 | + Default value is None. |
| 703 | + :type body: ~azure.mgmt.nginx.models.AnalysisCreate or IO |
| 704 | + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. |
| 705 | + Default value is None. |
| 706 | + :paramtype content_type: str |
| 707 | + :keyword callable cls: A custom type or function that will be passed the direct response |
| 708 | + :return: AnalysisResult or the result of cls(response) |
| 709 | + :rtype: ~azure.mgmt.nginx.models.AnalysisResult |
| 710 | + :raises ~azure.core.exceptions.HttpResponseError: |
| 711 | + """ |
| 712 | + error_map = { |
| 713 | + 401: ClientAuthenticationError, |
| 714 | + 404: ResourceNotFoundError, |
| 715 | + 409: ResourceExistsError, |
| 716 | + 304: ResourceNotModifiedError, |
| 717 | + } |
| 718 | + error_map.update(kwargs.pop("error_map", {}) or {}) |
| 719 | + |
| 720 | + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) |
| 721 | + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) |
| 722 | + |
| 723 | + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) |
| 724 | + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) |
| 725 | + cls: ClsType[_models.AnalysisResult] = kwargs.pop("cls", None) |
| 726 | + |
| 727 | + content_type = content_type or "application/json" |
| 728 | + _json = None |
| 729 | + _content = None |
| 730 | + if isinstance(body, (IOBase, bytes)): |
| 731 | + _content = body |
| 732 | + else: |
| 733 | + if body is not None: |
| 734 | + _json = self._serialize.body(body, "AnalysisCreate") |
| 735 | + else: |
| 736 | + _json = None |
| 737 | + |
| 738 | + request = build_analysis_request( |
| 739 | + resource_group_name=resource_group_name, |
| 740 | + deployment_name=deployment_name, |
| 741 | + configuration_name=configuration_name, |
| 742 | + subscription_id=self._config.subscription_id, |
| 743 | + api_version=api_version, |
| 744 | + content_type=content_type, |
| 745 | + json=_json, |
| 746 | + content=_content, |
| 747 | + template_url=self.analysis.metadata["url"], |
| 748 | + headers=_headers, |
| 749 | + params=_params, |
| 750 | + ) |
| 751 | + request = _convert_request(request) |
| 752 | + request.url = self._client.format_url(request.url) |
| 753 | + |
| 754 | + _stream = False |
| 755 | + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access |
| 756 | + request, stream=_stream, **kwargs |
| 757 | + ) |
| 758 | + |
| 759 | + response = pipeline_response.http_response |
| 760 | + |
| 761 | + if response.status_code not in [200]: |
| 762 | + map_error(status_code=response.status_code, response=response, error_map=error_map) |
| 763 | + error = self._deserialize.failsafe_deserialize( |
| 764 | + _models.ResourceProviderDefaultErrorResponse, pipeline_response |
| 765 | + ) |
| 766 | + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) |
| 767 | + |
| 768 | + deserialized = self._deserialize("AnalysisResult", pipeline_response) |
| 769 | + |
| 770 | + if cls: |
| 771 | + return cls(pipeline_response, deserialized, {}) |
| 772 | + |
| 773 | + return deserialized |
| 774 | + |
| 775 | + analysis.metadata = { |
| 776 | + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}/analyze" |
| 777 | + } |
0 commit comments