diff --git a/sdk/nginx/azure-mgmt-nginx/CHANGELOG.md b/sdk/nginx/azure-mgmt-nginx/CHANGELOG.md index d7e0724506c5..7d728273e2a1 100644 --- a/sdk/nginx/azure-mgmt-nginx/CHANGELOG.md +++ b/sdk/nginx/azure-mgmt-nginx/CHANGELOG.md @@ -1,5 +1,18 @@ # Release History +## 3.1.0b1 (2024-03-18) + +### Features Added + + - Added operation ConfigurationsOperations.analysis + - Model NginxCertificateProperties has a new parameter certificate_error + - Model NginxCertificateProperties has a new parameter key_vault_secret_created + - Model NginxCertificateProperties has a new parameter key_vault_secret_version + - Model NginxCertificateProperties has a new parameter sha1_thumbprint + - Model NginxDeploymentProperties has a new parameter auto_upgrade_profile + - Model NginxDeploymentScalingProperties has a new parameter profiles + - Model NginxDeploymentUpdateProperties has a new parameter auto_upgrade_profile + ## 3.0.0 (2023-11-20) ### Features Added diff --git a/sdk/nginx/azure-mgmt-nginx/README.md b/sdk/nginx/azure-mgmt-nginx/README.md index e4f1562180de..2c66b7bf631c 100644 --- a/sdk/nginx/azure-mgmt-nginx/README.md +++ b/sdk/nginx/azure-mgmt-nginx/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Nginx Management Client Library. -This package has been tested with Python 3.7+. +This package has been tested with Python 3.8+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.7+ is required to use this package. +- Python 3.8+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package diff --git a/sdk/nginx/azure-mgmt-nginx/_meta.json b/sdk/nginx/azure-mgmt-nginx/_meta.json index 7af512e2286a..fb681322e18f 100644 --- a/sdk/nginx/azure-mgmt-nginx/_meta.json +++ b/sdk/nginx/azure-mgmt-nginx/_meta.json @@ -1,11 +1,11 @@ { - "commit": "11bbc2b1df2e915a2227a6a1a48a27b9e67c3311", + "commit": "cf5ad1932d00c7d15497705ad6b71171d3d68b1e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.7", "use": [ "@autorest/python@6.7.1", "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/nginx/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/nginx/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --tag=package-2024-01-01-preview --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/nginx/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/nginx/azure-mgmt-nginx/assets.json b/sdk/nginx/azure-mgmt-nginx/assets.json new file mode 100644 index 000000000000..41feb6aa3a82 --- /dev/null +++ b/sdk/nginx/azure-mgmt-nginx/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "python", + "TagPrefix": "python/nginx/azure-mgmt-nginx", + "Tag": "python/nginx/azure-mgmt-nginx_7deb46f428" +} diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_configuration.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_configuration.py index c9f0815f44d8..21c7bd4ee8b8 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_configuration.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_configuration.py @@ -29,14 +29,14 @@ class NginxManagementClientConfiguration(Configuration): # pylint: disable=too- :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-04-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-01-01-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(NginxManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-04-01") + api_version: str = kwargs.pop("api_version", "2024-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_nginx_management_client.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_nginx_management_client.py index bf692c8873ba..f4beeccad832 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_nginx_management_client.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_nginx_management_client.py @@ -39,8 +39,8 @@ class NginxManagementClient: # pylint: disable=client-accepts-api-version-keywo :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-04-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-01-01-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_version.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_version.py index cac9f5d10f8b..48b05f9c489c 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_version.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "3.1.0b1" diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/_configuration.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/_configuration.py index 9130d1d34fc7..5998ccf78d8b 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/_configuration.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/_configuration.py @@ -29,14 +29,14 @@ class NginxManagementClientConfiguration(Configuration): # pylint: disable=too- :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-04-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-01-01-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(NginxManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-04-01") + api_version: str = kwargs.pop("api_version", "2024-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/_nginx_management_client.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/_nginx_management_client.py index 95ddba84d12c..37f2541cd626 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/_nginx_management_client.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/_nginx_management_client.py @@ -39,8 +39,8 @@ class NginxManagementClient: # pylint: disable=client-accepts-api-version-keywo :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-04-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-01-01-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_configurations_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_configurations_operations.py index 8f6466452472..657846913dbd 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_configurations_operations.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_configurations_operations.py @@ -32,6 +32,7 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._configurations_operations import ( + build_analysis_request, build_create_or_update_request, build_delete_request, build_get_request, @@ -607,3 +608,170 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- begin_delete.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}" } + + @overload + async def analysis( + self, + resource_group_name: str, + deployment_name: str, + configuration_name: str, + body: Optional[_models.AnalysisCreate] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AnalysisResult: + """Analyze an NGINX configuration without applying it to the NGINXaaS deployment. + + Analyze an NGINX configuration without applying it to the NGINXaaS deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param configuration_name: The name of configuration, only 'default' is supported value due to + the singleton of NGINX conf. Required. + :type configuration_name: str + :param body: The NGINX configuration to analyze. Default value is None. + :type body: ~azure.mgmt.nginx.models.AnalysisCreate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AnalysisResult or the result of cls(response) + :rtype: ~azure.mgmt.nginx.models.AnalysisResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def analysis( + self, + resource_group_name: str, + deployment_name: str, + configuration_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AnalysisResult: + """Analyze an NGINX configuration without applying it to the NGINXaaS deployment. + + Analyze an NGINX configuration without applying it to the NGINXaaS deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param configuration_name: The name of configuration, only 'default' is supported value due to + the singleton of NGINX conf. Required. + :type configuration_name: str + :param body: The NGINX configuration to analyze. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AnalysisResult or the result of cls(response) + :rtype: ~azure.mgmt.nginx.models.AnalysisResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def analysis( + self, + resource_group_name: str, + deployment_name: str, + configuration_name: str, + body: Optional[Union[_models.AnalysisCreate, IO]] = None, + **kwargs: Any + ) -> _models.AnalysisResult: + """Analyze an NGINX configuration without applying it to the NGINXaaS deployment. + + Analyze an NGINX configuration without applying it to the NGINXaaS deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param configuration_name: The name of configuration, only 'default' is supported value due to + the singleton of NGINX conf. Required. + :type configuration_name: str + :param body: The NGINX configuration to analyze. Is either a AnalysisCreate type or a IO type. + Default value is None. + :type body: ~azure.mgmt.nginx.models.AnalysisCreate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AnalysisResult or the result of cls(response) + :rtype: ~azure.mgmt.nginx.models.AnalysisResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AnalysisResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "AnalysisCreate") + else: + _json = None + + request = build_analysis_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.analysis.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ResourceProviderDefaultErrorResponse, pipeline_response + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AnalysisResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + analysis.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}/analyze" + } diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_operations.py index 37b11a832238..26bbdbb22ab5 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_operations.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/aio/operations/_operations.py @@ -54,9 +54,9 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationResult"]: - """List all operations provided by Nginx.NginxPlus for the 2023-04-01 api version. + """List all operations provided by Nginx.NginxPlus for the 2024-01-01-preview api version. - List all operations provided by Nginx.NginxPlus for the 2023-04-01 api version. + List all operations provided by Nginx.NginxPlus for the 2024-01-01-preview api version. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationResult or the result of cls(response) diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/__init__.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/__init__.py index 1302846471ae..24963eddd148 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/__init__.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/__init__.py @@ -6,9 +6,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._models_py3 import ErrorResponseBody +from ._models_py3 import AnalysisCreate +from ._models_py3 import AnalysisCreateConfig +from ._models_py3 import AnalysisDiagnostic +from ._models_py3 import AnalysisResult +from ._models_py3 import AnalysisResultData +from ._models_py3 import AutoUpgradeProfile +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail from ._models_py3 import IdentityProperties from ._models_py3 import NginxCertificate +from ._models_py3 import NginxCertificateErrorResponseBody from ._models_py3 import NginxCertificateListResponse from ._models_py3 import NginxCertificateProperties from ._models_py3 import NginxConfiguration @@ -35,6 +43,8 @@ from ._models_py3 import OperationResult from ._models_py3 import ResourceProviderDefaultErrorResponse from ._models_py3 import ResourceSku +from ._models_py3 import ScaleProfile +from ._models_py3 import ScaleProfileCapacity from ._models_py3 import SystemData from ._models_py3 import UserIdentityProperties @@ -47,9 +57,17 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ErrorResponseBody", + "AnalysisCreate", + "AnalysisCreateConfig", + "AnalysisDiagnostic", + "AnalysisResult", + "AnalysisResultData", + "AutoUpgradeProfile", + "ErrorAdditionalInfo", + "ErrorDetail", "IdentityProperties", "NginxCertificate", + "NginxCertificateErrorResponseBody", "NginxCertificateListResponse", "NginxCertificateProperties", "NginxConfiguration", @@ -76,6 +94,8 @@ "OperationResult", "ResourceProviderDefaultErrorResponse", "ResourceSku", + "ScaleProfile", + "ScaleProfileCapacity", "SystemData", "UserIdentityProperties", "CreatedByType", diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/_models_py3.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/_models_py3.py index 6ce745228f64..ed39c7da7c60 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/_models_py3.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/models/_models_py3.py @@ -17,50 +17,305 @@ from .. import models as _models -class ErrorResponseBody(_serialization.Model): - """ErrorResponseBody. +class AnalysisCreate(_serialization.Model): + """The request body for creating an analysis for an NGINX configuration. - :ivar code: - :vartype code: str - :ivar message: + All required parameters must be populated in order to send to Azure. + + :ivar config: Required. + :vartype config: ~azure.mgmt.nginx.models.AnalysisCreateConfig + """ + + _validation = { + "config": {"required": True}, + } + + _attribute_map = { + "config": {"key": "config", "type": "AnalysisCreateConfig"}, + } + + def __init__(self, *, config: "_models.AnalysisCreateConfig", **kwargs: Any) -> None: + """ + :keyword config: Required. + :paramtype config: ~azure.mgmt.nginx.models.AnalysisCreateConfig + """ + super().__init__(**kwargs) + self.config = config + + +class AnalysisCreateConfig(_serialization.Model): + """AnalysisCreateConfig. + + :ivar root_file: The root file of the NGINX config file(s). It must match one of the files' + filepath. + :vartype root_file: str + :ivar files: + :vartype files: list[~azure.mgmt.nginx.models.NginxConfigurationFile] + :ivar protected_files: + :vartype protected_files: list[~azure.mgmt.nginx.models.NginxConfigurationFile] + :ivar package: + :vartype package: ~azure.mgmt.nginx.models.NginxConfigurationPackage + """ + + _attribute_map = { + "root_file": {"key": "rootFile", "type": "str"}, + "files": {"key": "files", "type": "[NginxConfigurationFile]"}, + "protected_files": {"key": "protectedFiles", "type": "[NginxConfigurationFile]"}, + "package": {"key": "package", "type": "NginxConfigurationPackage"}, + } + + def __init__( + self, + *, + root_file: Optional[str] = None, + files: Optional[List["_models.NginxConfigurationFile"]] = None, + protected_files: Optional[List["_models.NginxConfigurationFile"]] = None, + package: Optional["_models.NginxConfigurationPackage"] = None, + **kwargs: Any + ) -> None: + """ + :keyword root_file: The root file of the NGINX config file(s). It must match one of the files' + filepath. + :paramtype root_file: str + :keyword files: + :paramtype files: list[~azure.mgmt.nginx.models.NginxConfigurationFile] + :keyword protected_files: + :paramtype protected_files: list[~azure.mgmt.nginx.models.NginxConfigurationFile] + :keyword package: + :paramtype package: ~azure.mgmt.nginx.models.NginxConfigurationPackage + """ + super().__init__(**kwargs) + self.root_file = root_file + self.files = files + self.protected_files = protected_files + self.package = package + + +class AnalysisDiagnostic(_serialization.Model): + """An error object found during the analysis of an NGINX configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Unique identifier for the error. + :vartype id: str + :ivar directive: Required. + :vartype directive: str + :ivar description: Required. + :vartype description: str + :ivar file: the filepath of the most relevant config file. Required. + :vartype file: str + :ivar line: Required. + :vartype line: float + :ivar message: Required. :vartype message: str - :ivar target: - :vartype target: str - :ivar details: - :vartype details: list[~azure.mgmt.nginx.models.ErrorResponseBody] + :ivar rule: Required. + :vartype rule: str """ + _validation = { + "directive": {"required": True}, + "description": {"required": True}, + "file": {"required": True}, + "line": {"required": True}, + "message": {"required": True}, + "rule": {"required": True}, + } + _attribute_map = { - "code": {"key": "code", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "directive": {"key": "directive", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "file": {"key": "file", "type": "str"}, + "line": {"key": "line", "type": "float"}, "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[ErrorResponseBody]"}, + "rule": {"key": "rule", "type": "str"}, } def __init__( self, *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["_models.ErrorResponseBody"]] = None, + directive: str, + description: str, + file: str, + line: float, + message: str, + rule: str, + id: Optional[str] = None, # pylint: disable=redefined-builtin **kwargs: Any ) -> None: """ - :keyword code: - :paramtype code: str - :keyword message: + :keyword id: Unique identifier for the error. + :paramtype id: str + :keyword directive: Required. + :paramtype directive: str + :keyword description: Required. + :paramtype description: str + :keyword file: the filepath of the most relevant config file. Required. + :paramtype file: str + :keyword line: Required. + :paramtype line: float + :keyword message: Required. :paramtype message: str - :keyword target: - :paramtype target: str - :keyword details: - :paramtype details: list[~azure.mgmt.nginx.models.ErrorResponseBody] + :keyword rule: Required. + :paramtype rule: str """ super().__init__(**kwargs) - self.code = code + self.id = id + self.directive = directive + self.description = description + self.file = file + self.line = line self.message = message - self.target = target - self.details = details + self.rule = rule + + +class AnalysisResult(_serialization.Model): + """The response body for an analysis request. Contains the status of the analysis and any errors. + + All required parameters must be populated in order to send to Azure. + + :ivar status: The status of the analysis. Required. + :vartype status: str + :ivar data: + :vartype data: ~azure.mgmt.nginx.models.AnalysisResultData + """ + + _validation = { + "status": {"required": True}, + } + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + "data": {"key": "data", "type": "AnalysisResultData"}, + } + + def __init__(self, *, status: str, data: Optional["_models.AnalysisResultData"] = None, **kwargs: Any) -> None: + """ + :keyword status: The status of the analysis. Required. + :paramtype status: str + :keyword data: + :paramtype data: ~azure.mgmt.nginx.models.AnalysisResultData + """ + super().__init__(**kwargs) + self.status = status + self.data = data + + +class AnalysisResultData(_serialization.Model): + """AnalysisResultData. + + :ivar errors: + :vartype errors: list[~azure.mgmt.nginx.models.AnalysisDiagnostic] + """ + + _attribute_map = { + "errors": {"key": "errors", "type": "[AnalysisDiagnostic]"}, + } + + def __init__(self, *, errors: Optional[List["_models.AnalysisDiagnostic"]] = None, **kwargs: Any) -> None: + """ + :keyword errors: + :paramtype errors: list[~azure.mgmt.nginx.models.AnalysisDiagnostic] + """ + super().__init__(**kwargs) + self.errors = errors + + +class AutoUpgradeProfile(_serialization.Model): + """Autoupgrade settings of a deployment. + + All required parameters must be populated in order to send to Azure. + + :ivar upgrade_channel: Channel used for autoupgrade. Required. + :vartype upgrade_channel: str + """ + + _validation = { + "upgrade_channel": {"required": True}, + } + + _attribute_map = { + "upgrade_channel": {"key": "upgradeChannel", "type": "str"}, + } + + def __init__(self, *, upgrade_channel: str, **kwargs: Any) -> None: + """ + :keyword upgrade_channel: Channel used for autoupgrade. Required. + :paramtype upgrade_channel: str + """ + super().__init__(**kwargs) + self.upgrade_channel = upgrade_channel + + +class ErrorAdditionalInfo(_serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: JSON + """ + + _validation = { + "type": {"readonly": True}, + "info": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(_serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.nginx.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.nginx.models.ErrorAdditionalInfo] + """ + + _validation = { + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ErrorDetail]"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None class IdentityProperties(_serialization.Model): @@ -169,6 +424,32 @@ def __init__( self.system_data = None +class NginxCertificateErrorResponseBody(_serialization.Model): + """NginxCertificateErrorResponseBody. + + :ivar code: + :vartype code: str + :ivar message: + :vartype message: str + """ + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword code: + :paramtype code: str + :keyword message: + :paramtype message: str + """ + super().__init__(**kwargs) + self.code = code + self.message = message + + class NginxCertificateListResponse(_serialization.Model): """NginxCertificateListResponse. @@ -215,10 +496,21 @@ class NginxCertificateProperties(_serialization.Model): :vartype certificate_virtual_path: str :ivar key_vault_secret_id: :vartype key_vault_secret_id: str + :ivar sha1_thumbprint: + :vartype sha1_thumbprint: str + :ivar key_vault_secret_version: + :vartype key_vault_secret_version: str + :ivar key_vault_secret_created: + :vartype key_vault_secret_created: ~datetime.datetime + :ivar certificate_error: + :vartype certificate_error: ~azure.mgmt.nginx.models.NginxCertificateErrorResponseBody """ _validation = { "provisioning_state": {"readonly": True}, + "sha1_thumbprint": {"readonly": True}, + "key_vault_secret_version": {"readonly": True}, + "key_vault_secret_created": {"readonly": True}, } _attribute_map = { @@ -226,6 +518,10 @@ class NginxCertificateProperties(_serialization.Model): "key_virtual_path": {"key": "keyVirtualPath", "type": "str"}, "certificate_virtual_path": {"key": "certificateVirtualPath", "type": "str"}, "key_vault_secret_id": {"key": "keyVaultSecretId", "type": "str"}, + "sha1_thumbprint": {"key": "sha1Thumbprint", "type": "str"}, + "key_vault_secret_version": {"key": "keyVaultSecretVersion", "type": "str"}, + "key_vault_secret_created": {"key": "keyVaultSecretCreated", "type": "iso-8601"}, + "certificate_error": {"key": "certificateError", "type": "NginxCertificateErrorResponseBody"}, } def __init__( @@ -234,6 +530,7 @@ def __init__( key_virtual_path: Optional[str] = None, certificate_virtual_path: Optional[str] = None, key_vault_secret_id: Optional[str] = None, + certificate_error: Optional["_models.NginxCertificateErrorResponseBody"] = None, **kwargs: Any ) -> None: """ @@ -243,12 +540,18 @@ def __init__( :paramtype certificate_virtual_path: str :keyword key_vault_secret_id: :paramtype key_vault_secret_id: str + :keyword certificate_error: + :paramtype certificate_error: ~azure.mgmt.nginx.models.NginxCertificateErrorResponseBody """ super().__init__(**kwargs) self.provisioning_state = None self.key_virtual_path = key_virtual_path self.certificate_virtual_path = certificate_virtual_path self.key_vault_secret_id = key_vault_secret_id + self.sha1_thumbprint = None + self.key_vault_secret_version = None + self.key_vault_secret_created = None + self.certificate_error = certificate_error class NginxConfiguration(_serialization.Model): @@ -578,8 +881,10 @@ class NginxDeploymentProperties(_serialization.Model): :vartype enable_diagnostics_support: bool :ivar logging: :vartype logging: ~azure.mgmt.nginx.models.NginxLogging - :ivar scaling_properties: + :ivar scaling_properties: Information on how the deployment will be scaled. :vartype scaling_properties: ~azure.mgmt.nginx.models.NginxDeploymentScalingProperties + :ivar auto_upgrade_profile: Autoupgrade settings of a deployment. + :vartype auto_upgrade_profile: ~azure.mgmt.nginx.models.AutoUpgradeProfile :ivar user_profile: :vartype user_profile: ~azure.mgmt.nginx.models.NginxDeploymentUserProfile """ @@ -599,6 +904,7 @@ class NginxDeploymentProperties(_serialization.Model): "enable_diagnostics_support": {"key": "enableDiagnosticsSupport", "type": "bool"}, "logging": {"key": "logging", "type": "NginxLogging"}, "scaling_properties": {"key": "scalingProperties", "type": "NginxDeploymentScalingProperties"}, + "auto_upgrade_profile": {"key": "autoUpgradeProfile", "type": "AutoUpgradeProfile"}, "user_profile": {"key": "userProfile", "type": "NginxDeploymentUserProfile"}, } @@ -610,6 +916,7 @@ def __init__( enable_diagnostics_support: Optional[bool] = None, logging: Optional["_models.NginxLogging"] = None, scaling_properties: Optional["_models.NginxDeploymentScalingProperties"] = None, + auto_upgrade_profile: Optional["_models.AutoUpgradeProfile"] = None, user_profile: Optional["_models.NginxDeploymentUserProfile"] = None, **kwargs: Any ) -> None: @@ -623,8 +930,10 @@ def __init__( :paramtype enable_diagnostics_support: bool :keyword logging: :paramtype logging: ~azure.mgmt.nginx.models.NginxLogging - :keyword scaling_properties: + :keyword scaling_properties: Information on how the deployment will be scaled. :paramtype scaling_properties: ~azure.mgmt.nginx.models.NginxDeploymentScalingProperties + :keyword auto_upgrade_profile: Autoupgrade settings of a deployment. + :paramtype auto_upgrade_profile: ~azure.mgmt.nginx.models.AutoUpgradeProfile :keyword user_profile: :paramtype user_profile: ~azure.mgmt.nginx.models.NginxDeploymentUserProfile """ @@ -637,27 +946,36 @@ def __init__( self.enable_diagnostics_support = enable_diagnostics_support self.logging = logging self.scaling_properties = scaling_properties + self.auto_upgrade_profile = auto_upgrade_profile self.user_profile = user_profile class NginxDeploymentScalingProperties(_serialization.Model): - """NginxDeploymentScalingProperties. + """Information on how the deployment will be scaled. :ivar capacity: :vartype capacity: int + :ivar profiles: + :vartype profiles: list[~azure.mgmt.nginx.models.ScaleProfile] """ _attribute_map = { "capacity": {"key": "capacity", "type": "int"}, + "profiles": {"key": "autoScaleSettings.profiles", "type": "[ScaleProfile]"}, } - def __init__(self, *, capacity: Optional[int] = None, **kwargs: Any) -> None: + def __init__( + self, *, capacity: Optional[int] = None, profiles: Optional[List["_models.ScaleProfile"]] = None, **kwargs: Any + ) -> None: """ :keyword capacity: :paramtype capacity: int + :keyword profiles: + :paramtype profiles: list[~azure.mgmt.nginx.models.ScaleProfile] """ super().__init__(**kwargs) self.capacity = capacity + self.profiles = profiles class NginxDeploymentUpdateParameters(_serialization.Model): @@ -720,10 +1038,12 @@ class NginxDeploymentUpdateProperties(_serialization.Model): :vartype enable_diagnostics_support: bool :ivar logging: :vartype logging: ~azure.mgmt.nginx.models.NginxLogging - :ivar scaling_properties: + :ivar scaling_properties: Information on how the deployment will be scaled. :vartype scaling_properties: ~azure.mgmt.nginx.models.NginxDeploymentScalingProperties :ivar user_profile: :vartype user_profile: ~azure.mgmt.nginx.models.NginxDeploymentUserProfile + :ivar auto_upgrade_profile: Autoupgrade settings of a deployment. + :vartype auto_upgrade_profile: ~azure.mgmt.nginx.models.AutoUpgradeProfile """ _attribute_map = { @@ -731,6 +1051,7 @@ class NginxDeploymentUpdateProperties(_serialization.Model): "logging": {"key": "logging", "type": "NginxLogging"}, "scaling_properties": {"key": "scalingProperties", "type": "NginxDeploymentScalingProperties"}, "user_profile": {"key": "userProfile", "type": "NginxDeploymentUserProfile"}, + "auto_upgrade_profile": {"key": "autoUpgradeProfile", "type": "AutoUpgradeProfile"}, } def __init__( @@ -740,6 +1061,7 @@ def __init__( logging: Optional["_models.NginxLogging"] = None, scaling_properties: Optional["_models.NginxDeploymentScalingProperties"] = None, user_profile: Optional["_models.NginxDeploymentUserProfile"] = None, + auto_upgrade_profile: Optional["_models.AutoUpgradeProfile"] = None, **kwargs: Any ) -> None: """ @@ -747,16 +1069,19 @@ def __init__( :paramtype enable_diagnostics_support: bool :keyword logging: :paramtype logging: ~azure.mgmt.nginx.models.NginxLogging - :keyword scaling_properties: + :keyword scaling_properties: Information on how the deployment will be scaled. :paramtype scaling_properties: ~azure.mgmt.nginx.models.NginxDeploymentScalingProperties :keyword user_profile: :paramtype user_profile: ~azure.mgmt.nginx.models.NginxDeploymentUserProfile + :keyword auto_upgrade_profile: Autoupgrade settings of a deployment. + :paramtype auto_upgrade_profile: ~azure.mgmt.nginx.models.AutoUpgradeProfile """ super().__init__(**kwargs) self.enable_diagnostics_support = enable_diagnostics_support self.logging = logging self.scaling_properties = scaling_properties self.user_profile = user_profile + self.auto_upgrade_profile = auto_upgrade_profile class NginxDeploymentUserProfile(_serialization.Model): @@ -1099,18 +1424,18 @@ def __init__( class ResourceProviderDefaultErrorResponse(_serialization.Model): """ResourceProviderDefaultErrorResponse. - :ivar error: - :vartype error: ~azure.mgmt.nginx.models.ErrorResponseBody + :ivar error: The error detail. + :vartype error: ~azure.mgmt.nginx.models.ErrorDetail """ _attribute_map = { - "error": {"key": "error", "type": "ErrorResponseBody"}, + "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorResponseBody"] = None, **kwargs: Any) -> None: + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ - :keyword error: - :paramtype error: ~azure.mgmt.nginx.models.ErrorResponseBody + :keyword error: The error detail. + :paramtype error: ~azure.mgmt.nginx.models.ErrorDetail """ super().__init__(**kwargs) self.error = error @@ -1142,6 +1467,78 @@ def __init__(self, *, name: str, **kwargs: Any) -> None: self.name = name +class ScaleProfile(_serialization.Model): + """The autoscale profile. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. + :vartype name: str + :ivar capacity: The capacity parameters of the profile. Required. + :vartype capacity: ~azure.mgmt.nginx.models.ScaleProfileCapacity + """ + + _validation = { + "name": {"required": True}, + "capacity": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "capacity": {"key": "capacity", "type": "ScaleProfileCapacity"}, + } + + def __init__(self, *, name: str, capacity: "_models.ScaleProfileCapacity", **kwargs: Any) -> None: + """ + :keyword name: Required. + :paramtype name: str + :keyword capacity: The capacity parameters of the profile. Required. + :paramtype capacity: ~azure.mgmt.nginx.models.ScaleProfileCapacity + """ + super().__init__(**kwargs) + self.name = name + self.capacity = capacity + + +class ScaleProfileCapacity(_serialization.Model): + """The capacity parameters of the profile. + + All required parameters must be populated in order to send to Azure. + + :ivar min: The minimum number of NCUs the deployment can be autoscaled to. Required. + :vartype min: int + :ivar max: The maximum number of NCUs the deployment can be autoscaled to. Required. + :vartype max: int + """ + + _validation = { + "min": {"required": True, "minimum": 0}, + "max": {"required": True, "minimum": 0}, + } + + _attribute_map = { + "min": {"key": "min", "type": "int"}, + "max": {"key": "max", "type": "int"}, + } + + def __init__( + self, + *, + min: int, # pylint: disable=redefined-builtin + max: int, # pylint: disable=redefined-builtin + **kwargs: Any + ) -> None: + """ + :keyword min: The minimum number of NCUs the deployment can be autoscaled to. Required. + :paramtype min: int + :keyword max: The maximum number of NCUs the deployment can be autoscaled to. Required. + :paramtype max: int + """ + super().__init__(**kwargs) + self.min = min + self.max = max + + class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_certificates_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_certificates_operations.py index d522e1e1489c..c9dc0626a855 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_certificates_operations.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_certificates_operations.py @@ -45,7 +45,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,12 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "deploymentName": _SERIALIZER.url( + "deployment_name", + deployment_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), } @@ -79,7 +84,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -93,7 +98,12 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "deploymentName": _SERIALIZER.url( + "deployment_name", + deployment_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), } @@ -116,7 +126,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +139,12 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "deploymentName": _SERIALIZER.url( + "deployment_name", + deployment_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), } @@ -150,7 +165,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -163,7 +178,12 @@ def build_list_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "deploymentName": _SERIALIZER.url( + "deployment_name", + deployment_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), } _url: str = _url.format(**path_format_arguments) # type: ignore diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_configurations_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_configurations_operations.py index 63b884548732..4673f8c3c5af 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_configurations_operations.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_configurations_operations.py @@ -45,7 +45,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,12 @@ def build_list_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "deploymentName": _SERIALIZER.url( + "deployment_name", + deployment_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -78,7 +83,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,7 +96,12 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "deploymentName": _SERIALIZER.url( + "deployment_name", + deployment_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), } @@ -112,7 +122,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -126,7 +136,12 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "deploymentName": _SERIALIZER.url( + "deployment_name", + deployment_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), } @@ -149,7 +164,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +177,12 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "deploymentName": _SERIALIZER.url( + "deployment_name", + deployment_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), "configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"), } @@ -177,6 +197,50 @@ def build_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) +def build_analysis_request( + resource_group_name: str, deployment_name: str, configuration_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}/analyze", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "deploymentName": _SERIALIZER.url( + "deployment_name", + deployment_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), + "configurationName": _SERIALIZER.url( + "configuration_name", configuration_name, "str", pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + class ConfigurationsOperations: """ .. warning:: @@ -741,3 +805,170 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- begin_delete.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}" } + + @overload + def analysis( + self, + resource_group_name: str, + deployment_name: str, + configuration_name: str, + body: Optional[_models.AnalysisCreate] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AnalysisResult: + """Analyze an NGINX configuration without applying it to the NGINXaaS deployment. + + Analyze an NGINX configuration without applying it to the NGINXaaS deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param configuration_name: The name of configuration, only 'default' is supported value due to + the singleton of NGINX conf. Required. + :type configuration_name: str + :param body: The NGINX configuration to analyze. Default value is None. + :type body: ~azure.mgmt.nginx.models.AnalysisCreate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AnalysisResult or the result of cls(response) + :rtype: ~azure.mgmt.nginx.models.AnalysisResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def analysis( + self, + resource_group_name: str, + deployment_name: str, + configuration_name: str, + body: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AnalysisResult: + """Analyze an NGINX configuration without applying it to the NGINXaaS deployment. + + Analyze an NGINX configuration without applying it to the NGINXaaS deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param configuration_name: The name of configuration, only 'default' is supported value due to + the singleton of NGINX conf. Required. + :type configuration_name: str + :param body: The NGINX configuration to analyze. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AnalysisResult or the result of cls(response) + :rtype: ~azure.mgmt.nginx.models.AnalysisResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def analysis( + self, + resource_group_name: str, + deployment_name: str, + configuration_name: str, + body: Optional[Union[_models.AnalysisCreate, IO]] = None, + **kwargs: Any + ) -> _models.AnalysisResult: + """Analyze an NGINX configuration without applying it to the NGINXaaS deployment. + + Analyze an NGINX configuration without applying it to the NGINXaaS deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of targeted NGINX deployment. Required. + :type deployment_name: str + :param configuration_name: The name of configuration, only 'default' is supported value due to + the singleton of NGINX conf. Required. + :type configuration_name: str + :param body: The NGINX configuration to analyze. Is either a AnalysisCreate type or a IO type. + Default value is None. + :type body: ~azure.mgmt.nginx.models.AnalysisCreate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AnalysisResult or the result of cls(response) + :rtype: ~azure.mgmt.nginx.models.AnalysisResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AnalysisResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "AnalysisCreate") + else: + _json = None + + request = build_analysis_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + configuration_name=configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.analysis.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ResourceProviderDefaultErrorResponse, pipeline_response + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AnalysisResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + analysis.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}/analyze" + } diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_deployments_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_deployments_operations.py index 22bdd606d934..cc9db174ef0d 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_deployments_operations.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_deployments_operations.py @@ -45,7 +45,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,12 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "deploymentName": _SERIALIZER.url( + "deployment_name", + deployment_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -78,7 +83,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -92,7 +97,12 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "deploymentName": _SERIALIZER.url( + "deployment_name", + deployment_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -114,7 +124,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +138,12 @@ def build_update_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "deploymentName": _SERIALIZER.url( + "deployment_name", + deployment_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -150,7 +165,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -163,7 +178,12 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "deploymentName": _SERIALIZER.url( + "deployment_name", + deployment_name, + "str", + pattern=r"^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$", + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -181,7 +201,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -205,7 +225,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_operations.py b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_operations.py index f671fb0ec389..d5633da690af 100644 --- a/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_operations.py +++ b/sdk/nginx/azure-mgmt-nginx/azure/mgmt/nginx/operations/_operations.py @@ -40,7 +40,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,9 +76,9 @@ def __init__(self, *args, **kwargs): @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.OperationResult"]: - """List all operations provided by Nginx.NginxPlus for the 2023-04-01 api version. + """List all operations provided by Nginx.NginxPlus for the 2024-01-01-preview api version. - List all operations provided by Nginx.NginxPlus for the 2023-04-01 api version. + List all operations provided by Nginx.NginxPlus for the 2024-01-01-preview api version. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationResult or the result of cls(response) diff --git a/sdk/nginx/azure-mgmt-nginx/dev_requirements.txt b/sdk/nginx/azure-mgmt-nginx/dev_requirements.txt index c7c93cfae649..13fd500db73c 100644 --- a/sdk/nginx/azure-mgmt-nginx/dev_requirements.txt +++ b/sdk/nginx/azure-mgmt-nginx/dev_requirements.txt @@ -1,2 +1,3 @@ -e ../../../tools/azure-sdk-tools -e ../../../tools/azure-devtools +-e ../../resources/azure-mgmt-resource \ No newline at end of file diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_create_or_update.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_create_or_update.py index cc6efdd485a4..095c62e3c31a 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_create_or_update.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_create_or_update.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Certificates_CreateOrUpdate.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Certificates_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_delete.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_delete.py index 14a0069beb54..0bd43015a596 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_delete.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Certificates_Delete.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Certificates_Delete.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_get.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_get.py index b79e99312552..26ad825c6067 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_get.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Certificates_Get.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Certificates_Get.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_list.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_list.py index f334853ba72a..fcbf5202e020 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_list.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/certificates_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Certificates_List.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Certificates_List.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_analysis.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_analysis.py new file mode 100644 index 000000000000..e27437012406 --- /dev/null +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_analysis.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.nginx import NginxManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-nginx +# USAGE + python configurations_analysis.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NginxManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.configurations.analysis( + resource_group_name="myResourceGroup", + deployment_name="myDeployment", + configuration_name="default", + ) + print(response) + + +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Configurations_Analysis.json +if __name__ == "__main__": + main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_create_or_update.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_create_or_update.py index 0a048c73c91a..a81ccc161a3a 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_create_or_update.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_create_or_update.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Configurations_CreateOrUpdate.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Configurations_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_delete.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_delete.py index e957ddd3ba40..cb434e014f1b 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_delete.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Configurations_Delete.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Configurations_Delete.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_get.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_get.py index 308f7ae90bf3..907d11453321 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_get.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Configurations_Get.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Configurations_Get.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_list.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_list.py index f941ce10b673..40a9ee9fc58f 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_list.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/configurations_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Configurations_List.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Configurations_List.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_create.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_create.py index bbe3597550e8..9fb508e1b455 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_create.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_create.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Deployments_Create.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Deployments_Create.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_delete.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_delete.py index f805dd9a1438..9a94d03d3152 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_delete.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Deployments_Delete.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Deployments_Delete.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_get.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_get.py index 9c33bbbcdaa9..bfd8e1f9c466 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_get.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Deployments_Get.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Deployments_Get.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_get_auto_scale.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_get_auto_scale.py new file mode 100644 index 000000000000..95ee4e370726 --- /dev/null +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_get_auto_scale.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.nginx import NginxManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-nginx +# USAGE + python deployments_get_auto_scale.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = NginxManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.deployments.get( + resource_group_name="myResourceGroup", + deployment_name="myDeployment", + ) + print(response) + + +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Deployments_Get_AutoScale.json +if __name__ == "__main__": + main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_list.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_list.py index 1b173a484d75..3fc2df8f69bd 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_list.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Deployments_List.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Deployments_List.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_list_by_resource_group.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_list_by_resource_group.py index 14ca1fb3b903..89054dbad138 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_list_by_resource_group.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Deployments_ListByResourceGroup.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Deployments_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_update.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_update.py index b99ff331f328..6ba62b0a1da7 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_update.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/deployments_update.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Deployments_Update.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Deployments_Update.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/generated_samples/operations_list.py b/sdk/nginx/azure-mgmt-nginx/generated_samples/operations_list.py index b7a8f136259a..28ca0fb9441e 100644 --- a/sdk/nginx/azure-mgmt-nginx/generated_samples/operations_list.py +++ b/sdk/nginx/azure-mgmt-nginx/generated_samples/operations_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/stable/2023-04-01/examples/Operations_List.json +# x-ms-original-file: specification/nginx/resource-manager/NGINX.NGINXPLUS/preview/2024-01-01-preview/examples/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/nginx/azure-mgmt-nginx/sdk_packaging.toml b/sdk/nginx/azure-mgmt-nginx/sdk_packaging.toml index d9ef2bb86842..0548c1ef0a84 100644 --- a/sdk/nginx/azure-mgmt-nginx/sdk_packaging.toml +++ b/sdk/nginx/azure-mgmt-nginx/sdk_packaging.toml @@ -3,7 +3,7 @@ package_name = "azure-mgmt-nginx" package_nspkg = "azure-mgmt-nspkg" package_pprint_name = "Nginx Management" package_doc_id = "" -is_stable = true +is_stable = false is_arm = true need_msrestazure = false need_azuremgmtcore = true diff --git a/sdk/nginx/azure-mgmt-nginx/setup.py b/sdk/nginx/azure-mgmt-nginx/setup.py index 47ce7c7bad2a..f15b5f6f311e 100644 --- a/sdk/nginx/azure-mgmt-nginx/setup.py +++ b/sdk/nginx/azure-mgmt-nginx/setup.py @@ -49,15 +49,15 @@ url="https://github.com/Azure/azure-sdk-for-python", keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product classifiers=[ - "Development Status :: 5 - Production/Stable", + "Development Status :: 4 - Beta", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "License :: OSI Approved :: MIT License", ], zip_safe=False, @@ -77,7 +77,6 @@ "isodate<1.0.0,>=0.6.1", "azure-common~=1.1", "azure-mgmt-core>=1.3.2,<2.0.0", - "typing-extensions>=4.3.0; python_version<'3.8.0'", ], - python_requires=">=3.7", + python_requires=">=3.8", ) diff --git a/sdk/nginx/azure-mgmt-nginx/tests/conftest.py b/sdk/nginx/azure-mgmt-nginx/tests/conftest.py new file mode 100644 index 000000000000..587e126e50b0 --- /dev/null +++ b/sdk/nginx/azure-mgmt-nginx/tests/conftest.py @@ -0,0 +1,50 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- +import os +import platform +import pytest +import sys + +from dotenv import load_dotenv + +from devtools_testutils import test_proxy, add_general_regex_sanitizer +from devtools_testutils import add_header_regex_sanitizer, add_body_key_sanitizer + +load_dotenv() + +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") + tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=client_secret, value="00000000-0000-0000-0000-000000000000") + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") \ No newline at end of file diff --git a/sdk/nginx/azure-mgmt-nginx/tests/test_cli_mgmt_nginx.py b/sdk/nginx/azure-mgmt-nginx/tests/test_cli_mgmt_nginx.py new file mode 100644 index 000000000000..1871a0cfbcc7 --- /dev/null +++ b/sdk/nginx/azure-mgmt-nginx/tests/test_cli_mgmt_nginx.py @@ -0,0 +1,26 @@ +# coding: utf-8 + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +from azure.mgmt.nginx import NginxManagementClient +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = 'eastus' + +class TestMgmtNginx(AzureMgmtRecordedTestCase): + + def setup_method(self, method): + self.client = self.create_mgmt_client(NginxManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + assert list(self.client.deployments.list_by_resource_group(resource_group.name)) == [] + + @recorded_by_proxy + def test_list_operations(self): + assert list(self.client.operations.list()) diff --git a/sdk/nginx/ci.yml b/sdk/nginx/ci.yml index efb4d5a515dd..3349fde59161 100644 --- a/sdk/nginx/ci.yml +++ b/sdk/nginx/ci.yml @@ -28,6 +28,7 @@ extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: ServiceDirectory: nginx + TestProxy: true Artifacts: - name: azure-mgmt-nginx safeName: azuremgmtnginx