diff --git a/sdk/rdbms/azure-mgmt-rdbms/_meta.json b/sdk/rdbms/azure-mgmt-rdbms/_meta.json index 4a97ab2cdb6c..b14289cbd530 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/_meta.json +++ b/sdk/rdbms/azure-mgmt-rdbms/_meta.json @@ -1,11 +1,11 @@ { - "commit": "85d0d6c98a47a6b6c2c1684cf94cc8e089c3c4ab", + "commit": "ffc6bcedf7cb46d4744dc03696830450eb810ff2", "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/postgresql/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/postgresql/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/postgresql/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_version.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_version.py index 3ebf15e6d16a..e5754a47ce68 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_version.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "10.2.0b11" +VERSION = "1.0.0b1" diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_configuration.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_configuration.py index 25cfe24e4acf..69fb54a9bf86 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_configuration.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_configuration.py @@ -27,16 +27,16 @@ class PostgreSQLManagementClientConfiguration(Configuration): # pylint: disable :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-03-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-06-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(PostgreSQLManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-03-01-preview") + api_version: str = kwargs.pop("api_version", "2023-06-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_postgre_sql_management_client.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_postgre_sql_management_client.py index 146caad06374..b17a6101dbdb 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_postgre_sql_management_client.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_postgre_sql_management_client.py @@ -31,9 +31,15 @@ MigrationsOperations, Operations, PostgreSQLManagementClientOperationsMixin, + PrivateEndpointConnectionOperations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + QuotaUsagesOperations, ReplicasOperations, ServerCapabilitiesOperations, + ServerThreatProtectionSettingsOperations, ServersOperations, + VirtualEndpointsOperations, VirtualNetworkSubnetUsageOperations, ) @@ -77,6 +83,12 @@ class PostgreSQLManagementClient( azure.mgmt.rdbms.postgresql_flexibleservers.operations.FirewallRulesOperations :ivar servers: ServersOperations operations :vartype servers: azure.mgmt.rdbms.postgresql_flexibleservers.operations.ServersOperations + :ivar flexible_server: FlexibleServerOperations operations + :vartype flexible_server: + azure.mgmt.rdbms.postgresql_flexibleservers.operations.FlexibleServerOperations + :ivar ltr_backup_operations: LtrBackupOperationsOperations operations + :vartype ltr_backup_operations: + azure.mgmt.rdbms.postgresql_flexibleservers.operations.LtrBackupOperationsOperations :ivar migrations: MigrationsOperations operations :vartype migrations: azure.mgmt.rdbms.postgresql_flexibleservers.operations.MigrationsOperations @@ -85,26 +97,38 @@ class PostgreSQLManagementClient( :ivar get_private_dns_zone_suffix: GetPrivateDnsZoneSuffixOperations operations :vartype get_private_dns_zone_suffix: azure.mgmt.rdbms.postgresql_flexibleservers.operations.GetPrivateDnsZoneSuffixOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.rdbms.postgresql_flexibleservers.operations.PrivateEndpointConnectionsOperations + :ivar private_endpoint_connection: PrivateEndpointConnectionOperations operations + :vartype private_endpoint_connection: + azure.mgmt.rdbms.postgresql_flexibleservers.operations.PrivateEndpointConnectionOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: + azure.mgmt.rdbms.postgresql_flexibleservers.operations.PrivateLinkResourcesOperations + :ivar quota_usages: QuotaUsagesOperations operations + :vartype quota_usages: + azure.mgmt.rdbms.postgresql_flexibleservers.operations.QuotaUsagesOperations :ivar replicas: ReplicasOperations operations :vartype replicas: azure.mgmt.rdbms.postgresql_flexibleservers.operations.ReplicasOperations :ivar log_files: LogFilesOperations operations :vartype log_files: azure.mgmt.rdbms.postgresql_flexibleservers.operations.LogFilesOperations + :ivar server_threat_protection_settings: ServerThreatProtectionSettingsOperations operations + :vartype server_threat_protection_settings: + azure.mgmt.rdbms.postgresql_flexibleservers.operations.ServerThreatProtectionSettingsOperations + :ivar virtual_endpoints: VirtualEndpointsOperations operations + :vartype virtual_endpoints: + azure.mgmt.rdbms.postgresql_flexibleservers.operations.VirtualEndpointsOperations :ivar virtual_network_subnet_usage: VirtualNetworkSubnetUsageOperations operations :vartype virtual_network_subnet_usage: azure.mgmt.rdbms.postgresql_flexibleservers.operations.VirtualNetworkSubnetUsageOperations - :ivar flexible_server: FlexibleServerOperations operations - :vartype flexible_server: - azure.mgmt.rdbms.postgresql_flexibleservers.operations.FlexibleServerOperations - :ivar ltr_backup_operations: LtrBackupOperationsOperations operations - :vartype ltr_backup_operations: - azure.mgmt.rdbms.postgresql_flexibleservers.operations.LtrBackupOperationsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :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-03-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-06-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 @@ -145,18 +169,34 @@ def __init__( self.databases = DatabasesOperations(self._client, self._config, self._serialize, self._deserialize) self.firewall_rules = FirewallRulesOperations(self._client, self._config, self._serialize, self._deserialize) self.servers = ServersOperations(self._client, self._config, self._serialize, self._deserialize) + self.flexible_server = FlexibleServerOperations(self._client, self._config, self._serialize, self._deserialize) + self.ltr_backup_operations = LtrBackupOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.migrations = MigrationsOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.get_private_dns_zone_suffix = GetPrivateDnsZoneSuffixOperations( self._client, self._config, self._serialize, self._deserialize ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connection = PrivateEndpointConnectionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.quota_usages = QuotaUsagesOperations(self._client, self._config, self._serialize, self._deserialize) self.replicas = ReplicasOperations(self._client, self._config, self._serialize, self._deserialize) self.log_files = LogFilesOperations(self._client, self._config, self._serialize, self._deserialize) - self.virtual_network_subnet_usage = VirtualNetworkSubnetUsageOperations( + self.server_threat_protection_settings = ServerThreatProtectionSettingsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.flexible_server = FlexibleServerOperations(self._client, self._config, self._serialize, self._deserialize) - self.ltr_backup_operations = LtrBackupOperationsOperations( + self.virtual_endpoints = VirtualEndpointsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.virtual_network_subnet_usage = VirtualNetworkSubnetUsageOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_version.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_version.py index 3ebf15e6d16a..e5754a47ce68 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_version.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "10.2.0b11" +VERSION = "1.0.0b1" diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/_configuration.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/_configuration.py index a360d1e66c98..6db210884d91 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/_configuration.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/_configuration.py @@ -27,16 +27,16 @@ class PostgreSQLManagementClientConfiguration(Configuration): # pylint: disable :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-03-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-06-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(PostgreSQLManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-03-01-preview") + api_version: str = kwargs.pop("api_version", "2023-06-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/_postgre_sql_management_client.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/_postgre_sql_management_client.py index 3a193a987fca..5bbff26e2008 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/_postgre_sql_management_client.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/_postgre_sql_management_client.py @@ -31,9 +31,15 @@ MigrationsOperations, Operations, PostgreSQLManagementClientOperationsMixin, + PrivateEndpointConnectionOperations, + PrivateEndpointConnectionsOperations, + PrivateLinkResourcesOperations, + QuotaUsagesOperations, ReplicasOperations, ServerCapabilitiesOperations, + ServerThreatProtectionSettingsOperations, ServersOperations, + VirtualEndpointsOperations, VirtualNetworkSubnetUsageOperations, ) @@ -78,6 +84,12 @@ class PostgreSQLManagementClient( azure.mgmt.rdbms.postgresql_flexibleservers.aio.operations.FirewallRulesOperations :ivar servers: ServersOperations operations :vartype servers: azure.mgmt.rdbms.postgresql_flexibleservers.aio.operations.ServersOperations + :ivar flexible_server: FlexibleServerOperations operations + :vartype flexible_server: + azure.mgmt.rdbms.postgresql_flexibleservers.aio.operations.FlexibleServerOperations + :ivar ltr_backup_operations: LtrBackupOperationsOperations operations + :vartype ltr_backup_operations: + azure.mgmt.rdbms.postgresql_flexibleservers.aio.operations.LtrBackupOperationsOperations :ivar migrations: MigrationsOperations operations :vartype migrations: azure.mgmt.rdbms.postgresql_flexibleservers.aio.operations.MigrationsOperations @@ -86,28 +98,40 @@ class PostgreSQLManagementClient( :ivar get_private_dns_zone_suffix: GetPrivateDnsZoneSuffixOperations operations :vartype get_private_dns_zone_suffix: azure.mgmt.rdbms.postgresql_flexibleservers.aio.operations.GetPrivateDnsZoneSuffixOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.rdbms.postgresql_flexibleservers.aio.operations.PrivateEndpointConnectionsOperations + :ivar private_endpoint_connection: PrivateEndpointConnectionOperations operations + :vartype private_endpoint_connection: + azure.mgmt.rdbms.postgresql_flexibleservers.aio.operations.PrivateEndpointConnectionOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: + azure.mgmt.rdbms.postgresql_flexibleservers.aio.operations.PrivateLinkResourcesOperations + :ivar quota_usages: QuotaUsagesOperations operations + :vartype quota_usages: + azure.mgmt.rdbms.postgresql_flexibleservers.aio.operations.QuotaUsagesOperations :ivar replicas: ReplicasOperations operations :vartype replicas: azure.mgmt.rdbms.postgresql_flexibleservers.aio.operations.ReplicasOperations :ivar log_files: LogFilesOperations operations :vartype log_files: azure.mgmt.rdbms.postgresql_flexibleservers.aio.operations.LogFilesOperations + :ivar server_threat_protection_settings: ServerThreatProtectionSettingsOperations operations + :vartype server_threat_protection_settings: + azure.mgmt.rdbms.postgresql_flexibleservers.aio.operations.ServerThreatProtectionSettingsOperations + :ivar virtual_endpoints: VirtualEndpointsOperations operations + :vartype virtual_endpoints: + azure.mgmt.rdbms.postgresql_flexibleservers.aio.operations.VirtualEndpointsOperations :ivar virtual_network_subnet_usage: VirtualNetworkSubnetUsageOperations operations :vartype virtual_network_subnet_usage: azure.mgmt.rdbms.postgresql_flexibleservers.aio.operations.VirtualNetworkSubnetUsageOperations - :ivar flexible_server: FlexibleServerOperations operations - :vartype flexible_server: - azure.mgmt.rdbms.postgresql_flexibleservers.aio.operations.FlexibleServerOperations - :ivar ltr_backup_operations: LtrBackupOperationsOperations operations - :vartype ltr_backup_operations: - azure.mgmt.rdbms.postgresql_flexibleservers.aio.operations.LtrBackupOperationsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :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-03-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-06-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 @@ -148,18 +172,34 @@ def __init__( self.databases = DatabasesOperations(self._client, self._config, self._serialize, self._deserialize) self.firewall_rules = FirewallRulesOperations(self._client, self._config, self._serialize, self._deserialize) self.servers = ServersOperations(self._client, self._config, self._serialize, self._deserialize) + self.flexible_server = FlexibleServerOperations(self._client, self._config, self._serialize, self._deserialize) + self.ltr_backup_operations = LtrBackupOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.migrations = MigrationsOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.get_private_dns_zone_suffix = GetPrivateDnsZoneSuffixOperations( self._client, self._config, self._serialize, self._deserialize ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connection = PrivateEndpointConnectionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.quota_usages = QuotaUsagesOperations(self._client, self._config, self._serialize, self._deserialize) self.replicas = ReplicasOperations(self._client, self._config, self._serialize, self._deserialize) self.log_files = LogFilesOperations(self._client, self._config, self._serialize, self._deserialize) - self.virtual_network_subnet_usage = VirtualNetworkSubnetUsageOperations( + self.server_threat_protection_settings = ServerThreatProtectionSettingsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.flexible_server = FlexibleServerOperations(self._client, self._config, self._serialize, self._deserialize) - self.ltr_backup_operations = LtrBackupOperationsOperations( + self.virtual_endpoints = VirtualEndpointsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.virtual_network_subnet_usage = VirtualNetworkSubnetUsageOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/__init__.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/__init__.py index 05de2f7447a6..d04efbcbaee9 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/__init__.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/__init__.py @@ -16,15 +16,21 @@ from ._databases_operations import DatabasesOperations from ._firewall_rules_operations import FirewallRulesOperations from ._servers_operations import ServersOperations +from ._flexible_server_operations import FlexibleServerOperations +from ._ltr_backup_operations_operations import LtrBackupOperationsOperations from ._migrations_operations import MigrationsOperations from ._postgre_sql_management_client_operations import PostgreSQLManagementClientOperationsMixin from ._operations import Operations from ._get_private_dns_zone_suffix_operations import GetPrivateDnsZoneSuffixOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_endpoint_connection_operations import PrivateEndpointConnectionOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._quota_usages_operations import QuotaUsagesOperations from ._replicas_operations import ReplicasOperations from ._log_files_operations import LogFilesOperations +from ._server_threat_protection_settings_operations import ServerThreatProtectionSettingsOperations +from ._virtual_endpoints_operations import VirtualEndpointsOperations from ._virtual_network_subnet_usage_operations import VirtualNetworkSubnetUsageOperations -from ._flexible_server_operations import FlexibleServerOperations -from ._ltr_backup_operations_operations import LtrBackupOperationsOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -41,15 +47,21 @@ "DatabasesOperations", "FirewallRulesOperations", "ServersOperations", + "FlexibleServerOperations", + "LtrBackupOperationsOperations", "MigrationsOperations", "PostgreSQLManagementClientOperationsMixin", "Operations", "GetPrivateDnsZoneSuffixOperations", + "PrivateEndpointConnectionsOperations", + "PrivateEndpointConnectionOperations", + "PrivateLinkResourcesOperations", + "QuotaUsagesOperations", "ReplicasOperations", "LogFilesOperations", + "ServerThreatProtectionSettingsOperations", + "VirtualEndpointsOperations", "VirtualNetworkSubnetUsageOperations", - "FlexibleServerOperations", - "LtrBackupOperationsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_private_endpoint_connection_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_private_endpoint_connection_operations.py new file mode 100644 index 000000000000..9e68f15e73d4 --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_private_endpoint_connection_operations.py @@ -0,0 +1,427 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._private_endpoint_connection_operations import build_delete_request, build_update_request +from .._vendor import PostgreSQLManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PrivateEndpointConnectionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.rdbms.postgresql_flexibleservers.aio.PostgreSQLManagementClient`'s + :attr:`private_endpoint_connection` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _update_initial( + self, + resource_group_name: str, + server_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> Optional[_models.PrivateEndpointConnection]: + 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[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") + + request = build_update_request( + resource_group_name=resource_group_name, + server_name=server_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.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, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + server_name: str, + private_endpoint_connection_name: str, + parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection with a given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The required parameters for updating private endpoint connection. Required. + :type parameters: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.PrivateEndpointConnection + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.postgresql_flexibleservers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + server_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection with a given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The required parameters for updating private endpoint connection. Required. + :type parameters: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.postgresql_flexibleservers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + server_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection with a given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The required parameters for updating private endpoint connection. Is either + a PrivateEndpointConnection type or a IO type. Required. + :type parameters: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.PrivateEndpointConnection + 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.postgresql_flexibleservers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _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.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + private_endpoint_connection_name=private_endpoint_connection_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, server_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = 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)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + server_name=server_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, server_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a private endpoint connection with a given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = 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)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + server_name=server_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_private_endpoint_connections_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..0e3ecf8b2aa3 --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,217 @@ +# pylint: disable=too-many-lines +# 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._private_endpoint_connections_operations import build_get_request, build_list_by_server_request +from .._vendor import PostgreSQLManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.rdbms.postgresql_flexibleservers.aio.PostgreSQLManagementClient`'s + :attr:`private_endpoint_connections` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, server_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Gets a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = 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)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + server_name=server_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" + } + + @distributed_trace + def list_by_server( + self, resource_group_name: str, server_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnection"]: + """Gets all private endpoint connections on a server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.postgresql_flexibleservers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = 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)) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_server_request( + resource_group_name=resource_group_name, + server_name=server_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_server.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateEndpointConnections" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_private_link_resources_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..12f9bb8f7a76 --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_private_link_resources_operations.py @@ -0,0 +1,216 @@ +# pylint: disable=too-many-lines +# 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._private_link_resources_operations import build_get_request, build_list_by_server_request +from .._vendor import PostgreSQLManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.rdbms.postgresql_flexibleservers.aio.PostgreSQLManagementClient`'s + :attr:`private_link_resources` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_server( + self, resource_group_name: str, server_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PrivateLinkResource"]: + """Gets the private link resources for PostgreSQL server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.postgresql_flexibleservers.models.PrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = 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)) + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_server_request( + resource_group_name=resource_group_name, + server_name=server_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_server.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateLinkResources" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, server_name: str, group_name: str, **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets a private link resource for PostgreSQL server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param group_name: The name of the private link resource. Required. + :type group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = 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)) + cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + server_name=server_name, + group_name=group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateLinkResources/{groupName}" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_quota_usages_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_quota_usages_operations.py new file mode 100644 index 000000000000..8688c5b2a586 --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_quota_usages_operations.py @@ -0,0 +1,141 @@ +# pylint: disable=too-many-lines +# 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._quota_usages_operations import build_list_request +from .._vendor import PostgreSQLManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class QuotaUsagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.rdbms.postgresql_flexibleservers.aio.PostgreSQLManagementClient`'s + :attr:`quota_usages` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, location_name: str, **kwargs: Any) -> AsyncIterable["_models.QuotaUsage"]: + """Get quota usages at specified location in a given subscription. + + :param location_name: The name of the location. Required. + :type location_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either QuotaUsage or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.postgresql_flexibleservers.models.QuotaUsage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = 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)) + cls: ClsType[_models.QuotaUsagesListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + location_name=location_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("QuotaUsagesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/resourceType/flexibleServers/usages" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_server_threat_protection_settings_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_server_threat_protection_settings_operations.py new file mode 100644 index 000000000000..f42696424141 --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_server_threat_protection_settings_operations.py @@ -0,0 +1,478 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._server_threat_protection_settings_operations import ( + build_create_or_update_request, + build_get_request, + build_list_by_server_request, +) +from .._vendor import PostgreSQLManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ServerThreatProtectionSettingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.rdbms.postgresql_flexibleservers.aio.PostgreSQLManagementClient`'s + :attr:`server_threat_protection_settings` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_server( + self, resource_group_name: str, server_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ServerThreatProtectionSettingsModel"]: + """Get a list of server's Threat Protection state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServerThreatProtectionSettingsModel or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.postgresql_flexibleservers.models.ServerThreatProtectionSettingsModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = 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)) + cls: ClsType[_models.ServerThreatProtectionListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_server_request( + resource_group_name=resource_group_name, + server_name=server_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_server.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ServerThreatProtectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/advancedThreatProtectionSettings" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + server_name: str, + threat_protection_name: Union[str, _models.ThreatProtectionName], + **kwargs: Any + ) -> _models.ServerThreatProtectionSettingsModel: + """Get a server's Advanced Threat Protection settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param threat_protection_name: The name of the Threat Protection state. "Default" Required. + :type threat_protection_name: str or + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ThreatProtectionName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServerThreatProtectionSettingsModel or the result of cls(response) + :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ServerThreatProtectionSettingsModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = 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)) + cls: ClsType[_models.ServerThreatProtectionSettingsModel] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + server_name=server_name, + threat_protection_name=threat_protection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ServerThreatProtectionSettingsModel", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/advancedThreatProtectionSettings/{threatProtectionName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + server_name: str, + threat_protection_name: Union[str, _models.ThreatProtectionName], + parameters: Union[_models.ServerThreatProtectionSettingsModel, IO], + **kwargs: Any + ) -> _models.ServerThreatProtectionSettingsModel: + 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.ServerThreatProtectionSettingsModel] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ServerThreatProtectionSettingsModel") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + server_name=server_name, + threat_protection_name=threat_protection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ServerThreatProtectionSettingsModel", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ServerThreatProtectionSettingsModel", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/advancedThreatProtectionSettings/{threatProtectionName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + server_name: str, + threat_protection_name: Union[str, _models.ThreatProtectionName], + parameters: _models.ServerThreatProtectionSettingsModel, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ServerThreatProtectionSettingsModel]: + """Creates or updates a server's Advanced Threat Protection settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param threat_protection_name: The name of the Threat Protection state. "Default" Required. + :type threat_protection_name: str or + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ThreatProtectionName + :param parameters: The Advanced Threat Protection state for the flexible server. Required. + :type parameters: + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ServerThreatProtectionSettingsModel + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServerThreatProtectionSettingsModel + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.postgresql_flexibleservers.models.ServerThreatProtectionSettingsModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + server_name: str, + threat_protection_name: Union[str, _models.ThreatProtectionName], + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ServerThreatProtectionSettingsModel]: + """Creates or updates a server's Advanced Threat Protection settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param threat_protection_name: The name of the Threat Protection state. "Default" Required. + :type threat_protection_name: str or + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ThreatProtectionName + :param parameters: The Advanced Threat Protection state for the flexible server. Required. + :type parameters: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServerThreatProtectionSettingsModel + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.postgresql_flexibleservers.models.ServerThreatProtectionSettingsModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + server_name: str, + threat_protection_name: Union[str, _models.ThreatProtectionName], + parameters: Union[_models.ServerThreatProtectionSettingsModel, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ServerThreatProtectionSettingsModel]: + """Creates or updates a server's Advanced Threat Protection settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param threat_protection_name: The name of the Threat Protection state. "Default" Required. + :type threat_protection_name: str or + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ThreatProtectionName + :param parameters: The Advanced Threat Protection state for the flexible server. Is either a + ServerThreatProtectionSettingsModel type or a IO type. Required. + :type parameters: + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ServerThreatProtectionSettingsModel 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServerThreatProtectionSettingsModel + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.postgresql_flexibleservers.models.ServerThreatProtectionSettingsModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _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.ServerThreatProtectionSettingsModel] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + threat_protection_name=threat_protection_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ServerThreatProtectionSettingsModel", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/advancedThreatProtectionSettings/{threatProtectionName}" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_virtual_endpoints_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_virtual_endpoints_operations.py new file mode 100644 index 000000000000..89d3b9fe75a7 --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/aio/operations/_virtual_endpoints_operations.py @@ -0,0 +1,853 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._virtual_endpoints_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_server_request, + build_update_request, +) +from .._vendor import PostgreSQLManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class VirtualEndpointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.rdbms.postgresql_flexibleservers.aio.PostgreSQLManagementClient`'s + :attr:`virtual_endpoints` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _create_initial( + self, + resource_group_name: str, + server_name: str, + virtual_endpoint_name: str, + parameters: Union[_models.VirtualEndpointResource, IO], + **kwargs: Any + ) -> Optional[_models.VirtualEndpointResource]: + 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[Optional[_models.VirtualEndpointResource]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "VirtualEndpointResource") + + request = build_create_request( + resource_group_name=resource_group_name, + server_name=server_name, + virtual_endpoint_name=virtual_endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.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, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("VirtualEndpointResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VirtualEndpointResource", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints/{virtualEndpointName}" + } + + @overload + async def begin_create( + self, + resource_group_name: str, + server_name: str, + virtual_endpoint_name: str, + parameters: _models.VirtualEndpointResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualEndpointResource]: + """Creates a new virtual endpoint for PostgreSQL flexible server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param virtual_endpoint_name: The name of the virtual endpoint. Required. + :type virtual_endpoint_name: str + :param parameters: The required parameters for creating or updating virtual endpoints. + Required. + :type parameters: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualEndpointResource + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualEndpointResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualEndpointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + server_name: str, + virtual_endpoint_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualEndpointResource]: + """Creates a new virtual endpoint for PostgreSQL flexible server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param virtual_endpoint_name: The name of the virtual endpoint. Required. + :type virtual_endpoint_name: str + :param parameters: The required parameters for creating or updating virtual endpoints. + Required. + :type parameters: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualEndpointResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualEndpointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + server_name: str, + virtual_endpoint_name: str, + parameters: Union[_models.VirtualEndpointResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualEndpointResource]: + """Creates a new virtual endpoint for PostgreSQL flexible server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param virtual_endpoint_name: The name of the virtual endpoint. Required. + :type virtual_endpoint_name: str + :param parameters: The required parameters for creating or updating virtual endpoints. Is + either a VirtualEndpointResource type or a IO type. Required. + :type parameters: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualEndpointResource + 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualEndpointResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualEndpointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _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.VirtualEndpointResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + server_name=server_name, + virtual_endpoint_name=virtual_endpoint_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualEndpointResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints/{virtualEndpointName}" + } + + async def _update_initial( + self, + resource_group_name: str, + server_name: str, + virtual_endpoint_name: str, + parameters: Union[_models.VirtualEndpointResourceForPatch, IO], + **kwargs: Any + ) -> Optional[_models.VirtualEndpointResource]: + 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[Optional[_models.VirtualEndpointResource]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "VirtualEndpointResourceForPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + server_name=server_name, + virtual_endpoint_name=virtual_endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("VirtualEndpointResource", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints/{virtualEndpointName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + server_name: str, + virtual_endpoint_name: str, + parameters: _models.VirtualEndpointResourceForPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualEndpointResource]: + """Updates an existing virtual endpoint. The request body can contain one to many of the + properties present in the normal virtual endpoint definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param virtual_endpoint_name: The name of the virtual endpoint. Required. + :type virtual_endpoint_name: str + :param parameters: The required parameters for updating a server. Required. + :type parameters: + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualEndpointResourceForPatch + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualEndpointResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualEndpointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + server_name: str, + virtual_endpoint_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualEndpointResource]: + """Updates an existing virtual endpoint. The request body can contain one to many of the + properties present in the normal virtual endpoint definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param virtual_endpoint_name: The name of the virtual endpoint. Required. + :type virtual_endpoint_name: str + :param parameters: The required parameters for updating a server. Required. + :type parameters: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualEndpointResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualEndpointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + server_name: str, + virtual_endpoint_name: str, + parameters: Union[_models.VirtualEndpointResourceForPatch, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualEndpointResource]: + """Updates an existing virtual endpoint. The request body can contain one to many of the + properties present in the normal virtual endpoint definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param virtual_endpoint_name: The name of the virtual endpoint. Required. + :type virtual_endpoint_name: str + :param parameters: The required parameters for updating a server. Is either a + VirtualEndpointResourceForPatch type or a IO type. Required. + :type parameters: + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualEndpointResourceForPatch 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VirtualEndpointResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualEndpointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _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.VirtualEndpointResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + virtual_endpoint_name=virtual_endpoint_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualEndpointResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints/{virtualEndpointName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, server_name: str, virtual_endpoint_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = 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)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + server_name=server_name, + virtual_endpoint_name=virtual_endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints/{virtualEndpointName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, server_name: str, virtual_endpoint_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a virtual endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param virtual_endpoint_name: The name of the virtual endpoint. Required. + :type virtual_endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = 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)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + server_name=server_name, + virtual_endpoint_name=virtual_endpoint_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints/{virtualEndpointName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, server_name: str, virtual_endpoint_name: str, **kwargs: Any + ) -> _models.VirtualEndpointResource: + """Gets information about a virtual endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param virtual_endpoint_name: The name of the virtual endpoint. Required. + :type virtual_endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualEndpointResource or the result of cls(response) + :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualEndpointResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = 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)) + cls: ClsType[_models.VirtualEndpointResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + server_name=server_name, + virtual_endpoint_name=virtual_endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualEndpointResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints/{virtualEndpointName}" + } + + @distributed_trace + def list_by_server( + self, resource_group_name: str, server_name: str, **kwargs: Any + ) -> AsyncIterable["_models.VirtualEndpointResource"]: + """List all the servers in a given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualEndpointResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualEndpointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = 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)) + cls: ClsType[_models.VirtualEndpointsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_server_request( + resource_group_name=resource_group_name, + server_name=server_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_server.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualEndpointsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/models/__init__.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/models/__init__.py index fe6fb8ae7487..519b896fcdd6 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/models/__init__.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/models/__init__.py @@ -25,6 +25,8 @@ from ._models_py3 import DataEncryption from ._models_py3 import Database from ._models_py3 import DatabaseListResult +from ._models_py3 import DbLevelValidationStatus +from ._models_py3 import DbMigrationStatus from ._models_py3 import DbServerMetadata from ._models_py3 import DelegatedSubnetUsage from ._models_py3 import ErrorAdditionalInfo @@ -53,11 +55,21 @@ from ._models_py3 import MigrationStatus from ._models_py3 import MigrationSubStateDetails from ._models_py3 import NameAvailability +from ._models_py3 import NameProperty from ._models_py3 import Network from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import OperationListResult +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionState from ._models_py3 import ProxyResource +from ._models_py3 import QuotaUsage +from ._models_py3 import QuotaUsagesListResult +from ._models_py3 import Replica from ._models_py3 import Resource from ._models_py3 import RestartParameter from ._models_py3 import Server @@ -67,6 +79,8 @@ from ._models_py3 import ServerListResult from ._models_py3 import ServerSku from ._models_py3 import ServerSkuCapability +from ._models_py3 import ServerThreatProtectionListResult +from ._models_py3 import ServerThreatProtectionSettingsModel from ._models_py3 import ServerVersionCapability from ._models_py3 import Sku from ._models_py3 import Storage @@ -77,6 +91,12 @@ from ._models_py3 import TrackedResource from ._models_py3 import UserAssignedIdentity from ._models_py3 import UserIdentity +from ._models_py3 import ValidationDetails +from ._models_py3 import ValidationMessage +from ._models_py3 import ValidationSummaryItem +from ._models_py3 import VirtualEndpointResource +from ._models_py3 import VirtualEndpointResourceForPatch +from ._models_py3 import VirtualEndpointsListResult from ._models_py3 import VirtualNetworkSubnetUsageParameter from ._models_py3 import VirtualNetworkSubnetUsageResult @@ -100,10 +120,12 @@ from ._postgre_sql_management_client_enums import IdentityType from ._postgre_sql_management_client_enums import KeyStatusEnum from ._postgre_sql_management_client_enums import LogicalReplicationOnSourceDbEnum +from ._postgre_sql_management_client_enums import MigrationDbState from ._postgre_sql_management_client_enums import MigrationDetailsLevel from ._postgre_sql_management_client_enums import MigrationListFilter from ._postgre_sql_management_client_enums import MigrationMode from ._postgre_sql_management_client_enums import MigrationNameAvailabilityReason +from ._postgre_sql_management_client_enums import MigrationOption from ._postgre_sql_management_client_enums import MigrationState from ._postgre_sql_management_client_enums import MigrationSubState from ._postgre_sql_management_client_enums import OnlineResizeSupportedEnum @@ -112,17 +134,29 @@ from ._postgre_sql_management_client_enums import OverwriteDbsInTargetEnum from ._postgre_sql_management_client_enums import PasswordAuthEnum from ._postgre_sql_management_client_enums import PrincipalType +from ._postgre_sql_management_client_enums import PrivateEndpointConnectionProvisioningState +from ._postgre_sql_management_client_enums import PrivateEndpointServiceConnectionStatus +from ._postgre_sql_management_client_enums import ReadReplicaPromoteMode +from ._postgre_sql_management_client_enums import ReplicationPromoteOption from ._postgre_sql_management_client_enums import ReplicationRole +from ._postgre_sql_management_client_enums import ReplicationState from ._postgre_sql_management_client_enums import RestrictedEnum from ._postgre_sql_management_client_enums import ServerHAState from ._postgre_sql_management_client_enums import ServerPublicNetworkAccessState from ._postgre_sql_management_client_enums import ServerState from ._postgre_sql_management_client_enums import ServerVersion from ._postgre_sql_management_client_enums import SkuTier +from ._postgre_sql_management_client_enums import SourceType +from ._postgre_sql_management_client_enums import SslMode from ._postgre_sql_management_client_enums import StartDataMigrationEnum from ._postgre_sql_management_client_enums import StorageAutoGrow from ._postgre_sql_management_client_enums import StorageAutoGrowthSupportedEnum +from ._postgre_sql_management_client_enums import StorageType +from ._postgre_sql_management_client_enums import ThreatProtectionName +from ._postgre_sql_management_client_enums import ThreatProtectionState from ._postgre_sql_management_client_enums import TriggerCutoverEnum +from ._postgre_sql_management_client_enums import ValidationState +from ._postgre_sql_management_client_enums import VirtualEndpointType from ._postgre_sql_management_client_enums import ZoneRedundantHaAndGeoBackupSupportedEnum from ._postgre_sql_management_client_enums import ZoneRedundantHaSupportedEnum from ._patch import __all__ as _patch_all @@ -149,6 +183,8 @@ "DataEncryption", "Database", "DatabaseListResult", + "DbLevelValidationStatus", + "DbMigrationStatus", "DbServerMetadata", "DelegatedSubnetUsage", "ErrorAdditionalInfo", @@ -177,11 +213,21 @@ "MigrationStatus", "MigrationSubStateDetails", "NameAvailability", + "NameProperty", "Network", "Operation", "OperationDisplay", "OperationListResult", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourceListResult", + "PrivateLinkServiceConnectionState", "ProxyResource", + "QuotaUsage", + "QuotaUsagesListResult", + "Replica", "Resource", "RestartParameter", "Server", @@ -191,6 +237,8 @@ "ServerListResult", "ServerSku", "ServerSkuCapability", + "ServerThreatProtectionListResult", + "ServerThreatProtectionSettingsModel", "ServerVersionCapability", "Sku", "Storage", @@ -201,6 +249,12 @@ "TrackedResource", "UserAssignedIdentity", "UserIdentity", + "ValidationDetails", + "ValidationMessage", + "ValidationSummaryItem", + "VirtualEndpointResource", + "VirtualEndpointResourceForPatch", + "VirtualEndpointsListResult", "VirtualNetworkSubnetUsageParameter", "VirtualNetworkSubnetUsageResult", "ActiveDirectoryAuthEnum", @@ -223,10 +277,12 @@ "IdentityType", "KeyStatusEnum", "LogicalReplicationOnSourceDbEnum", + "MigrationDbState", "MigrationDetailsLevel", "MigrationListFilter", "MigrationMode", "MigrationNameAvailabilityReason", + "MigrationOption", "MigrationState", "MigrationSubState", "OnlineResizeSupportedEnum", @@ -235,17 +291,29 @@ "OverwriteDbsInTargetEnum", "PasswordAuthEnum", "PrincipalType", + "PrivateEndpointConnectionProvisioningState", + "PrivateEndpointServiceConnectionStatus", + "ReadReplicaPromoteMode", + "ReplicationPromoteOption", "ReplicationRole", + "ReplicationState", "RestrictedEnum", "ServerHAState", "ServerPublicNetworkAccessState", "ServerState", "ServerVersion", "SkuTier", + "SourceType", + "SslMode", "StartDataMigrationEnum", "StorageAutoGrow", "StorageAutoGrowthSupportedEnum", + "StorageType", + "ThreatProtectionName", + "ThreatProtectionState", "TriggerCutoverEnum", + "ValidationState", + "VirtualEndpointType", "ZoneRedundantHaAndGeoBackupSupportedEnum", "ZoneRedundantHaSupportedEnum", ] diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/models/_models_py3.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/models/_models_py3.py index d53ef5c16c4a..20c65b903f9c 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/models/_models_py3.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/models/_models_py3.py @@ -22,8 +22,8 @@ class Resource(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -64,8 +64,8 @@ class ProxyResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -101,8 +101,8 @@ class ActiveDirectoryAdministrator(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -585,8 +585,8 @@ class Configuration(ProxyResource): # pylint: disable=too-many-instance-attribu Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -788,8 +788,8 @@ class Database(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -947,6 +947,188 @@ def __init__( self.geo_backup_encryption_key_status = geo_backup_encryption_key_status +class DbLevelValidationStatus(_serialization.Model): + """Validation status summary for an individual database. + + :ivar database_name: Name of the database. + :vartype database_name: str + :ivar started_on: Start date-time of a database level validation. + :vartype started_on: ~datetime.datetime + :ivar ended_on: End date-time of a database level validation. + :vartype ended_on: ~datetime.datetime + :ivar summary: Summary of database level validations. + :vartype summary: + list[~azure.mgmt.rdbms.postgresql_flexibleservers.models.ValidationSummaryItem] + """ + + _attribute_map = { + "database_name": {"key": "databaseName", "type": "str"}, + "started_on": {"key": "startedOn", "type": "iso-8601"}, + "ended_on": {"key": "endedOn", "type": "iso-8601"}, + "summary": {"key": "summary", "type": "[ValidationSummaryItem]"}, + } + + def __init__( + self, + *, + database_name: Optional[str] = None, + started_on: Optional[datetime.datetime] = None, + ended_on: Optional[datetime.datetime] = None, + summary: Optional[List["_models.ValidationSummaryItem"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword database_name: Name of the database. + :paramtype database_name: str + :keyword started_on: Start date-time of a database level validation. + :paramtype started_on: ~datetime.datetime + :keyword ended_on: End date-time of a database level validation. + :paramtype ended_on: ~datetime.datetime + :keyword summary: Summary of database level validations. + :paramtype summary: + list[~azure.mgmt.rdbms.postgresql_flexibleservers.models.ValidationSummaryItem] + """ + super().__init__(**kwargs) + self.database_name = database_name + self.started_on = started_on + self.ended_on = ended_on + self.summary = summary + + +class DbMigrationStatus(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Migration status of an individual database. + + :ivar database_name: Name of the database. + :vartype database_name: str + :ivar migration_state: Migration db state of an individual database. Known values are: + "InProgress", "WaitingForCutoverTrigger", "Failed", "Canceled", "Succeeded", and "Canceling". + :vartype migration_state: str or + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.MigrationDbState + :ivar migration_operation: Migration operation of an individual database. + :vartype migration_operation: str + :ivar started_on: Start date-time of a migration state. + :vartype started_on: ~datetime.datetime + :ivar ended_on: End date-time of a migration state. + :vartype ended_on: ~datetime.datetime + :ivar full_load_queued_tables: Number of tables queued for the migration of a DB. + :vartype full_load_queued_tables: int + :ivar full_load_errored_tables: Number of tables errored out during the migration of a DB. + :vartype full_load_errored_tables: int + :ivar full_load_loading_tables: Number of tables loading during the migration of a DB. + :vartype full_load_loading_tables: int + :ivar full_load_completed_tables: Number of tables loaded during the migration of a DB. + :vartype full_load_completed_tables: int + :ivar cdc_update_counter: CDC update counter. + :vartype cdc_update_counter: int + :ivar cdc_delete_counter: CDC delete counter. + :vartype cdc_delete_counter: int + :ivar cdc_insert_counter: CDC insert counter. + :vartype cdc_insert_counter: int + :ivar applied_changes: CDC applied changes counter. + :vartype applied_changes: int + :ivar incoming_changes: CDC incoming changes counter. + :vartype incoming_changes: int + :ivar latency: Lag in seconds between source and target during online phase. + :vartype latency: int + :ivar message: Error message, if any, for the migration state. + :vartype message: str + """ + + _attribute_map = { + "database_name": {"key": "databaseName", "type": "str"}, + "migration_state": {"key": "migrationState", "type": "str"}, + "migration_operation": {"key": "migrationOperation", "type": "str"}, + "started_on": {"key": "startedOn", "type": "iso-8601"}, + "ended_on": {"key": "endedOn", "type": "iso-8601"}, + "full_load_queued_tables": {"key": "fullLoadQueuedTables", "type": "int"}, + "full_load_errored_tables": {"key": "fullLoadErroredTables", "type": "int"}, + "full_load_loading_tables": {"key": "fullLoadLoadingTables", "type": "int"}, + "full_load_completed_tables": {"key": "fullLoadCompletedTables", "type": "int"}, + "cdc_update_counter": {"key": "cdcUpdateCounter", "type": "int"}, + "cdc_delete_counter": {"key": "cdcDeleteCounter", "type": "int"}, + "cdc_insert_counter": {"key": "cdcInsertCounter", "type": "int"}, + "applied_changes": {"key": "appliedChanges", "type": "int"}, + "incoming_changes": {"key": "incomingChanges", "type": "int"}, + "latency": {"key": "latency", "type": "int"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__( + self, + *, + database_name: Optional[str] = None, + migration_state: Optional[Union[str, "_models.MigrationDbState"]] = None, + migration_operation: Optional[str] = None, + started_on: Optional[datetime.datetime] = None, + ended_on: Optional[datetime.datetime] = None, + full_load_queued_tables: Optional[int] = None, + full_load_errored_tables: Optional[int] = None, + full_load_loading_tables: Optional[int] = None, + full_load_completed_tables: Optional[int] = None, + cdc_update_counter: Optional[int] = None, + cdc_delete_counter: Optional[int] = None, + cdc_insert_counter: Optional[int] = None, + applied_changes: Optional[int] = None, + incoming_changes: Optional[int] = None, + latency: Optional[int] = None, + message: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword database_name: Name of the database. + :paramtype database_name: str + :keyword migration_state: Migration db state of an individual database. Known values are: + "InProgress", "WaitingForCutoverTrigger", "Failed", "Canceled", "Succeeded", and "Canceling". + :paramtype migration_state: str or + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.MigrationDbState + :keyword migration_operation: Migration operation of an individual database. + :paramtype migration_operation: str + :keyword started_on: Start date-time of a migration state. + :paramtype started_on: ~datetime.datetime + :keyword ended_on: End date-time of a migration state. + :paramtype ended_on: ~datetime.datetime + :keyword full_load_queued_tables: Number of tables queued for the migration of a DB. + :paramtype full_load_queued_tables: int + :keyword full_load_errored_tables: Number of tables errored out during the migration of a DB. + :paramtype full_load_errored_tables: int + :keyword full_load_loading_tables: Number of tables loading during the migration of a DB. + :paramtype full_load_loading_tables: int + :keyword full_load_completed_tables: Number of tables loaded during the migration of a DB. + :paramtype full_load_completed_tables: int + :keyword cdc_update_counter: CDC update counter. + :paramtype cdc_update_counter: int + :keyword cdc_delete_counter: CDC delete counter. + :paramtype cdc_delete_counter: int + :keyword cdc_insert_counter: CDC insert counter. + :paramtype cdc_insert_counter: int + :keyword applied_changes: CDC applied changes counter. + :paramtype applied_changes: int + :keyword incoming_changes: CDC incoming changes counter. + :paramtype incoming_changes: int + :keyword latency: Lag in seconds between source and target during online phase. + :paramtype latency: int + :keyword message: Error message, if any, for the migration state. + :paramtype message: str + """ + super().__init__(**kwargs) + self.database_name = database_name + self.migration_state = migration_state + self.migration_operation = migration_operation + self.started_on = started_on + self.ended_on = ended_on + self.full_load_queued_tables = full_load_queued_tables + self.full_load_errored_tables = full_load_errored_tables + self.full_load_loading_tables = full_load_loading_tables + self.full_load_completed_tables = full_load_completed_tables + self.cdc_update_counter = cdc_update_counter + self.cdc_delete_counter = cdc_delete_counter + self.cdc_insert_counter = cdc_insert_counter + self.applied_changes = applied_changes + self.incoming_changes = incoming_changes + self.latency = latency + self.message = message + + class DbServerMetadata(_serialization.Model): """Database server metadata. @@ -958,7 +1140,7 @@ class DbServerMetadata(_serialization.Model): :vartype version: str :ivar storage_mb: Storage size in MB for database server. :vartype storage_mb: int - :ivar sku: SKU for the database server. + :ivar sku: SKU for the database server. This object is empty for PG single server. :vartype sku: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ServerSku """ @@ -986,7 +1168,7 @@ def __init__( :paramtype version: str :keyword storage_mb: Storage size in MB for database server. :paramtype storage_mb: int - :keyword sku: SKU for the database server. + :keyword sku: SKU for the database server. This object is empty for PG single server. :paramtype sku: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ServerSku """ super().__init__(**kwargs) @@ -1176,8 +1358,8 @@ class FirewallRule(ProxyResource): All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1474,8 +1656,8 @@ class LogFile(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1763,8 +1945,8 @@ class LtrServerBackupOperation(ProxyResource): # pylint: disable=too-many-insta Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2011,8 +2193,8 @@ class TrackedResource(Resource): All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2064,8 +2246,8 @@ class MigrationResource(TrackedResource): # pylint: disable=too-many-instance-a All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2087,13 +2269,27 @@ class MigrationResource(TrackedResource): # pylint: disable=too-many-instance-a are: "Offline" and "Online". :vartype migration_mode: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.MigrationMode + :ivar migration_option: This indicates the supported Migration option for the migration. Known + values are: "Validate", "Migrate", and "ValidateAndMigrate". + :vartype migration_option: str or + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.MigrationOption + :ivar source_type: migration source server type : OnPremises, AWS, GCP, AzureVM or + PostgreSQLSingleServer. Known values are: "OnPremises", "AWS", "GCP", "AzureVM", and + "PostgreSQLSingleServer". + :vartype source_type: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.SourceType + :ivar ssl_mode: SSL modes for migration. Default SSL mode for PostgreSQLSingleServer is + VerifyFull and Prefer for other source types. Known values are: "Prefer", "Require", + "VerifyCA", and "VerifyFull". + :vartype ssl_mode: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.SslMode :ivar source_db_server_metadata: Metadata of the source database server. :vartype source_db_server_metadata: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.DbServerMetadata :ivar target_db_server_metadata: Metadata of the target database server. :vartype target_db_server_metadata: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.DbServerMetadata - :ivar source_db_server_resource_id: ResourceId of the source database server. + :ivar source_db_server_resource_id: ResourceId of the source database server in case the + sourceType is PostgreSQLSingleServer. For other source types this should be + ipaddress:port@username or hostname:port@username. :vartype source_db_server_resource_id: str :ivar source_db_server_fully_qualified_domain_name: Source server fully qualified domain name or ip. It is a optional value, if customer provide it, dms will always use it for connection. @@ -2165,6 +2361,9 @@ class MigrationResource(TrackedResource): # pylint: disable=too-many-instance-a "migration_id": {"key": "properties.migrationId", "type": "str"}, "current_status": {"key": "properties.currentStatus", "type": "MigrationStatus"}, "migration_mode": {"key": "properties.migrationMode", "type": "str"}, + "migration_option": {"key": "properties.migrationOption", "type": "str"}, + "source_type": {"key": "properties.sourceType", "type": "str"}, + "ssl_mode": {"key": "properties.sslMode", "type": "str"}, "source_db_server_metadata": {"key": "properties.sourceDbServerMetadata", "type": "DbServerMetadata"}, "target_db_server_metadata": {"key": "properties.targetDbServerMetadata", "type": "DbServerMetadata"}, "source_db_server_resource_id": {"key": "properties.sourceDbServerResourceId", "type": "str"}, @@ -2199,6 +2398,9 @@ def __init__( # pylint: disable=too-many-locals location: str, tags: Optional[Dict[str, str]] = None, migration_mode: Optional[Union[str, "_models.MigrationMode"]] = None, + migration_option: Optional[Union[str, "_models.MigrationOption"]] = None, + source_type: Optional[Union[str, "_models.SourceType"]] = None, + ssl_mode: Optional[Union[str, "_models.SslMode"]] = None, source_db_server_resource_id: Optional[str] = None, source_db_server_fully_qualified_domain_name: Optional[str] = None, target_db_server_fully_qualified_domain_name: Optional[str] = None, @@ -2226,7 +2428,21 @@ def __init__( # pylint: disable=too-many-locals values are: "Offline" and "Online". :paramtype migration_mode: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.MigrationMode - :keyword source_db_server_resource_id: ResourceId of the source database server. + :keyword migration_option: This indicates the supported Migration option for the migration. + Known values are: "Validate", "Migrate", and "ValidateAndMigrate". + :paramtype migration_option: str or + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.MigrationOption + :keyword source_type: migration source server type : OnPremises, AWS, GCP, AzureVM or + PostgreSQLSingleServer. Known values are: "OnPremises", "AWS", "GCP", "AzureVM", and + "PostgreSQLSingleServer". + :paramtype source_type: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.SourceType + :keyword ssl_mode: SSL modes for migration. Default SSL mode for PostgreSQLSingleServer is + VerifyFull and Prefer for other source types. Known values are: "Prefer", "Require", + "VerifyCA", and "VerifyFull". + :paramtype ssl_mode: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.SslMode + :keyword source_db_server_resource_id: ResourceId of the source database server in case the + sourceType is PostgreSQLSingleServer. For other source types this should be + ipaddress:port@username or hostname:port@username. :paramtype source_db_server_resource_id: str :keyword source_db_server_fully_qualified_domain_name: Source server fully qualified domain name or ip. It is a optional value, if customer provide it, dms will always use it for @@ -2277,6 +2493,9 @@ def __init__( # pylint: disable=too-many-locals self.migration_id = None self.current_status = None self.migration_mode = migration_mode + self.migration_option = migration_option + self.source_type = source_type + self.ssl_mode = ssl_mode self.source_db_server_metadata = None self.target_db_server_metadata = None self.source_db_server_resource_id = source_db_server_resource_id @@ -2557,7 +2776,7 @@ class MigrationStatus(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar state: State of migration. Known values are: "InProgress", "WaitingForUserAction", - "Canceled", "Failed", and "Succeeded". + "Canceled", "Failed", "Succeeded", "ValidationFailed", and "CleaningUp". :vartype state: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.MigrationState :ivar error: Error message, if any, for the migration state. :vartype error: str @@ -2595,9 +2814,16 @@ class MigrationSubStateDetails(_serialization.Model): "WaitingForLogicalReplicationSetupRequestOnSourceDB", "WaitingForDBsToMigrateSpecification", "WaitingForTargetDBOverwriteConfirmation", "WaitingForDataMigrationScheduling", "WaitingForDataMigrationWindow", "MigratingData", "WaitingForCutoverTrigger", - "CompletingMigration", and "Completed". + "CompletingMigration", "Completed", "CancelingRequestedDBMigrations", and + "ValidationInProgress". :vartype current_sub_state: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.MigrationSubState + :ivar db_details: Dictionary of :code:``. + :vartype db_details: dict[str, + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.DbMigrationStatus] + :ivar validation_details: Details for the validation for migration. + :vartype validation_details: + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ValidationDetails """ _validation = { @@ -2606,12 +2832,29 @@ class MigrationSubStateDetails(_serialization.Model): _attribute_map = { "current_sub_state": {"key": "currentSubState", "type": "str"}, + "db_details": {"key": "dbDetails", "type": "{DbMigrationStatus}"}, + "validation_details": {"key": "validationDetails", "type": "ValidationDetails"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, + *, + db_details: Optional[Dict[str, "_models.DbMigrationStatus"]] = None, + validation_details: Optional["_models.ValidationDetails"] = None, + **kwargs: Any + ) -> None: + """ + :keyword db_details: Dictionary of :code:``. + :paramtype db_details: dict[str, + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.DbMigrationStatus] + :keyword validation_details: Details for the validation for migration. + :paramtype validation_details: + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ValidationDetails + """ super().__init__(**kwargs) self.current_sub_state = None + self.db_details = db_details + self.validation_details = validation_details class NameAvailability(CheckNameAvailabilityResponse): @@ -2669,11 +2912,35 @@ def __init__( self.type = None +class NameProperty(_serialization.Model): + """Name property for quota usage. + + :ivar value: Name value. + :vartype value: str + :ivar localized_value: Localized name. + :vartype localized_value: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "str"}, + "localized_value": {"key": "localizedValue", "type": "str"}, + } + + def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: Name value. + :paramtype value: str + :keyword localized_value: Localized name. + :paramtype localized_value: str + """ + super().__init__(**kwargs) + self.value = value + self.localized_value = localized_value + + class Network(_serialization.Model): """Network properties of a server. - Variables are only populated by the server, and will be ignored when sending a request. - :ivar public_network_access: public network access is enabled or not. Known values are: "Enabled" and "Disabled". :vartype public_network_access: str or @@ -2688,10 +2955,6 @@ class Network(_serialization.Model): :vartype private_dns_zone_arm_resource_id: str """ - _validation = { - "public_network_access": {"readonly": True}, - } - _attribute_map = { "public_network_access": {"key": "publicNetworkAccess", "type": "str"}, "delegated_subnet_resource_id": {"key": "delegatedSubnetResourceId", "type": "str"}, @@ -2701,11 +2964,16 @@ class Network(_serialization.Model): def __init__( self, *, + public_network_access: Optional[Union[str, "_models.ServerPublicNetworkAccessState"]] = None, delegated_subnet_resource_id: Optional[str] = None, private_dns_zone_arm_resource_id: Optional[str] = None, **kwargs: Any ) -> None: """ + :keyword public_network_access: public network access is enabled or not. Known values are: + "Enabled" and "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ServerPublicNetworkAccessState :keyword delegated_subnet_resource_id: Delegated subnet arm resource id. This is required to be passed during create, in case we want the server to be VNET injected, i.e. Private access server. During update, pass this only if we want to update the value for Private DNS zone. @@ -2716,7 +2984,7 @@ def __init__( :paramtype private_dns_zone_arm_resource_id: str """ super().__init__(**kwargs) - self.public_network_access = None + self.public_network_access = public_network_access self.delegated_subnet_resource_id = delegated_subnet_resource_id self.private_dns_zone_arm_resource_id = private_dns_zone_arm_resource_id @@ -2835,50 +3103,141 @@ def __init__( self.next_link = next_link -class RestartParameter(_serialization.Model): - """Represents server restart parameters. +class PrivateEndpoint(_serialization.Model): + """The private endpoint resource. - :ivar restart_with_failover: Indicates whether to restart the server with failover. - :vartype restart_with_failover: bool - :ivar failover_mode: Failover mode. Known values are: "PlannedFailover", "ForcedFailover", - "PlannedSwitchover", and "ForcedSwitchover". - :vartype failover_mode: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.FailoverMode + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ARM identifier for private endpoint. + :vartype id: str """ + _validation = { + "id": {"readonly": True}, + } + _attribute_map = { - "restart_with_failover": {"key": "restartWithFailover", "type": "bool"}, - "failover_mode": {"key": "failoverMode", "type": "str"}, + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + + +class PrivateEndpointConnection(Resource): + """The private endpoint connection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.SystemData + :ivar group_ids: The group ids for the private endpoint resource. + :vartype group_ids: list[str] + :ivar private_endpoint: The private endpoint resource. + :vartype private_endpoint: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The provisioning state of the private endpoint connection resource. + Known values are: "Succeeded", "Creating", "Deleting", and "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "group_ids": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "group_ids": {"key": "properties.groupIds", "type": "[str]"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } def __init__( self, *, - restart_with_failover: Optional[bool] = None, - failover_mode: Optional[Union[str, "_models.FailoverMode"]] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs: Any ) -> None: """ - :keyword restart_with_failover: Indicates whether to restart the server with failover. - :paramtype restart_with_failover: bool - :keyword failover_mode: Failover mode. Known values are: "PlannedFailover", "ForcedFailover", - "PlannedSwitchover", and "ForcedSwitchover". - :paramtype failover_mode: str or - ~azure.mgmt.rdbms.postgresql_flexibleservers.models.FailoverMode + :keyword private_endpoint: The private endpoint resource. + :paramtype private_endpoint: + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.PrivateEndpoint + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.PrivateLinkServiceConnectionState """ super().__init__(**kwargs) - self.restart_with_failover = restart_with_failover - self.failover_mode = failover_mode + self.group_ids = None + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = None -class Server(TrackedResource): # pylint: disable=too-many-instance-attributes - """Represents a server. +class PrivateEndpointConnectionListResult(_serialization.Model): + """A list of private endpoint connections. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + :ivar value: Array of results. + :vartype value: + list[~azure.mgmt.rdbms.postgresql_flexibleservers.models.PrivateEndpointConnection] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class PrivateLinkResource(Resource): + """A private link resource. + + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2888,65 +3247,12 @@ class Server(TrackedResource): # pylint: disable=too-many-instance-attributes :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar sku: The SKU (pricing tier) of the server. - :vartype sku: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.Sku - :ivar identity: Describes the identity of the application. - :vartype identity: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.UserAssignedIdentity - :ivar administrator_login: The administrator's login name of a server. Can only be specified - when the server is being created (and is required for creation). - :vartype administrator_login: str - :ivar administrator_login_password: The administrator login password (required for server - creation). - :vartype administrator_login_password: str - :ivar version: PostgreSQL Server version. Known values are: "15", "14", "13", "12", and "11". - :vartype version: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ServerVersion - :ivar minor_version: The minor version of the server. - :vartype minor_version: str - :ivar state: A state of a server that is visible to user. Known values are: "Ready", - "Dropping", "Disabled", "Starting", "Stopping", "Stopped", and "Updating". - :vartype state: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ServerState - :ivar fully_qualified_domain_name: The fully qualified domain name of a server. - :vartype fully_qualified_domain_name: str - :ivar storage: Storage properties of a server. - :vartype storage: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.Storage - :ivar auth_config: AuthConfig properties of a server. - :vartype auth_config: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.AuthConfig - :ivar data_encryption: Data encryption properties of a server. - :vartype data_encryption: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.DataEncryption - :ivar backup: Backup properties of a server. - :vartype backup: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.Backup - :ivar network: Network properties of a server. This Network property is required to be passed - only in case you want the server to be Private access server. - :vartype network: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.Network - :ivar high_availability: High availability properties of a server. - :vartype high_availability: - ~azure.mgmt.rdbms.postgresql_flexibleservers.models.HighAvailability - :ivar maintenance_window: Maintenance window properties of a server. - :vartype maintenance_window: - ~azure.mgmt.rdbms.postgresql_flexibleservers.models.MaintenanceWindow - :ivar source_server_resource_id: The source server resource ID to restore from. It's required - when 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'Replica' or 'ReviveDropped'. This - property is returned only for Replica server. - :vartype source_server_resource_id: str - :ivar point_in_time_utc: Restore point creation time (ISO8601 format), specifying the time to - restore from. It's required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or - 'ReviveDropped'. - :vartype point_in_time_utc: ~datetime.datetime - :ivar availability_zone: availability zone information of the server. - :vartype availability_zone: str - :ivar replication_role: Replication role of the server. Known values are: "None", "Primary", - "AsyncReplica", and "GeoAsyncReplica". - :vartype replication_role: str or - ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ReplicationRole - :ivar replica_capacity: Replicas allowed for a server. - :vartype replica_capacity: int - :ivar create_mode: The mode to create a new PostgreSQL server. Known values are: "Default", - "Create", "Update", "PointInTimeRestore", "GeoRestore", "Replica", and "ReviveDropped". - :vartype create_mode: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.CreateMode + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :ivar required_zone_names: The private link resource private link DNS zone name. + :vartype required_zone_names: list[str] """ _validation = { @@ -2954,11 +3260,8 @@ class Server(TrackedResource): # pylint: disable=too-many-instance-attributes "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "location": {"required": True}, - "minor_version": {"readonly": True}, - "state": {"readonly": True}, - "fully_qualified_domain_name": {"readonly": True}, - "replica_capacity": {"readonly": True}, + "group_id": {"readonly": True}, + "required_members": {"readonly": True}, } _attribute_map = { @@ -2966,52 +3269,437 @@ class Server(TrackedResource): # pylint: disable=too-many-instance-attributes "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "sku": {"key": "sku", "type": "Sku"}, - "identity": {"key": "identity", "type": "UserAssignedIdentity"}, - "administrator_login": {"key": "properties.administratorLogin", "type": "str"}, - "administrator_login_password": {"key": "properties.administratorLoginPassword", "type": "str"}, - "version": {"key": "properties.version", "type": "str"}, - "minor_version": {"key": "properties.minorVersion", "type": "str"}, - "state": {"key": "properties.state", "type": "str"}, - "fully_qualified_domain_name": {"key": "properties.fullyQualifiedDomainName", "type": "str"}, - "storage": {"key": "properties.storage", "type": "Storage"}, - "auth_config": {"key": "properties.authConfig", "type": "AuthConfig"}, - "data_encryption": {"key": "properties.dataEncryption", "type": "DataEncryption"}, - "backup": {"key": "properties.backup", "type": "Backup"}, - "network": {"key": "properties.network", "type": "Network"}, - "high_availability": {"key": "properties.highAvailability", "type": "HighAvailability"}, - "maintenance_window": {"key": "properties.maintenanceWindow", "type": "MaintenanceWindow"}, - "source_server_resource_id": {"key": "properties.sourceServerResourceId", "type": "str"}, - "point_in_time_utc": {"key": "properties.pointInTimeUTC", "type": "iso-8601"}, - "availability_zone": {"key": "properties.availabilityZone", "type": "str"}, - "replication_role": {"key": "properties.replicationRole", "type": "str"}, - "replica_capacity": {"key": "properties.replicaCapacity", "type": "int"}, - "create_mode": {"key": "properties.createMode", "type": "str"}, + "group_id": {"key": "properties.groupId", "type": "str"}, + "required_members": {"key": "properties.requiredMembers", "type": "[str]"}, + "required_zone_names": {"key": "properties.requiredZoneNames", "type": "[str]"}, } - def __init__( # pylint: disable=too-many-locals - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - sku: Optional["_models.Sku"] = None, - identity: Optional["_models.UserAssignedIdentity"] = None, - administrator_login: Optional[str] = None, - administrator_login_password: Optional[str] = None, - version: Optional[Union[str, "_models.ServerVersion"]] = None, - storage: Optional["_models.Storage"] = None, - auth_config: Optional["_models.AuthConfig"] = None, - data_encryption: Optional["_models.DataEncryption"] = None, - backup: Optional["_models.Backup"] = None, - network: Optional["_models.Network"] = None, - high_availability: Optional["_models.HighAvailability"] = None, - maintenance_window: Optional["_models.MaintenanceWindow"] = None, - source_server_resource_id: Optional[str] = None, + def __init__(self, *, required_zone_names: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword required_zone_names: The private link resource private link DNS zone name. + :paramtype required_zone_names: list[str] + """ + super().__init__(**kwargs) + self.group_id = None + self.required_members = None + self.required_zone_names = required_zone_names + + +class PrivateLinkResourceListResult(_serialization.Model): + """A list of private link resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Array of results. + :vartype value: list[~azure.mgmt.rdbms.postgresql_flexibleservers.models.PrivateLinkResource] + :ivar next_link: Link to retrieve next page of results. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[PrivateLinkResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class PrivateLinkServiceConnectionState(_serialization.Model): + """A collection of information about the state of the connection between service consumer and + provider. + + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + of the service. Known values are: "Pending", "Approved", and "Rejected". + :vartype status: str or + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.PrivateEndpointServiceConnectionStatus + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :vartype actions_required: str + """ + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "actions_required": {"key": "actionsRequired", "type": "str"}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the + owner of the service. Known values are: "Pending", "Approved", and "Rejected". + :paramtype status: str or + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval/rejection of the connection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :paramtype actions_required: str + """ + super().__init__(**kwargs) + self.status = status + self.description = description + self.actions_required = actions_required + + +class QuotaUsage(_serialization.Model): + """Quota usage for flexible servers. + + :ivar name: Name of quota usage for flexible servers. + :vartype name: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.NameProperty + :ivar limit: Quota limit. + :vartype limit: int + :ivar unit: Quota unit. + :vartype unit: str + :ivar current_value: Current Quota usage value. + :vartype current_value: int + :ivar id: Fully qualified ARM resource Id. + :vartype id: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "NameProperty"}, + "limit": {"key": "limit", "type": "int"}, + "unit": {"key": "unit", "type": "str"}, + "current_value": {"key": "currentValue", "type": "int"}, + "id": {"key": "id", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional["_models.NameProperty"] = None, + limit: Optional[int] = None, + unit: str = "Count", + current_value: Optional[int] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + **kwargs: Any + ) -> None: + """ + :keyword name: Name of quota usage for flexible servers. + :paramtype name: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.NameProperty + :keyword limit: Quota limit. + :paramtype limit: int + :keyword unit: Quota unit. + :paramtype unit: str + :keyword current_value: Current Quota usage value. + :paramtype current_value: int + :keyword id: Fully qualified ARM resource Id. + :paramtype id: str + """ + super().__init__(**kwargs) + self.name = name + self.limit = limit + self.unit = unit + self.current_value = current_value + self.id = id + + +class QuotaUsagesListResult(_serialization.Model): + """Capability for the PostgreSQL server. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of quota usages. + :vartype value: list[~azure.mgmt.rdbms.postgresql_flexibleservers.models.QuotaUsage] + :ivar next_link: Link to retrieve next page of results. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[QuotaUsage]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class Replica(_serialization.Model): + """Replica properties of a server. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar role: Used to indicate role of the server in replication set. Known values are: "None", + "Primary", "AsyncReplica", and "GeoAsyncReplica". + :vartype role: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ReplicationRole + :ivar capacity: Replicas allowed for a server. + :vartype capacity: int + :ivar replication_state: Gets the replication state of a replica server. This property is + returned only for replicas api call. Supported values are Active, Catchup, Provisioning, + Updating, Broken, Reconfiguring. Known values are: "Active", "Catchup", "Provisioning", + "Updating", "Broken", and "Reconfiguring". + :vartype replication_state: str or + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ReplicationState + :ivar promote_mode: Sets the promote mode for a replica server. This is a write only property. + Known values are: "standalone" and "switchover". + :vartype promote_mode: str or + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ReadReplicaPromoteMode + :ivar promote_option: Sets the promote options for a replica server. This is a write only + property. Known values are: "planned" and "forced". + :vartype promote_option: str or + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ReplicationPromoteOption + """ + + _validation = { + "capacity": {"readonly": True}, + "replication_state": {"readonly": True}, + } + + _attribute_map = { + "role": {"key": "role", "type": "str"}, + "capacity": {"key": "capacity", "type": "int"}, + "replication_state": {"key": "replicationState", "type": "str"}, + "promote_mode": {"key": "promoteMode", "type": "str"}, + "promote_option": {"key": "promoteOption", "type": "str"}, + } + + def __init__( + self, + *, + role: Optional[Union[str, "_models.ReplicationRole"]] = None, + promote_mode: Optional[Union[str, "_models.ReadReplicaPromoteMode"]] = None, + promote_option: Optional[Union[str, "_models.ReplicationPromoteOption"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword role: Used to indicate role of the server in replication set. Known values are: + "None", "Primary", "AsyncReplica", and "GeoAsyncReplica". + :paramtype role: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ReplicationRole + :keyword promote_mode: Sets the promote mode for a replica server. This is a write only + property. Known values are: "standalone" and "switchover". + :paramtype promote_mode: str or + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ReadReplicaPromoteMode + :keyword promote_option: Sets the promote options for a replica server. This is a write only + property. Known values are: "planned" and "forced". + :paramtype promote_option: str or + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ReplicationPromoteOption + """ + super().__init__(**kwargs) + self.role = role + self.capacity = None + self.replication_state = None + self.promote_mode = promote_mode + self.promote_option = promote_option + + +class RestartParameter(_serialization.Model): + """Represents server restart parameters. + + :ivar restart_with_failover: Indicates whether to restart the server with failover. + :vartype restart_with_failover: bool + :ivar failover_mode: Failover mode. Known values are: "PlannedFailover", "ForcedFailover", + "PlannedSwitchover", and "ForcedSwitchover". + :vartype failover_mode: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.FailoverMode + """ + + _attribute_map = { + "restart_with_failover": {"key": "restartWithFailover", "type": "bool"}, + "failover_mode": {"key": "failoverMode", "type": "str"}, + } + + def __init__( + self, + *, + restart_with_failover: Optional[bool] = None, + failover_mode: Optional[Union[str, "_models.FailoverMode"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword restart_with_failover: Indicates whether to restart the server with failover. + :paramtype restart_with_failover: bool + :keyword failover_mode: Failover mode. Known values are: "PlannedFailover", "ForcedFailover", + "PlannedSwitchover", and "ForcedSwitchover". + :paramtype failover_mode: str or + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.FailoverMode + """ + super().__init__(**kwargs) + self.restart_with_failover = restart_with_failover + self.failover_mode = failover_mode + + +class Server(TrackedResource): # pylint: disable=too-many-instance-attributes + """Represents a server. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar sku: The SKU (pricing tier) of the server. + :vartype sku: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.Sku + :ivar identity: Describes the identity of the application. + :vartype identity: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.UserAssignedIdentity + :ivar administrator_login: The administrator's login name of a server. Can only be specified + when the server is being created (and is required for creation). + :vartype administrator_login: str + :ivar administrator_login_password: The administrator login password (required for server + creation). + :vartype administrator_login_password: str + :ivar version: PostgreSQL Server version. Known values are: "15", "14", "13", "12", "11", and + "16". + :vartype version: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ServerVersion + :ivar minor_version: The minor version of the server. + :vartype minor_version: str + :ivar state: A state of a server that is visible to user. Known values are: "Ready", + "Dropping", "Disabled", "Starting", "Stopping", "Stopped", and "Updating". + :vartype state: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ServerState + :ivar fully_qualified_domain_name: The fully qualified domain name of a server. + :vartype fully_qualified_domain_name: str + :ivar storage: Storage properties of a server. + :vartype storage: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.Storage + :ivar auth_config: AuthConfig properties of a server. + :vartype auth_config: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.AuthConfig + :ivar data_encryption: Data encryption properties of a server. + :vartype data_encryption: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.DataEncryption + :ivar backup: Backup properties of a server. + :vartype backup: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.Backup + :ivar network: Network properties of a server. This Network property is required to be passed + only in case you want the server to be Private access server. + :vartype network: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.Network + :ivar high_availability: High availability properties of a server. + :vartype high_availability: + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.HighAvailability + :ivar maintenance_window: Maintenance window properties of a server. + :vartype maintenance_window: + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.MaintenanceWindow + :ivar source_server_resource_id: The source server resource ID to restore from. It's required + when 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'Replica' or 'ReviveDropped'. This + property is returned only for Replica server. + :vartype source_server_resource_id: str + :ivar point_in_time_utc: Restore point creation time (ISO8601 format), specifying the time to + restore from. It's required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or + 'ReviveDropped'. + :vartype point_in_time_utc: ~datetime.datetime + :ivar availability_zone: availability zone information of the server. + :vartype availability_zone: str + :ivar replication_role: Replication role of the server. Known values are: "None", "Primary", + "AsyncReplica", and "GeoAsyncReplica". + :vartype replication_role: str or + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ReplicationRole + :ivar replica_capacity: Replicas allowed for a server. + :vartype replica_capacity: int + :ivar replica: Replica properties of a server. These Replica properties are required to be + passed only in case you want to Promote a server. + :vartype replica: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.Replica + :ivar create_mode: The mode to create a new PostgreSQL server. Known values are: "Default", + "Create", "Update", "PointInTimeRestore", "GeoRestore", "Replica", and "ReviveDropped". + :vartype create_mode: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.CreateMode + :ivar private_endpoint_connections: List of private endpoint connections associated with the + specified resource. + :vartype private_endpoint_connections: + list[~azure.mgmt.rdbms.postgresql_flexibleservers.models.PrivateEndpointConnection] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "minor_version": {"readonly": True}, + "state": {"readonly": True}, + "fully_qualified_domain_name": {"readonly": True}, + "replica_capacity": {"readonly": True}, + "private_endpoint_connections": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "sku": {"key": "sku", "type": "Sku"}, + "identity": {"key": "identity", "type": "UserAssignedIdentity"}, + "administrator_login": {"key": "properties.administratorLogin", "type": "str"}, + "administrator_login_password": {"key": "properties.administratorLoginPassword", "type": "str"}, + "version": {"key": "properties.version", "type": "str"}, + "minor_version": {"key": "properties.minorVersion", "type": "str"}, + "state": {"key": "properties.state", "type": "str"}, + "fully_qualified_domain_name": {"key": "properties.fullyQualifiedDomainName", "type": "str"}, + "storage": {"key": "properties.storage", "type": "Storage"}, + "auth_config": {"key": "properties.authConfig", "type": "AuthConfig"}, + "data_encryption": {"key": "properties.dataEncryption", "type": "DataEncryption"}, + "backup": {"key": "properties.backup", "type": "Backup"}, + "network": {"key": "properties.network", "type": "Network"}, + "high_availability": {"key": "properties.highAvailability", "type": "HighAvailability"}, + "maintenance_window": {"key": "properties.maintenanceWindow", "type": "MaintenanceWindow"}, + "source_server_resource_id": {"key": "properties.sourceServerResourceId", "type": "str"}, + "point_in_time_utc": {"key": "properties.pointInTimeUTC", "type": "iso-8601"}, + "availability_zone": {"key": "properties.availabilityZone", "type": "str"}, + "replication_role": {"key": "properties.replicationRole", "type": "str"}, + "replica_capacity": {"key": "properties.replicaCapacity", "type": "int"}, + "replica": {"key": "properties.replica", "type": "Replica"}, + "create_mode": {"key": "properties.createMode", "type": "str"}, + "private_endpoint_connections": { + "key": "properties.privateEndpointConnections", + "type": "[PrivateEndpointConnection]", + }, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + sku: Optional["_models.Sku"] = None, + identity: Optional["_models.UserAssignedIdentity"] = None, + administrator_login: Optional[str] = None, + administrator_login_password: Optional[str] = None, + version: Optional[Union[str, "_models.ServerVersion"]] = None, + storage: Optional["_models.Storage"] = None, + auth_config: Optional["_models.AuthConfig"] = None, + data_encryption: Optional["_models.DataEncryption"] = None, + backup: Optional["_models.Backup"] = None, + network: Optional["_models.Network"] = None, + high_availability: Optional["_models.HighAvailability"] = None, + maintenance_window: Optional["_models.MaintenanceWindow"] = None, + source_server_resource_id: Optional[str] = None, point_in_time_utc: Optional[datetime.datetime] = None, availability_zone: str = "", replication_role: Optional[Union[str, "_models.ReplicationRole"]] = None, + replica: Optional["_models.Replica"] = None, create_mode: Optional[Union[str, "_models.CreateMode"]] = None, **kwargs: Any ) -> None: @@ -3030,8 +3718,8 @@ def __init__( # pylint: disable=too-many-locals :keyword administrator_login_password: The administrator login password (required for server creation). :paramtype administrator_login_password: str - :keyword version: PostgreSQL Server version. Known values are: "15", "14", "13", "12", and - "11". + :keyword version: PostgreSQL Server version. Known values are: "15", "14", "13", "12", "11", + and "16". :paramtype version: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ServerVersion :keyword storage: Storage properties of a server. :paramtype storage: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.Storage @@ -3064,6 +3752,9 @@ def __init__( # pylint: disable=too-many-locals "AsyncReplica", and "GeoAsyncReplica". :paramtype replication_role: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ReplicationRole + :keyword replica: Replica properties of a server. These Replica properties are required to be + passed only in case you want to Promote a server. + :paramtype replica: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.Replica :keyword create_mode: The mode to create a new PostgreSQL server. Known values are: "Default", "Create", "Update", "PointInTimeRestore", "GeoRestore", "Replica", and "ReviveDropped". :paramtype create_mode: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.CreateMode @@ -3089,7 +3780,9 @@ def __init__( # pylint: disable=too-many-locals self.availability_zone = availability_zone self.replication_role = replication_role self.replica_capacity = None + self.replica = replica self.create_mode = create_mode + self.private_endpoint_connections = None class ServerBackup(ProxyResource): @@ -3097,8 +3790,8 @@ class ServerBackup(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -3194,7 +3887,8 @@ class ServerForUpdate(_serialization.Model): # pylint: disable=too-many-instanc :vartype tags: dict[str, str] :ivar administrator_login_password: The password of the administrator login. :vartype administrator_login_password: str - :ivar version: PostgreSQL Server version. Known values are: "15", "14", "13", "12", and "11". + :ivar version: PostgreSQL Server version. Version 16 is currently not supported for MVU. Known + values are: "15", "14", "13", "12", "11", and "16". :vartype version: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ServerVersion :ivar storage: Storage properties of a server. :vartype storage: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.Storage @@ -3218,6 +3912,9 @@ class ServerForUpdate(_serialization.Model): # pylint: disable=too-many-instanc "AsyncReplica", and "GeoAsyncReplica". :vartype replication_role: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ReplicationRole + :ivar replica: Replica properties of a server. These Replica properties are required to be + passed only in case you want to Promote a server. + :vartype replica: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.Replica :ivar network: Network properties of a server. These are required to be passed only in case if server is a private access server. :vartype network: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.Network @@ -3237,6 +3934,7 @@ class ServerForUpdate(_serialization.Model): # pylint: disable=too-many-instanc "data_encryption": {"key": "properties.dataEncryption", "type": "DataEncryption"}, "create_mode": {"key": "properties.createMode", "type": "str"}, "replication_role": {"key": "properties.replicationRole", "type": "str"}, + "replica": {"key": "properties.replica", "type": "Replica"}, "network": {"key": "properties.network", "type": "Network"}, } @@ -3256,6 +3954,7 @@ def __init__( data_encryption: Optional["_models.DataEncryption"] = None, create_mode: Optional[Union[str, "_models.CreateModeForUpdate"]] = None, replication_role: Optional[Union[str, "_models.ReplicationRole"]] = None, + replica: Optional["_models.Replica"] = None, network: Optional["_models.Network"] = None, **kwargs: Any ) -> None: @@ -3268,8 +3967,8 @@ def __init__( :paramtype tags: dict[str, str] :keyword administrator_login_password: The password of the administrator login. :paramtype administrator_login_password: str - :keyword version: PostgreSQL Server version. Known values are: "15", "14", "13", "12", and - "11". + :keyword version: PostgreSQL Server version. Version 16 is currently not supported for MVU. + Known values are: "15", "14", "13", "12", "11", and "16". :paramtype version: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ServerVersion :keyword storage: Storage properties of a server. :paramtype storage: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.Storage @@ -3293,6 +3992,9 @@ def __init__( "AsyncReplica", and "GeoAsyncReplica". :paramtype replication_role: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ReplicationRole + :keyword replica: Replica properties of a server. These Replica properties are required to be + passed only in case you want to Promote a server. + :paramtype replica: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.Replica :keyword network: Network properties of a server. These are required to be passed only in case if server is a private access server. :paramtype network: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.Network @@ -3311,6 +4013,7 @@ def __init__( self.data_encryption = data_encryption self.create_mode = create_mode self.replication_role = replication_role + self.replica = replica self.network = network @@ -3345,33 +4048,26 @@ def __init__( class ServerSku(_serialization.Model): """Sku information related properties of a server. - All required parameters must be populated in order to send to Azure. - :ivar name: The name of the sku, typically, tier + family + cores, e.g. Standard_D4s_v3. - Required. :vartype name: str - :ivar tier: The tier of the particular SKU, e.g. Burstable. Required. Known values are: - "Burstable", "GeneralPurpose", and "MemoryOptimized". + :ivar tier: The tier of the particular SKU, e.g. Burstable. Known values are: "Burstable", + "GeneralPurpose", and "MemoryOptimized". :vartype tier: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.SkuTier """ - _validation = { - "name": {"required": True}, - "tier": {"required": True}, - } - _attribute_map = { "name": {"key": "name", "type": "str"}, "tier": {"key": "tier", "type": "str"}, } - def __init__(self, *, name: str, tier: Union[str, "_models.SkuTier"], **kwargs: Any) -> None: + def __init__( + self, *, name: Optional[str] = None, tier: Optional[Union[str, "_models.SkuTier"]] = None, **kwargs: Any + ) -> None: """ :keyword name: The name of the sku, typically, tier + family + cores, e.g. Standard_D4s_v3. - Required. :paramtype name: str - :keyword tier: The tier of the particular SKU, e.g. Burstable. Required. Known values are: - "Burstable", "GeneralPurpose", and "MemoryOptimized". + :keyword tier: The tier of the particular SKU, e.g. Burstable. Known values are: "Burstable", + "GeneralPurpose", and "MemoryOptimized". :paramtype tier: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.SkuTier """ super().__init__(**kwargs) @@ -3437,6 +4133,90 @@ def __init__(self, **kwargs: Any) -> None: self.supported_ha_mode = None +class ServerThreatProtectionListResult(_serialization.Model): + """A list of the server's Advanced Threat Protection settings. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Array of results. + :vartype value: + list[~azure.mgmt.rdbms.postgresql_flexibleservers.models.ServerThreatProtectionSettingsModel] + :ivar next_link: Link to retrieve next page of results. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ServerThreatProtectionSettingsModel]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class ServerThreatProtectionSettingsModel(ProxyResource): + """Server's Advanced Threat Protection settings. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.SystemData + :ivar state: Specifies the state of the Threat Protection, whether it is enabled or disabled or + a state has not been applied yet on the specific server. Known values are: "Enabled" and + "Disabled". + :vartype state: str or + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ThreatProtectionState + :ivar creation_time: Specifies the UTC creation time of the policy. + :vartype creation_time: ~datetime.datetime + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "creation_time": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "state": {"key": "properties.state", "type": "str"}, + "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, + } + + def __init__(self, *, state: Optional[Union[str, "_models.ThreatProtectionState"]] = None, **kwargs: Any) -> None: + """ + :keyword state: Specifies the state of the Threat Protection, whether it is enabled or disabled + or a state has not been applied yet on the specific server. Known values are: "Enabled" and + "Disabled". + :paramtype state: str or + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ThreatProtectionState + """ + super().__init__(**kwargs) + self.state = state + self.creation_time = None + + class ServerVersionCapability(CapabilityBase): """Server version capabilities. @@ -3514,8 +4294,6 @@ def __init__(self, *, name: str, tier: Union[str, "_models.SkuTier"], **kwargs: class Storage(_serialization.Model): """Storage properties of a server. - Variables are only populated by the server, and will be ignored when sending a request. - :ivar storage_size_gb: Max storage allowed for a server. :vartype storage_size_gb: int :ivar auto_grow: Flag to enable / disable Storage Auto grow for flexible server. Known values @@ -3525,19 +4303,24 @@ class Storage(_serialization.Model): "P10", "P15", "P20", "P30", "P40", "P50", "P60", "P70", and "P80". :vartype tier: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.AzureManagedDiskPerformanceTiers - :ivar iops: Storage tier IOPS quantity. + :ivar iops: Storage tier IOPS quantity. This property is required to be set for storage Type + PremiumV2_LRS. :vartype iops: int + :ivar throughput: Storage throughput for the server. This is required to be set for storage + Type PremiumV2_LRS. + :vartype throughput: int + :ivar type: Storage type for the server. Allowed values are Premium_LRS and PremiumV2_LRS, and + default is Premium_LRS if not specified. Known values are: "Premium_LRS" and "PremiumV2_LRS". + :vartype type: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.StorageType """ - _validation = { - "iops": {"readonly": True}, - } - _attribute_map = { "storage_size_gb": {"key": "storageSizeGB", "type": "int"}, "auto_grow": {"key": "autoGrow", "type": "str"}, "tier": {"key": "tier", "type": "str"}, "iops": {"key": "iops", "type": "int"}, + "throughput": {"key": "throughput", "type": "int"}, + "type": {"key": "type", "type": "str"}, } def __init__( @@ -3546,6 +4329,9 @@ def __init__( storage_size_gb: Optional[int] = None, auto_grow: Optional[Union[str, "_models.StorageAutoGrow"]] = None, tier: Optional[Union[str, "_models.AzureManagedDiskPerformanceTiers"]] = None, + iops: Optional[int] = None, + throughput: Optional[int] = None, + type: Optional[Union[str, "_models.StorageType"]] = None, **kwargs: Any ) -> None: """ @@ -3559,12 +4345,24 @@ def __init__( "P10", "P15", "P20", "P30", "P40", "P50", "P60", "P70", and "P80". :paramtype tier: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.AzureManagedDiskPerformanceTiers + :keyword iops: Storage tier IOPS quantity. This property is required to be set for storage Type + PremiumV2_LRS. + :paramtype iops: int + :keyword throughput: Storage throughput for the server. This is required to be set for storage + Type PremiumV2_LRS. + :paramtype throughput: int + :keyword type: Storage type for the server. Allowed values are Premium_LRS and PremiumV2_LRS, + and default is Premium_LRS if not specified. Known values are: "Premium_LRS" and + "PremiumV2_LRS". + :paramtype type: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.StorageType """ super().__init__(**kwargs) self.storage_size_gb = storage_size_gb self.auto_grow = auto_grow self.tier = tier - self.iops = None + self.iops = iops + self.throughput = throughput + self.type = type class StorageEditionCapability(CapabilityBase): @@ -3622,8 +4420,17 @@ class StorageMbCapability(CapabilityBase): :vartype reason: str :ivar supported_iops: Supported IOPS. :vartype supported_iops: int + :ivar supported_maximum_iops: Maximum IOPS supported by this #Vcores or PremiumV2_LRS Storage + Size. + :vartype supported_maximum_iops: int :ivar storage_size_mb: Storage size in MB. :vartype storage_size_mb: int + :ivar maximum_storage_size_mb: Maximum value of Storage size in MB. + :vartype maximum_storage_size_mb: int + :ivar supported_throughput: Values of throughput in MB/s. + :vartype supported_throughput: int + :ivar supported_maximum_throughput: Maximum values of throughput in MB/s. + :vartype supported_maximum_throughput: int :ivar default_iops_tier: Default tier for IOPS. :vartype default_iops_tier: str :ivar supported_iops_tiers: List of available options to upgrade the storage performance. @@ -3635,7 +4442,11 @@ class StorageMbCapability(CapabilityBase): "status": {"readonly": True}, "reason": {"readonly": True}, "supported_iops": {"readonly": True}, + "supported_maximum_iops": {"readonly": True}, "storage_size_mb": {"readonly": True}, + "maximum_storage_size_mb": {"readonly": True}, + "supported_throughput": {"readonly": True}, + "supported_maximum_throughput": {"readonly": True}, "default_iops_tier": {"readonly": True}, "supported_iops_tiers": {"readonly": True}, } @@ -3644,7 +4455,11 @@ class StorageMbCapability(CapabilityBase): "status": {"key": "status", "type": "str"}, "reason": {"key": "reason", "type": "str"}, "supported_iops": {"key": "supportedIops", "type": "int"}, + "supported_maximum_iops": {"key": "supportedMaximumIops", "type": "int"}, "storage_size_mb": {"key": "storageSizeMb", "type": "int"}, + "maximum_storage_size_mb": {"key": "maximumStorageSizeMb", "type": "int"}, + "supported_throughput": {"key": "supportedThroughput", "type": "int"}, + "supported_maximum_throughput": {"key": "supportedMaximumThroughput", "type": "int"}, "default_iops_tier": {"key": "defaultIopsTier", "type": "str"}, "supported_iops_tiers": {"key": "supportedIopsTiers", "type": "[StorageTierCapability]"}, } @@ -3653,7 +4468,11 @@ def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.supported_iops = None + self.supported_maximum_iops = None self.storage_size_mb = None + self.maximum_storage_size_mb = None + self.supported_throughput = None + self.supported_maximum_throughput = None self.default_iops_tier = None self.supported_iops_tiers = None @@ -3841,6 +4660,286 @@ def __init__(self, *, principal_id: Optional[str] = None, client_id: Optional[st self.client_id = client_id +class ValidationDetails(_serialization.Model): + """Details for the validation for migration. + + :ivar status: Validation status for migration. Known values are: "Failed", "Succeeded", and + "Warning". + :vartype status: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ValidationState + :ivar validation_start_time_in_utc: Validation Start date-time in UTC. + :vartype validation_start_time_in_utc: ~datetime.datetime + :ivar validation_end_time_in_utc: Validation End date-time in UTC. + :vartype validation_end_time_in_utc: ~datetime.datetime + :ivar server_level_validation_details: Details of server level validations. + :vartype server_level_validation_details: + list[~azure.mgmt.rdbms.postgresql_flexibleservers.models.ValidationSummaryItem] + :ivar db_level_validation_details: Details of server level validations. + :vartype db_level_validation_details: + list[~azure.mgmt.rdbms.postgresql_flexibleservers.models.DbLevelValidationStatus] + """ + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + "validation_start_time_in_utc": {"key": "validationStartTimeInUtc", "type": "iso-8601"}, + "validation_end_time_in_utc": {"key": "validationEndTimeInUtc", "type": "iso-8601"}, + "server_level_validation_details": {"key": "serverLevelValidationDetails", "type": "[ValidationSummaryItem]"}, + "db_level_validation_details": {"key": "dbLevelValidationDetails", "type": "[DbLevelValidationStatus]"}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "_models.ValidationState"]] = None, + validation_start_time_in_utc: Optional[datetime.datetime] = None, + validation_end_time_in_utc: Optional[datetime.datetime] = None, + server_level_validation_details: Optional[List["_models.ValidationSummaryItem"]] = None, + db_level_validation_details: Optional[List["_models.DbLevelValidationStatus"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword status: Validation status for migration. Known values are: "Failed", "Succeeded", and + "Warning". + :paramtype status: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ValidationState + :keyword validation_start_time_in_utc: Validation Start date-time in UTC. + :paramtype validation_start_time_in_utc: ~datetime.datetime + :keyword validation_end_time_in_utc: Validation End date-time in UTC. + :paramtype validation_end_time_in_utc: ~datetime.datetime + :keyword server_level_validation_details: Details of server level validations. + :paramtype server_level_validation_details: + list[~azure.mgmt.rdbms.postgresql_flexibleservers.models.ValidationSummaryItem] + :keyword db_level_validation_details: Details of server level validations. + :paramtype db_level_validation_details: + list[~azure.mgmt.rdbms.postgresql_flexibleservers.models.DbLevelValidationStatus] + """ + super().__init__(**kwargs) + self.status = status + self.validation_start_time_in_utc = validation_start_time_in_utc + self.validation_end_time_in_utc = validation_end_time_in_utc + self.server_level_validation_details = server_level_validation_details + self.db_level_validation_details = db_level_validation_details + + +class ValidationMessage(_serialization.Model): + """Validation message object. + + :ivar state: Severity of validation message. Known values are: "Failed", "Succeeded", and + "Warning". + :vartype state: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ValidationState + :ivar message: Validation message string. + :vartype message: str + """ + + _attribute_map = { + "state": {"key": "state", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__( + self, + *, + state: Optional[Union[str, "_models.ValidationState"]] = None, + message: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword state: Severity of validation message. Known values are: "Failed", "Succeeded", and + "Warning". + :paramtype state: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ValidationState + :keyword message: Validation message string. + :paramtype message: str + """ + super().__init__(**kwargs) + self.state = state + self.message = message + + +class ValidationSummaryItem(_serialization.Model): + """Validation summary object. + + :ivar type: Validation type. + :vartype type: str + :ivar state: Validation status for migration. Known values are: "Failed", "Succeeded", and + "Warning". + :vartype state: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ValidationState + :ivar messages: Validation messages. + :vartype messages: list[~azure.mgmt.rdbms.postgresql_flexibleservers.models.ValidationMessage] + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "state": {"key": "state", "type": "str"}, + "messages": {"key": "messages", "type": "[ValidationMessage]"}, + } + + def __init__( + self, + *, + type: Optional[str] = None, + state: Optional[Union[str, "_models.ValidationState"]] = None, + messages: Optional[List["_models.ValidationMessage"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: Validation type. + :paramtype type: str + :keyword state: Validation status for migration. Known values are: "Failed", "Succeeded", and + "Warning". + :paramtype state: str or ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ValidationState + :keyword messages: Validation messages. + :paramtype messages: + list[~azure.mgmt.rdbms.postgresql_flexibleservers.models.ValidationMessage] + """ + super().__init__(**kwargs) + self.type = type + self.state = state + self.messages = messages + + +class VirtualEndpointResourceForPatch(_serialization.Model): + """Represents a virtual endpoint for a server. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar endpoint_type: The endpoint type for the virtual endpoint. "ReadWrite" + :vartype endpoint_type: str or + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualEndpointType + :ivar members: List of members for a virtual endpoint. + :vartype members: list[str] + :ivar virtual_endpoints: List of virtual endpoints for a server. + :vartype virtual_endpoints: list[str] + """ + + _validation = { + "virtual_endpoints": {"readonly": True}, + } + + _attribute_map = { + "endpoint_type": {"key": "properties.endpointType", "type": "str"}, + "members": {"key": "properties.members", "type": "[str]"}, + "virtual_endpoints": {"key": "properties.virtualEndpoints", "type": "[str]"}, + } + + def __init__( + self, + *, + endpoint_type: Optional[Union[str, "_models.VirtualEndpointType"]] = None, + members: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword endpoint_type: The endpoint type for the virtual endpoint. "ReadWrite" + :paramtype endpoint_type: str or + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualEndpointType + :keyword members: List of members for a virtual endpoint. + :paramtype members: list[str] + """ + super().__init__(**kwargs) + self.endpoint_type = endpoint_type + self.members = members + self.virtual_endpoints = None + + +class VirtualEndpointResource(VirtualEndpointResourceForPatch, Resource): + """Represents a virtual endpoint for a server. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.SystemData + :ivar endpoint_type: The endpoint type for the virtual endpoint. "ReadWrite" + :vartype endpoint_type: str or + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualEndpointType + :ivar members: List of members for a virtual endpoint. + :vartype members: list[str] + :ivar virtual_endpoints: List of virtual endpoints for a server. + :vartype virtual_endpoints: list[str] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "virtual_endpoints": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "endpoint_type": {"key": "properties.endpointType", "type": "str"}, + "members": {"key": "properties.members", "type": "[str]"}, + "virtual_endpoints": {"key": "properties.virtualEndpoints", "type": "[str]"}, + } + + def __init__( + self, + *, + endpoint_type: Optional[Union[str, "_models.VirtualEndpointType"]] = None, + members: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword endpoint_type: The endpoint type for the virtual endpoint. "ReadWrite" + :paramtype endpoint_type: str or + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualEndpointType + :keyword members: List of members for a virtual endpoint. + :paramtype members: list[str] + """ + super().__init__(endpoint_type=endpoint_type, members=members, **kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + self.endpoint_type = endpoint_type + self.members = members + self.virtual_endpoints = None + + +class VirtualEndpointsListResult(_serialization.Model): + """A list of virtual endpoints. + + :ivar value: The list of virtual endpoints. + :vartype value: + list[~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualEndpointResource] + :ivar next_link: The link used to get the next page of operations. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[VirtualEndpointResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.VirtualEndpointResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: The list of virtual endpoints. + :paramtype value: + list[~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualEndpointResource] + :keyword next_link: The link used to get the next page of operations. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + class VirtualNetworkSubnetUsageParameter(_serialization.Model): """Virtual network subnet usage parameter. diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/models/_postgre_sql_management_client_enums.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/models/_postgre_sql_management_client_enums.py index cee6bfd6ac40..1f2487ae00f3 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/models/_postgre_sql_management_client_enums.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/models/_postgre_sql_management_client_enums.py @@ -184,6 +184,17 @@ class LogicalReplicationOnSourceDbEnum(str, Enum, metaclass=CaseInsensitiveEnumM FALSE = "False" +class MigrationDbState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Migration db state of an individual database.""" + + IN_PROGRESS = "InProgress" + WAITING_FOR_CUTOVER_TRIGGER = "WaitingForCutoverTrigger" + FAILED = "Failed" + CANCELED = "Canceled" + SUCCEEDED = "Succeeded" + CANCELING = "Canceling" + + class MigrationDetailsLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Migration details level.""" @@ -213,6 +224,14 @@ class MigrationNameAvailabilityReason(str, Enum, metaclass=CaseInsensitiveEnumMe ALREADY_EXISTS = "AlreadyExists" +class MigrationOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Supported types of migration request include Validate, Migrate and ValidateAndMigrate.""" + + VALIDATE = "Validate" + MIGRATE = "Migrate" + VALIDATE_AND_MIGRATE = "ValidateAndMigrate" + + class MigrationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Migration state.""" @@ -221,6 +240,8 @@ class MigrationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): CANCELED = "Canceled" FAILED = "Failed" SUCCEEDED = "Succeeded" + VALIDATION_FAILED = "ValidationFailed" + CLEANING_UP = "CleaningUp" class MigrationSubState(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -236,6 +257,8 @@ class MigrationSubState(str, Enum, metaclass=CaseInsensitiveEnumMeta): WAITING_FOR_CUTOVER_TRIGGER = "WaitingForCutoverTrigger" COMPLETING_MIGRATION = "CompletingMigration" COMPLETED = "Completed" + CANCELING_REQUESTED_DB_MIGRATIONS = "CancelingRequestedDBMigrations" + VALIDATION_IN_PROGRESS = "ValidationInProgress" class OnlineResizeSupportedEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -288,6 +311,37 @@ class PrincipalType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SERVICE_PRINCIPAL = "ServicePrincipal" +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current provisioning state.""" + + SUCCEEDED = "Succeeded" + CREATING = "Creating" + DELETING = "Deleting" + FAILED = "Failed" + + +class PrivateEndpointServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The private endpoint connection status.""" + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + + +class ReadReplicaPromoteMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Sets the promote mode for a replica server. This is a write only property.""" + + STANDALONE = "standalone" + SWITCHOVER = "switchover" + + +class ReplicationPromoteOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Sets the promote options for a replica server. This is a write only property.""" + + PLANNED = "planned" + FORCED = "forced" + + class ReplicationRole(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Used to indicate role of the server in replication set.""" @@ -297,6 +351,19 @@ class ReplicationRole(str, Enum, metaclass=CaseInsensitiveEnumMeta): GEO_ASYNC_REPLICA = "GeoAsyncReplica" +class ReplicationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets the replication state of a replica server. This property is returned only for replicas api + call. Supported values are Active, Catchup, Provisioning, Updating, Broken, Reconfiguring. + """ + + ACTIVE = "Active" + CATCHUP = "Catchup" + PROVISIONING = "Provisioning" + UPDATING = "Updating" + BROKEN = "Broken" + RECONFIGURING = "Reconfiguring" + + class RestrictedEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A value indicating whether this region is restricted. "Enabled" means region is restricted. "Disabled" stands for region is not restricted. @@ -344,6 +411,7 @@ class ServerVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): THIRTEEN = "13" TWELVE = "12" ELEVEN = "11" + SIXTEEN = "16" class SkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -354,6 +422,27 @@ class SkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): MEMORY_OPTIMIZED = "MemoryOptimized" +class SourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Migration source server type : OnPremises, AWS, GCP, AzureVM or PostgreSQLSingleServer.""" + + ON_PREMISES = "OnPremises" + AWS = "AWS" + GCP = "GCP" + AZURE_VM = "AzureVM" + POSTGRE_SQL_SINGLE_SERVER = "PostgreSQLSingleServer" + + +class SslMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Supported SSL modes for migration. VerifyFull is the recommended SSL mode for Single server + migration. Prefer, Require are recommended SSL modes for other source types. + """ + + PREFER = "Prefer" + REQUIRE = "Require" + VERIFY_CA = "VerifyCA" + VERIFY_FULL = "VerifyFull" + + class StartDataMigrationEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates whether the data migration should start right away.""" @@ -377,6 +466,30 @@ class StorageAutoGrowthSupportedEnum(str, Enum, metaclass=CaseInsensitiveEnumMet DISABLED = "Disabled" +class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Storage type for the server. Allowed values are Premium_LRS and PremiumV2_LRS, and default is + Premium_LRS if not specified. + """ + + PREMIUM_LRS = "Premium_LRS" + PREMIUM_V2_LRS = "PremiumV2_LRS" + + +class ThreatProtectionName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ThreatProtectionName.""" + + DEFAULT = "Default" + + +class ThreatProtectionState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies the state of the Threat Protection, whether it is enabled or disabled or a state has + not been applied yet on the specific server. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + + class TriggerCutoverEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): """To trigger cutover for entire migration we need to send this flag as True.""" @@ -384,6 +497,20 @@ class TriggerCutoverEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): FALSE = "False" +class ValidationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Validation status for migration.""" + + FAILED = "Failed" + SUCCEEDED = "Succeeded" + WARNING = "Warning" + + +class VirtualEndpointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The endpoint type for the virtual endpoint.""" + + READ_WRITE = "ReadWrite" + + class ZoneRedundantHaAndGeoBackupSupportedEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A value indicating whether Zone Redundant HA and Geo-backup is supported in this region. "Enabled" means zone redundant HA and geo-backup is supported. "Disabled" stands for zone diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/__init__.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/__init__.py index 05de2f7447a6..d04efbcbaee9 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/__init__.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/__init__.py @@ -16,15 +16,21 @@ from ._databases_operations import DatabasesOperations from ._firewall_rules_operations import FirewallRulesOperations from ._servers_operations import ServersOperations +from ._flexible_server_operations import FlexibleServerOperations +from ._ltr_backup_operations_operations import LtrBackupOperationsOperations from ._migrations_operations import MigrationsOperations from ._postgre_sql_management_client_operations import PostgreSQLManagementClientOperationsMixin from ._operations import Operations from ._get_private_dns_zone_suffix_operations import GetPrivateDnsZoneSuffixOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_endpoint_connection_operations import PrivateEndpointConnectionOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._quota_usages_operations import QuotaUsagesOperations from ._replicas_operations import ReplicasOperations from ._log_files_operations import LogFilesOperations +from ._server_threat_protection_settings_operations import ServerThreatProtectionSettingsOperations +from ._virtual_endpoints_operations import VirtualEndpointsOperations from ._virtual_network_subnet_usage_operations import VirtualNetworkSubnetUsageOperations -from ._flexible_server_operations import FlexibleServerOperations -from ._ltr_backup_operations_operations import LtrBackupOperationsOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -41,15 +47,21 @@ "DatabasesOperations", "FirewallRulesOperations", "ServersOperations", + "FlexibleServerOperations", + "LtrBackupOperationsOperations", "MigrationsOperations", "PostgreSQLManagementClientOperationsMixin", "Operations", "GetPrivateDnsZoneSuffixOperations", + "PrivateEndpointConnectionsOperations", + "PrivateEndpointConnectionOperations", + "PrivateLinkResourcesOperations", + "QuotaUsagesOperations", "ReplicasOperations", "LogFilesOperations", + "ServerThreatProtectionSettingsOperations", + "VirtualEndpointsOperations", "VirtualNetworkSubnetUsageOperations", - "FlexibleServerOperations", - "LtrBackupOperationsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_administrators_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_administrators_operations.py index bd0d83272a22..67bcd81edb88 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_administrators_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_administrators_operations.py @@ -45,7 +45,7 @@ def build_create_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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -55,7 +55,7 @@ def build_create_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -84,7 +84,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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +93,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -120,7 +120,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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +129,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -156,7 +156,7 @@ def build_list_by_server_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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -165,7 +165,7 @@ def build_list_by_server_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_backups_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_backups_operations.py index c0bf3cc35197..a4f217903f17 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_backups_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_backups_operations.py @@ -42,7 +42,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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -51,7 +51,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/backups/{backupName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -78,7 +78,7 @@ def build_list_by_server_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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +87,7 @@ def build_list_by_server_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/backups", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_check_name_availability_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_check_name_availability_operations.py index b4021008d68a..190e6e8c5dab 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_check_name_availability_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_check_name_availability_operations.py @@ -39,7 +39,7 @@ def build_execute_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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -48,7 +48,7 @@ def build_execute_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability" ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_check_name_availability_with_location_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_check_name_availability_with_location_operations.py index 9c73159b3eee..2a6758be447e 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_check_name_availability_with_location_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_check_name_availability_with_location_operations.py @@ -39,7 +39,7 @@ def build_execute_request(location_name: str, subscription_id: str, **kwargs: An _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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -49,7 +49,7 @@ def build_execute_request(location_name: str, subscription_id: str, **kwargs: An "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/checkNameAvailability", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "locationName": _SERIALIZER.url("location_name", location_name, "str", min_length=1, pattern=r"^[-\w\._]+$"), } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_configurations_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_configurations_operations.py index bc9260b22175..96ff33ec192b 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_configurations_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_configurations_operations.py @@ -45,7 +45,7 @@ def build_list_by_server_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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +54,7 @@ def build_list_by_server_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -80,7 +80,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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +89,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -118,7 +118,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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +128,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -159,7 +159,7 @@ def build_put_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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -169,7 +169,7 @@ def build_put_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_databases_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_databases_operations.py index b688530e88ae..73325028541f 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_databases_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_databases_operations.py @@ -45,7 +45,7 @@ def build_create_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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -55,7 +55,7 @@ def build_create_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -84,7 +84,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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +93,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -120,7 +120,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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +129,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -156,7 +156,7 @@ def build_list_by_server_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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -165,7 +165,7 @@ def build_list_by_server_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_firewall_rules_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_firewall_rules_operations.py index cc476c92fef6..32d204727af4 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_firewall_rules_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_firewall_rules_operations.py @@ -45,7 +45,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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -55,7 +55,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -86,7 +86,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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +95,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -124,7 +124,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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -133,7 +133,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -162,7 +162,7 @@ def build_list_by_server_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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -171,7 +171,7 @@ def build_list_by_server_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_flexible_server_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_flexible_server_operations.py index ee2cae49d3d0..4aec292b4b29 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_flexible_server_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_flexible_server_operations.py @@ -43,7 +43,7 @@ def build_trigger_ltr_pre_backup_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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -53,7 +53,7 @@ def build_trigger_ltr_pre_backup_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/ltrPreBackup", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -81,7 +81,7 @@ def build_start_ltr_backup_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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -91,7 +91,7 @@ def build_start_ltr_backup_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/startLtrBackup", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_get_private_dns_zone_suffix_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_get_private_dns_zone_suffix_operations.py index f31eaebb40bd..3ef38117197e 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_get_private_dns_zone_suffix_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_get_private_dns_zone_suffix_operations.py @@ -38,7 +38,7 @@ def build_execute_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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_location_based_capabilities_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_location_based_capabilities_operations.py index 47df49f4644e..01e2855a642b 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_location_based_capabilities_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_location_based_capabilities_operations.py @@ -40,7 +40,7 @@ def build_execute_request(location_name: str, subscription_id: str, **kwargs: An _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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49,7 +49,7 @@ def build_execute_request(location_name: str, subscription_id: str, **kwargs: An "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/capabilities", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "locationName": _SERIALIZER.url("location_name", location_name, "str", min_length=1, pattern=r"^[-\w\._]+$"), } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_log_files_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_log_files_operations.py index 99475eedebcf..1b37d972c064 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_log_files_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_log_files_operations.py @@ -42,7 +42,7 @@ def build_list_by_server_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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -51,7 +51,7 @@ def build_list_by_server_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/logFiles", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_ltr_backup_operations_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_ltr_backup_operations_operations.py index 2dbdcaec8107..4c2db233368e 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_ltr_backup_operations_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_ltr_backup_operations_operations.py @@ -42,7 +42,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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -51,7 +51,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/ltrBackupOperations/{backupName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -78,7 +78,7 @@ def build_list_by_server_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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +87,7 @@ def build_list_by_server_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/ltrBackupOperations", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_migrations_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_migrations_operations.py index d7205f3856c2..06632f75bfb5 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_migrations_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_migrations_operations.py @@ -43,7 +43,7 @@ def build_create_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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -87,7 +87,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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -128,7 +128,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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -172,7 +172,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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -218,7 +218,7 @@ def build_list_by_target_server_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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_operations.py index 1ce398317bd0..1b619ce80b76 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_operations.py @@ -38,7 +38,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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_postgre_sql_management_client_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_postgre_sql_management_client_operations.py index a79360eaa1a4..ffa2cd72662f 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_postgre_sql_management_client_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_postgre_sql_management_client_operations.py @@ -41,7 +41,7 @@ def build_check_migration_name_availability_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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_private_endpoint_connection_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_private_endpoint_connection_operations.py new file mode 100644 index 000000000000..f67f1559cafa --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_private_endpoint_connection_operations.py @@ -0,0 +1,521 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import PostgreSQLManagementClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_update_request( + resource_group_name: str, + server_name: str, + private_endpoint_connection_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", "2023-06-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/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serverName": _SERIALIZER.url( + "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", + private_endpoint_connection_name, + "str", + pattern=r"^[a-zA-Z][a-zA-Z0-9-]*\.[a-fA-F0-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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + server_name: str, + private_endpoint_connection_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", "2023-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serverName": _SERIALIZER.url( + "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", + private_endpoint_connection_name, + "str", + pattern=r"^[a-zA-Z][a-zA-Z0-9-]*\.[a-fA-F0-9\-]+$", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class PrivateEndpointConnectionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.rdbms.postgresql_flexibleservers.PostgreSQLManagementClient`'s + :attr:`private_endpoint_connection` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _update_initial( + self, + resource_group_name: str, + server_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> Optional[_models.PrivateEndpointConnection]: + 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[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") + + request = build_update_request( + resource_group_name=resource_group_name, + server_name=server_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.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, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + server_name: str, + private_endpoint_connection_name: str, + parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection with a given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The required parameters for updating private endpoint connection. Required. + :type parameters: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.PrivateEndpointConnection + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql_flexibleservers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + server_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection with a given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The required parameters for updating private endpoint connection. Required. + :type parameters: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql_flexibleservers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + server_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO], + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection with a given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: The required parameters for updating private endpoint connection. Is either + a PrivateEndpointConnection type or a IO type. Required. + :type parameters: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.PrivateEndpointConnection + 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql_flexibleservers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _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.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + private_endpoint_connection_name=private_endpoint_connection_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, server_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = 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)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + server_name=server_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, server_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a private endpoint connection with a given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = 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)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + server_name=server_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_private_endpoint_connections_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..a4a103d58ecf --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,298 @@ +# pylint: disable=too-many-lines +# 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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import PostgreSQLManagementClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, + server_name: str, + private_endpoint_connection_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", "2023-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serverName": _SERIALIZER.url( + "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", + private_endpoint_connection_name, + "str", + pattern=r"^[a-zA-Z][a-zA-Z0-9-]*\.[a-fA-F0-9\-]+$", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_server_request( + resource_group_name: str, server_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", "2023-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateEndpointConnections", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serverName": _SERIALIZER.url( + "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.rdbms.postgresql_flexibleservers.PostgreSQLManagementClient`'s + :attr:`private_endpoint_connections` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, server_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Gets a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = 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)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + server_name=server_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}" + } + + @distributed_trace + def list_by_server( + self, resource_group_name: str, server_name: str, **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnection"]: + """Gets all private endpoint connections on a server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.postgresql_flexibleservers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = 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)) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_server_request( + resource_group_name=resource_group_name, + server_name=server_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_server.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateEndpointConnections" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_private_link_resources_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..540a172407c0 --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_private_link_resources_operations.py @@ -0,0 +1,288 @@ +# pylint: disable=too-many-lines +# 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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import PostgreSQLManagementClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_server_request( + resource_group_name: str, server_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", "2023-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateLinkResources", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serverName": _SERIALIZER.url( + "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, server_name: str, group_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", "2023-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateLinkResources/{groupName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serverName": _SERIALIZER.url( + "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" + ), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^.*$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.rdbms.postgresql_flexibleservers.PostgreSQLManagementClient`'s + :attr:`private_link_resources` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_server( + self, resource_group_name: str, server_name: str, **kwargs: Any + ) -> Iterable["_models.PrivateLinkResource"]: + """Gets the private link resources for PostgreSQL server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.postgresql_flexibleservers.models.PrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = 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)) + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_server_request( + resource_group_name=resource_group_name, + server_name=server_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_server.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateLinkResources" + } + + @distributed_trace + def get( + self, resource_group_name: str, server_name: str, group_name: str, **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets a private link resource for PostgreSQL server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param group_name: The name of the private link resource. Required. + :type group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = 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)) + cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + server_name=server_name, + group_name=group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateLinkResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateLinkResources/{groupName}" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_quota_usages_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_quota_usages_operations.py new file mode 100644 index 000000000000..c21269fa7ddb --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_quota_usages_operations.py @@ -0,0 +1,171 @@ +# pylint: disable=too-many-lines +# 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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import PostgreSQLManagementClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request(location_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", "2023-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/resourceType/flexibleServers/usages", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "locationName": _SERIALIZER.url("location_name", location_name, "str", min_length=1, pattern=r"^[-\w\._]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class QuotaUsagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.rdbms.postgresql_flexibleservers.PostgreSQLManagementClient`'s + :attr:`quota_usages` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, location_name: str, **kwargs: Any) -> Iterable["_models.QuotaUsage"]: + """Get quota usages at specified location in a given subscription. + + :param location_name: The name of the location. Required. + :type location_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either QuotaUsage or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.postgresql_flexibleservers.models.QuotaUsage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = 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)) + cls: ClsType[_models.QuotaUsagesListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + location_name=location_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("QuotaUsagesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/resourceType/flexibleServers/usages" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_replicas_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_replicas_operations.py index 5cecad2bc319..d9b4c24a07fc 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_replicas_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_replicas_operations.py @@ -42,7 +42,7 @@ def build_list_by_server_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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -51,7 +51,7 @@ def build_list_by_server_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/replicas", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_server_capabilities_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_server_capabilities_operations.py index fa68ffefc9d9..1a1ff047c666 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_server_capabilities_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_server_capabilities_operations.py @@ -40,7 +40,7 @@ def build_list_request(resource_group_name: str, server_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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49,7 +49,7 @@ def build_list_request(resource_group_name: str, server_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/capabilities", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_server_threat_protection_settings_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_server_threat_protection_settings_operations.py new file mode 100644 index 000000000000..e18725d74d70 --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_server_threat_protection_settings_operations.py @@ -0,0 +1,592 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import PostgreSQLManagementClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_server_request( + resource_group_name: str, server_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", "2023-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/advancedThreatProtectionSettings", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serverName": _SERIALIZER.url( + "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + server_name: str, + threat_protection_name: Union[str, _models.ThreatProtectionName], + 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-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/advancedThreatProtectionSettings/{threatProtectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serverName": _SERIALIZER.url( + "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" + ), + "threatProtectionName": _SERIALIZER.url("threat_protection_name", threat_protection_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + server_name: str, + threat_protection_name: Union[str, _models.ThreatProtectionName], + 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-06-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/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/advancedThreatProtectionSettings/{threatProtectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serverName": _SERIALIZER.url( + "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" + ), + "threatProtectionName": _SERIALIZER.url("threat_protection_name", threat_protection_name, "str"), + } + + _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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +class ServerThreatProtectionSettingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.rdbms.postgresql_flexibleservers.PostgreSQLManagementClient`'s + :attr:`server_threat_protection_settings` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_server( + self, resource_group_name: str, server_name: str, **kwargs: Any + ) -> Iterable["_models.ServerThreatProtectionSettingsModel"]: + """Get a list of server's Threat Protection state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServerThreatProtectionSettingsModel or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.postgresql_flexibleservers.models.ServerThreatProtectionSettingsModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = 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)) + cls: ClsType[_models.ServerThreatProtectionListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_server_request( + resource_group_name=resource_group_name, + server_name=server_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_server.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ServerThreatProtectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/advancedThreatProtectionSettings" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + server_name: str, + threat_protection_name: Union[str, _models.ThreatProtectionName], + **kwargs: Any + ) -> _models.ServerThreatProtectionSettingsModel: + """Get a server's Advanced Threat Protection settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param threat_protection_name: The name of the Threat Protection state. "Default" Required. + :type threat_protection_name: str or + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ThreatProtectionName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServerThreatProtectionSettingsModel or the result of cls(response) + :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ServerThreatProtectionSettingsModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = 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)) + cls: ClsType[_models.ServerThreatProtectionSettingsModel] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + server_name=server_name, + threat_protection_name=threat_protection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ServerThreatProtectionSettingsModel", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/advancedThreatProtectionSettings/{threatProtectionName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + server_name: str, + threat_protection_name: Union[str, _models.ThreatProtectionName], + parameters: Union[_models.ServerThreatProtectionSettingsModel, IO], + **kwargs: Any + ) -> _models.ServerThreatProtectionSettingsModel: + 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.ServerThreatProtectionSettingsModel] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ServerThreatProtectionSettingsModel") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + server_name=server_name, + threat_protection_name=threat_protection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ServerThreatProtectionSettingsModel", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ServerThreatProtectionSettingsModel", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/advancedThreatProtectionSettings/{threatProtectionName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + server_name: str, + threat_protection_name: Union[str, _models.ThreatProtectionName], + parameters: _models.ServerThreatProtectionSettingsModel, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ServerThreatProtectionSettingsModel]: + """Creates or updates a server's Advanced Threat Protection settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param threat_protection_name: The name of the Threat Protection state. "Default" Required. + :type threat_protection_name: str or + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ThreatProtectionName + :param parameters: The Advanced Threat Protection state for the flexible server. Required. + :type parameters: + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ServerThreatProtectionSettingsModel + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServerThreatProtectionSettingsModel or + the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql_flexibleservers.models.ServerThreatProtectionSettingsModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + server_name: str, + threat_protection_name: Union[str, _models.ThreatProtectionName], + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ServerThreatProtectionSettingsModel]: + """Creates or updates a server's Advanced Threat Protection settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param threat_protection_name: The name of the Threat Protection state. "Default" Required. + :type threat_protection_name: str or + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ThreatProtectionName + :param parameters: The Advanced Threat Protection state for the flexible server. Required. + :type parameters: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServerThreatProtectionSettingsModel or + the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql_flexibleservers.models.ServerThreatProtectionSettingsModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + server_name: str, + threat_protection_name: Union[str, _models.ThreatProtectionName], + parameters: Union[_models.ServerThreatProtectionSettingsModel, IO], + **kwargs: Any + ) -> LROPoller[_models.ServerThreatProtectionSettingsModel]: + """Creates or updates a server's Advanced Threat Protection settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param threat_protection_name: The name of the Threat Protection state. "Default" Required. + :type threat_protection_name: str or + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ThreatProtectionName + :param parameters: The Advanced Threat Protection state for the flexible server. Is either a + ServerThreatProtectionSettingsModel type or a IO type. Required. + :type parameters: + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.ServerThreatProtectionSettingsModel 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServerThreatProtectionSettingsModel or + the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql_flexibleservers.models.ServerThreatProtectionSettingsModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _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.ServerThreatProtectionSettingsModel] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + threat_protection_name=threat_protection_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ServerThreatProtectionSettingsModel", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/advancedThreatProtectionSettings/{threatProtectionName}" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_servers_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_servers_operations.py index 00a86fabe689..183408556ffd 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_servers_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_servers_operations.py @@ -45,7 +45,7 @@ def build_create_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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -55,7 +55,7 @@ def build_create_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -83,7 +83,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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -93,7 +93,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -121,7 +121,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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -130,7 +130,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -154,7 +154,7 @@ def build_get_request(resource_group_name: str, server_name: str, subscription_i _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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -163,7 +163,7 @@ def build_get_request(resource_group_name: str, server_name: str, subscription_i "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -187,7 +187,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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -196,7 +196,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -217,7 +217,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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -225,7 +225,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/flexibleServers" ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -245,7 +245,7 @@ def build_restart_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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -255,7 +255,7 @@ def build_restart_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/restart", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -281,7 +281,7 @@ def build_start_request(resource_group_name: str, server_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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -290,7 +290,7 @@ def build_start_request(resource_group_name: str, server_name: str, subscription "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/start", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -314,7 +314,7 @@ def build_stop_request(resource_group_name: str, server_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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -323,7 +323,7 @@ def build_stop_request(resource_group_name: str, server_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/stop", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_virtual_endpoints_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_virtual_endpoints_operations.py new file mode 100644 index 000000000000..f57ad1b133b0 --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_virtual_endpoints_operations.py @@ -0,0 +1,1059 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import PostgreSQLManagementClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_request( + resource_group_name: str, server_name: str, virtual_endpoint_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", "2023-06-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/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints/{virtualEndpointName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serverName": _SERIALIZER.url( + "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" + ), + "virtualEndpointName": _SERIALIZER.url( + "virtual_endpoint_name", + virtual_endpoint_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]{0,62}(? 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-06-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/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints/{virtualEndpointName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serverName": _SERIALIZER.url( + "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" + ), + "virtualEndpointName": _SERIALIZER.url( + "virtual_endpoint_name", + virtual_endpoint_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]{0,62}(? 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-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints/{virtualEndpointName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serverName": _SERIALIZER.url( + "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" + ), + "virtualEndpointName": _SERIALIZER.url( + "virtual_endpoint_name", + virtual_endpoint_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]{0,62}(? 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-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints/{virtualEndpointName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serverName": _SERIALIZER.url( + "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" + ), + "virtualEndpointName": _SERIALIZER.url( + "virtual_endpoint_name", + virtual_endpoint_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[A-Za-z0-9][A-Za-z0-9-]{0,62}(? 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-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serverName": _SERIALIZER.url( + "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class VirtualEndpointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.rdbms.postgresql_flexibleservers.PostgreSQLManagementClient`'s + :attr:`virtual_endpoints` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _create_initial( + self, + resource_group_name: str, + server_name: str, + virtual_endpoint_name: str, + parameters: Union[_models.VirtualEndpointResource, IO], + **kwargs: Any + ) -> Optional[_models.VirtualEndpointResource]: + 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[Optional[_models.VirtualEndpointResource]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "VirtualEndpointResource") + + request = build_create_request( + resource_group_name=resource_group_name, + server_name=server_name, + virtual_endpoint_name=virtual_endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.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, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("VirtualEndpointResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VirtualEndpointResource", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints/{virtualEndpointName}" + } + + @overload + def begin_create( + self, + resource_group_name: str, + server_name: str, + virtual_endpoint_name: str, + parameters: _models.VirtualEndpointResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualEndpointResource]: + """Creates a new virtual endpoint for PostgreSQL flexible server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param virtual_endpoint_name: The name of the virtual endpoint. Required. + :type virtual_endpoint_name: str + :param parameters: The required parameters for creating or updating virtual endpoints. + Required. + :type parameters: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualEndpointResource + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VirtualEndpointResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualEndpointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + server_name: str, + virtual_endpoint_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualEndpointResource]: + """Creates a new virtual endpoint for PostgreSQL flexible server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param virtual_endpoint_name: The name of the virtual endpoint. Required. + :type virtual_endpoint_name: str + :param parameters: The required parameters for creating or updating virtual endpoints. + Required. + :type parameters: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VirtualEndpointResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualEndpointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + server_name: str, + virtual_endpoint_name: str, + parameters: Union[_models.VirtualEndpointResource, IO], + **kwargs: Any + ) -> LROPoller[_models.VirtualEndpointResource]: + """Creates a new virtual endpoint for PostgreSQL flexible server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param virtual_endpoint_name: The name of the virtual endpoint. Required. + :type virtual_endpoint_name: str + :param parameters: The required parameters for creating or updating virtual endpoints. Is + either a VirtualEndpointResource type or a IO type. Required. + :type parameters: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualEndpointResource + 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VirtualEndpointResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualEndpointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _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.VirtualEndpointResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + server_name=server_name, + virtual_endpoint_name=virtual_endpoint_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualEndpointResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints/{virtualEndpointName}" + } + + def _update_initial( + self, + resource_group_name: str, + server_name: str, + virtual_endpoint_name: str, + parameters: Union[_models.VirtualEndpointResourceForPatch, IO], + **kwargs: Any + ) -> Optional[_models.VirtualEndpointResource]: + 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[Optional[_models.VirtualEndpointResource]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "VirtualEndpointResourceForPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + server_name=server_name, + virtual_endpoint_name=virtual_endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("VirtualEndpointResource", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints/{virtualEndpointName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + server_name: str, + virtual_endpoint_name: str, + parameters: _models.VirtualEndpointResourceForPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualEndpointResource]: + """Updates an existing virtual endpoint. The request body can contain one to many of the + properties present in the normal virtual endpoint definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param virtual_endpoint_name: The name of the virtual endpoint. Required. + :type virtual_endpoint_name: str + :param parameters: The required parameters for updating a server. Required. + :type parameters: + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualEndpointResourceForPatch + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VirtualEndpointResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualEndpointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + server_name: str, + virtual_endpoint_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualEndpointResource]: + """Updates an existing virtual endpoint. The request body can contain one to many of the + properties present in the normal virtual endpoint definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param virtual_endpoint_name: The name of the virtual endpoint. Required. + :type virtual_endpoint_name: str + :param parameters: The required parameters for updating a server. Required. + :type parameters: 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VirtualEndpointResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualEndpointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + server_name: str, + virtual_endpoint_name: str, + parameters: Union[_models.VirtualEndpointResourceForPatch, IO], + **kwargs: Any + ) -> LROPoller[_models.VirtualEndpointResource]: + """Updates an existing virtual endpoint. The request body can contain one to many of the + properties present in the normal virtual endpoint definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param virtual_endpoint_name: The name of the virtual endpoint. Required. + :type virtual_endpoint_name: str + :param parameters: The required parameters for updating a server. Is either a + VirtualEndpointResourceForPatch type or a IO type. Required. + :type parameters: + ~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualEndpointResourceForPatch 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VirtualEndpointResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualEndpointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _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.VirtualEndpointResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + virtual_endpoint_name=virtual_endpoint_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualEndpointResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints/{virtualEndpointName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, server_name: str, virtual_endpoint_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = 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)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + server_name=server_name, + virtual_endpoint_name=virtual_endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.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 [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints/{virtualEndpointName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, server_name: str, virtual_endpoint_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a virtual endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param virtual_endpoint_name: The name of the virtual endpoint. Required. + :type virtual_endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = 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)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + server_name=server_name, + virtual_endpoint_name=virtual_endpoint_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints/{virtualEndpointName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, server_name: str, virtual_endpoint_name: str, **kwargs: Any + ) -> _models.VirtualEndpointResource: + """Gets information about a virtual endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param virtual_endpoint_name: The name of the virtual endpoint. Required. + :type virtual_endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualEndpointResource or the result of cls(response) + :rtype: ~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualEndpointResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = 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)) + cls: ClsType[_models.VirtualEndpointResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + server_name=server_name, + virtual_endpoint_name=virtual_endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualEndpointResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints/{virtualEndpointName}" + } + + @distributed_trace + def list_by_server( + self, resource_group_name: str, server_name: str, **kwargs: Any + ) -> Iterable["_models.VirtualEndpointResource"]: + """List all the servers in a given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualEndpointResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.rdbms.postgresql_flexibleservers.models.VirtualEndpointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = 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)) + cls: ClsType[_models.VirtualEndpointsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_server_request( + resource_group_name=resource_group_name, + server_name=server_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_server.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualEndpointsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_server.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/virtualendpoints" + } diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_virtual_network_subnet_usage_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_virtual_network_subnet_usage_operations.py index 6aed8d686634..e9622d8dc637 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_virtual_network_subnet_usage_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql_flexibleservers/operations/_virtual_network_subnet_usage_operations.py @@ -39,7 +39,7 @@ def build_execute_request(location_name: str, subscription_id: str, **kwargs: An _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-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -49,7 +49,7 @@ def build_execute_request(location_name: str, subscription_id: str, **kwargs: An "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/checkVirtualNetworkSubnetUsage", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "locationName": _SERIALIZER.url("location_name", location_name, "str", min_length=1, pattern=r"^[-\w\._]+$"), } diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/administrator_add.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/administrator_add.py index c0c5b2df2cab..a6a71911c146 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/administrator_add.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/administrator_add.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/AdministratorAdd.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/AdministratorAdd.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/administrator_delete.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/administrator_delete.py index 27e390f0075b..299567458c29 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/administrator_delete.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/administrator_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/AdministratorDelete.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/AdministratorDelete.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/administrator_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/administrator_get.py index 11dccd251893..b32532f32406 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/administrator_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/administrator_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/AdministratorGet.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/AdministratorGet.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/administrators_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/administrators_list_by_server.py index 2e5e2876fb54..9165b4889f58 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/administrators_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/administrators_list_by_server.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/AdministratorsListByServer.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/AdministratorsListByServer.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/backup_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/backup_get.py index d769d3370e1c..be283e225a5b 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/backup_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/backup_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/BackupGet.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/BackupGet.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/backup_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/backup_list_by_server.py index d7102783dd8e..a0414f4fa271 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/backup_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/backup_list_by_server.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/BackupListByServer.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/BackupListByServer.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/capabilities_by_location.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/capabilities_by_location.py index 76a1a767791b..c3f0b044cfa2 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/capabilities_by_location.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/capabilities_by_location.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/CapabilitiesByLocation.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/CapabilitiesByLocation.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/check_migration_name_availability.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/check_migration_name_availability.py index 98a7355ad3b9..d8d956dcb247 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/check_migration_name_availability.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/check_migration_name_availability.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/CheckMigrationNameAvailability.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/CheckMigrationNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/check_name_availability.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/check_name_availability.py index 477d163ae3f5..7359079b8c23 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/check_name_availability.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/check_name_availability.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/CheckNameAvailability.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/CheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/check_name_availability_location_based.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/check_name_availability_location_based.py index b742fbdf7e56..e444f22e4cf9 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/check_name_availability_location_based.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/check_name_availability_location_based.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/CheckNameAvailabilityLocationBased.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/CheckNameAvailabilityLocationBased.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/configuration_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/configuration_get.py index 9b6146032b0b..8bd1dbba531a 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/configuration_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/configuration_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ConfigurationGet.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/ConfigurationGet.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/configuration_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/configuration_list_by_server.py index d4d5bad05ffb..38ee6a1be1d4 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/configuration_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/configuration_list_by_server.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ConfigurationListByServer.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/ConfigurationListByServer.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/configuration_update.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/configuration_update.py index 8c5de53952f7..de3a34977887 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/configuration_update.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/configuration_update.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ConfigurationUpdate.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/ConfigurationUpdate.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/database_create.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/database_create.py index fbeb5bd169f2..736406c93830 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/database_create.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/database_create.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/DatabaseCreate.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/DatabaseCreate.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/database_delete.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/database_delete.py index 180971f556a3..b3b20c9a6a72 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/database_delete.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/database_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/DatabaseDelete.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/DatabaseDelete.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/database_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/database_get.py index fa3790aab3a5..19c64860c69d 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/database_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/database_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/DatabaseGet.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/DatabaseGet.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/databases_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/databases_list_by_server.py index 28004ccfc4c8..be2ab0f74d7b 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/databases_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/databases_list_by_server.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/DatabasesListByServer.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/DatabasesListByServer.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/firewall_rule_create.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/firewall_rule_create.py index b02c8ffc9c80..d241ceec4c11 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/firewall_rule_create.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/firewall_rule_create.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/FirewallRuleCreate.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/FirewallRuleCreate.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/firewall_rule_delete.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/firewall_rule_delete.py index e7a82e84f422..9509e3856774 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/firewall_rule_delete.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/firewall_rule_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/FirewallRuleDelete.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/FirewallRuleDelete.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/firewall_rule_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/firewall_rule_get.py index 1578d6e8dfba..5cafdf86a260 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/firewall_rule_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/firewall_rule_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/FirewallRuleGet.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/FirewallRuleGet.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/firewall_rule_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/firewall_rule_list_by_server.py index 0bc209a94fed..50b8545c4fde 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/firewall_rule_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/firewall_rule_list_by_server.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/FirewallRuleListByServer.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/FirewallRuleListByServer.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/get_private_dns_zone_suffix.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/get_private_dns_zone_suffix.py index d0a394c77c60..a8f0a9c9d9b1 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/get_private_dns_zone_suffix.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/get_private_dns_zone_suffix.py @@ -33,6 +33,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/GetPrivateDnsZoneSuffix.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/GetPrivateDnsZoneSuffix.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/log_files_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/log_files_list_by_server.py index 35cea365ba0b..cdf23eaefff5 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/log_files_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/log_files_list_by_server.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/LogFilesListByServer.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/LogFilesListByServer.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/long_term_retention_backup.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/long_term_retention_backup.py index a72292ffa986..5dd7f5b38a9f 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/long_term_retention_backup.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/long_term_retention_backup.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/LongTermRetentionBackup.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/LongTermRetentionBackup.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/long_term_retention_operation_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/long_term_retention_operation_get.py index 3cd0b6bace4d..3aa7e3e67bce 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/long_term_retention_operation_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/long_term_retention_operation_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/LongTermRetentionOperationGet.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/LongTermRetentionOperationGet.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/long_term_retention_operation_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/long_term_retention_operation_list_by_server.py index dd83abba1b9a..bcdbd4a7bfe9 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/long_term_retention_operation_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/long_term_retention_operation_list_by_server.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/LongTermRetentionOperationListByServer.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/LongTermRetentionOperationListByServer.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/long_term_retention_pre_backup.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/long_term_retention_pre_backup.py index 15c02ab9f53c..0d8a116e1c17 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/long_term_retention_pre_backup.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/long_term_retention_pre_backup.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/LongTermRetentionPreBackup.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/LongTermRetentionPreBackup.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_cancel.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_cancel.py index 63863318883d..0c2c4aa70f1c 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_cancel.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_cancel.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/Migrations_Cancel.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/Migrations_Cancel.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_create.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_create.py index c0ef36dd16d1..8faa17c3381a 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_create.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_create.py @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/Migrations_Create.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/Migrations_Create.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_create_other_source_types_validate_migrate.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_create_other_source_types_validate_migrate.py new file mode 100644 index 000000000000..bb4133d70c92 --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_create_other_source_types_validate_migrate.py @@ -0,0 +1,58 @@ +# 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.rdbms.postgresql_flexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python migrations_create_other_source_types_validate_migrate.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 = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.migrations.create( + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + resource_group_name="testrg", + target_db_server_name="testtarget", + migration_name="testmigration", + parameters={ + "location": "westus", + "properties": { + "dbsToMigrate": ["db1", "db2", "db3", "db4"], + "migrationMode": "Offline", + "migrationOption": "ValidateAndMigrate", + "overwriteDbsInTarget": "True", + "secretParameters": { + "adminCredentials": {"sourceServerPassword": "xxxxxxxx", "targetServerPassword": "xxxxxxxx"} + }, + "sourceDbServerResourceId": "testsource:5432@pguser", + "sourceType": "OnPremises", + "sslMode": "Prefer", + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/Migrations_Create_Other_SourceTypes_Validate_Migrate.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_create_validate_only.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_create_validate_only.py new file mode 100644 index 000000000000..5c18cd82f3c3 --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_create_validate_only.py @@ -0,0 +1,56 @@ +# 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.rdbms.postgresql_flexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python migrations_create_validate_only.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 = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.migrations.create( + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + resource_group_name="testrg", + target_db_server_name="testtarget", + migration_name="testmigration", + parameters={ + "location": "westus", + "properties": { + "dbsToMigrate": ["db1", "db2", "db3", "db4"], + "migrationMode": "Offline", + "migrationOption": "Validate", + "overwriteDbsInTarget": "True", + "secretParameters": { + "adminCredentials": {"sourceServerPassword": "xxxxxxxx", "targetServerPassword": "xxxxxxxx"} + }, + "sourceDbServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBForPostgreSql/servers/testsource", + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/Migrations_Create_Validate_Only.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_create_with_other_users.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_create_with_other_users.py index 539e36689d74..f6efba0b0047 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_create_with_other_users.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_create_with_other_users.py @@ -51,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/Migrations_Create_With_Other_Users.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/Migrations_Create_With_Other_Users.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_delete.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_delete.py index ea8c32e08b1f..676402943288 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_delete.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_delete.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/Migrations_Delete.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/Migrations_Delete.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_get.py index 14b8b9e361f7..9edce0e92b64 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/Migrations_Get.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/Migrations_Get.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_get_migration_with_successful_validation_and_migration.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_get_migration_with_successful_validation_and_migration.py new file mode 100644 index 000000000000..11b9d5e4e34b --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_get_migration_with_successful_validation_and_migration.py @@ -0,0 +1,43 @@ +# 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.rdbms.postgresql_flexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python migrations_get_migration_with_successful_validation_and_migration.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 = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.migrations.get( + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + resource_group_name="testrg", + target_db_server_name="testtarget", + migration_name="testmigrationwithsuccessfulvalidationandmigration", + ) + print(response) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/Migrations_GetMigrationWithSuccessfulValidationAndMigration.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_get_migration_with_successful_validation_but_migration_failure.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_get_migration_with_successful_validation_but_migration_failure.py new file mode 100644 index 000000000000..c289fb14c7a1 --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_get_migration_with_successful_validation_but_migration_failure.py @@ -0,0 +1,43 @@ +# 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.rdbms.postgresql_flexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python migrations_get_migration_with_successful_validation_but_migration_failure.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 = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.migrations.get( + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + resource_group_name="testrg", + target_db_server_name="testtarget", + migration_name="testmigrationwithsuccessfulvalidationbutmigrationfailure", + ) + print(response) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/Migrations_GetMigrationWithSuccessfulValidationButMigrationFailure.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_get_migration_with_successful_validation_only.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_get_migration_with_successful_validation_only.py new file mode 100644 index 000000000000..1a8f910c187a --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_get_migration_with_successful_validation_only.py @@ -0,0 +1,43 @@ +# 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.rdbms.postgresql_flexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python migrations_get_migration_with_successful_validation_only.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 = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.migrations.get( + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + resource_group_name="testrg", + target_db_server_name="testtarget", + migration_name="testmigrationwithsuccessfulvalidationonly", + ) + print(response) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/Migrations_GetMigrationWithSuccessfulValidationOnly.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_get_migration_with_validation_failures.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_get_migration_with_validation_failures.py new file mode 100644 index 000000000000..46246a779f94 --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_get_migration_with_validation_failures.py @@ -0,0 +1,43 @@ +# 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.rdbms.postgresql_flexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python migrations_get_migration_with_validation_failures.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 = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.migrations.get( + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + resource_group_name="testrg", + target_db_server_name="testtarget", + migration_name="testmigrationwithvalidationfailure", + ) + print(response) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/Migrations_GetMigrationWithValidationFailures.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_list_by_target_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_list_by_target_server.py index efe7ffb25345..141214f63d31 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_list_by_target_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_list_by_target_server.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/Migrations_ListByTargetServer.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/Migrations_ListByTargetServer.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_update.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_update.py index 03449d5f1088..093aad37e5d1 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_update.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/migrations_update.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/Migrations_Update.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/Migrations_Update.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/operation_list.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/operation_list.py index 0a2268abe7d5..0d181b51dc5d 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/operation_list.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/operation_list.py @@ -33,6 +33,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/OperationList.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/OperationList.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/private_endpoint_connection_delete.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/private_endpoint_connection_delete.py new file mode 100644 index 000000000000..fe2a0833a785 --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/private_endpoint_connection_delete.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.rdbms.postgresql_flexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python private_endpoint_connection_delete.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 = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + client.private_endpoint_connection.begin_delete( + resource_group_name="Default", + server_name="test-svr", + private_endpoint_connection_name="private-endpoint-connection-name.1fa229cd-bf3f-47f0-8c49-afb36723997e", + ).result() + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/PrivateEndpointConnectionDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/private_endpoint_connection_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/private_endpoint_connection_get.py new file mode 100644 index 000000000000..fab8dc3a122e --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/private_endpoint_connection_get.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.rdbms.postgresql_flexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python private_endpoint_connection_get.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 = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.private_endpoint_connections.get( + resource_group_name="Default", + server_name="test-svr", + private_endpoint_connection_name="private-endpoint-connection-name.1fa229cd-bf3f-47f0-8c49-afb36723997e", + ) + print(response) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/PrivateEndpointConnectionGet.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/private_endpoint_connection_list.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/private_endpoint_connection_list.py new file mode 100644 index 000000000000..99595cef1081 --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/private_endpoint_connection_list.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.rdbms.postgresql_flexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python private_endpoint_connection_list.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 = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.private_endpoint_connections.list_by_server( + resource_group_name="Default", + server_name="test-svr", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/PrivateEndpointConnectionList.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/private_endpoint_connection_update.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/private_endpoint_connection_update.py new file mode 100644 index 000000000000..b9bbe02c00fb --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/private_endpoint_connection_update.py @@ -0,0 +1,50 @@ +# 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.rdbms.postgresql_flexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python private_endpoint_connection_update.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 = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.private_endpoint_connection.begin_update( + resource_group_name="Default", + server_name="test-svr", + private_endpoint_connection_name="private-endpoint-connection-name.1fa229cd-bf3f-47f0-8c49-afb36723997e", + parameters={ + "properties": { + "privateLinkServiceConnectionState": { + "description": "Approved by johndoe@contoso.com", + "status": "Approved", + } + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/PrivateEndpointConnectionUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/private_link_resources_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/private_link_resources_get.py new file mode 100644 index 000000000000..5be8481dc8ae --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/private_link_resources_get.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.rdbms.postgresql_flexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python private_link_resources_get.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 = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.private_link_resources.get( + resource_group_name="Default", + server_name="test-svr", + group_name="plr", + ) + print(response) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/PrivateLinkResourcesGet.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/private_link_resources_list.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/private_link_resources_list.py new file mode 100644 index 000000000000..ccf0e9231d3a --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/private_link_resources_list.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.rdbms.postgresql_flexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python private_link_resources_list.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 = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.private_link_resources.list_by_server( + resource_group_name="Default", + server_name="test-svr", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/PrivateLinkResourcesList.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/promote_replica_as_forced_standalone_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/promote_replica_as_forced_standalone_server.py new file mode 100644 index 000000000000..3c216d47000a --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/promote_replica_as_forced_standalone_server.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.rdbms.postgresql_flexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python promote_replica_as_forced_standalone_server.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 = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.servers.begin_update( + resource_group_name="testResourceGroup", + server_name="pgtestsvc4-replica", + parameters={"properties": {"replica": {"promoteMode": "standalone", "promoteOption": "forced"}}}, + ).result() + print(response) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/PromoteReplicaAsForcedStandaloneServer.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/promote_replica_as_forced_switchover.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/promote_replica_as_forced_switchover.py new file mode 100644 index 000000000000..8948c43e9281 --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/promote_replica_as_forced_switchover.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.rdbms.postgresql_flexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python promote_replica_as_forced_switchover.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 = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.servers.begin_update( + resource_group_name="testResourceGroup", + server_name="pgtestsvc4-replica", + parameters={"properties": {"replica": {"promoteMode": "switchover", "promoteOption": "forced"}}}, + ).result() + print(response) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/PromoteReplicaAsForcedSwitchover.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/promote_replica_as_planned_standalone_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/promote_replica_as_planned_standalone_server.py new file mode 100644 index 000000000000..d0c5f7f6d87b --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/promote_replica_as_planned_standalone_server.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.rdbms.postgresql_flexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python promote_replica_as_planned_standalone_server.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 = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.servers.begin_update( + resource_group_name="testResourceGroup", + server_name="pgtestsvc4-replica", + parameters={"properties": {"replica": {"promoteMode": "standalone", "promoteOption": "planned"}}}, + ).result() + print(response) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/PromoteReplicaAsPlannedStandaloneServer.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/promote_replica_as_planned_switchover.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/promote_replica_as_planned_switchover.py new file mode 100644 index 000000000000..8623befbf17b --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/promote_replica_as_planned_switchover.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.rdbms.postgresql_flexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python promote_replica_as_planned_switchover.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 = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.servers.begin_update( + resource_group_name="testResourceGroup", + server_name="pgtestsvc4-replica", + parameters={"properties": {"replica": {"promoteMode": "switchover", "promoteOption": "planned"}}}, + ).result() + print(response) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/PromoteReplicaAsPlannedSwitchover.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/quota_usages_for_flexible_servers.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/quota_usages_for_flexible_servers.py new file mode 100644 index 000000000000..a76e53c42ced --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/quota_usages_for_flexible_servers.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.rdbms.postgresql_flexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python quota_usages_for_flexible_servers.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 = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.quota_usages.list( + location_name="westus", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/QuotaUsagesForFlexibleServers.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/replicas_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/replicas_list_by_server.py index 65c2fa865af6..11da8a7671eb 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/replicas_list_by_server.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/replicas_list_by_server.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ReplicasListByServer.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/ReplicasListByServer.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_capabilities.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_capabilities.py index 678b856f8152..fdb63841d367 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_capabilities.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_capabilities.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerCapabilities.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/ServerCapabilities.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_create.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_create.py index e89c4e67b540..da6e92f29f1a 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_create.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_create.py @@ -55,6 +55,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerCreate.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/ServerCreate.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_create_geo_restore_with_data_encryption_enabled.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_create_geo_restore_with_data_encryption_enabled.py index 6cb251824767..fe6f6c4a950e 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_create_geo_restore_with_data_encryption_enabled.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_create_geo_restore_with_data_encryption_enabled.py @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerCreateGeoRestoreWithDataEncryptionEnabled.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/ServerCreateGeoRestoreWithDataEncryptionEnabled.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_create_point_in_time_restore.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_create_point_in_time_restore.py index 511a98140765..342d9678934c 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_create_point_in_time_restore.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_create_point_in_time_restore.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerCreatePointInTimeRestore.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/ServerCreatePointInTimeRestore.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_create_replica.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_create_replica.py index e0b6c0d3ded7..2bafc726069d 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_create_replica.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_create_replica.py @@ -57,6 +57,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerCreateReplica.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/ServerCreateReplica.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_create_revive_dropped.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_create_revive_dropped.py index bd9cfc209ef7..b9df60d8892b 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_create_revive_dropped.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_create_revive_dropped.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerCreateReviveDropped.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/ServerCreateReviveDropped.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_create_with_aad_auth_enabled.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_create_with_aad_auth_enabled.py index 56e8a5344e5b..19e58edaa488 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_create_with_aad_auth_enabled.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_create_with_aad_auth_enabled.py @@ -61,6 +61,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerCreateWithAadAuthEnabled.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/ServerCreateWithAadAuthEnabled.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_create_with_data_encryption_enabled.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_create_with_data_encryption_enabled.py index a2fb98296fc0..83d96cefdb6b 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_create_with_data_encryption_enabled.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_create_with_data_encryption_enabled.py @@ -68,6 +68,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerCreateWithDataEncryptionEnabled.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/ServerCreateWithDataEncryptionEnabled.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_delete.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_delete.py index 867bba9d903e..17847e968e6a 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_delete.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerDelete.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/ServerDelete.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_get.py index e48f10073dfc..7b95f61a45e2 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_get.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerGet.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/ServerGet.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_get_with_private_endpoints.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_get_with_private_endpoints.py new file mode 100644 index 000000000000..5be403efac9d --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_get_with_private_endpoints.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.rdbms.postgresql_flexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python server_get_with_private_endpoints.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 = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.servers.get( + resource_group_name="testrg", + server_name="pgtestsvc2", + ) + print(response) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/ServerGetWithPrivateEndpoints.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_get_with_vnet.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_get_with_vnet.py index e23a260a1cee..3213194848f9 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_get_with_vnet.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_get_with_vnet.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerGetWithVnet.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/ServerGetWithVnet.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_list.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_list.py index 5bee18631192..14aa4b7847c8 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_list.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerList.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/ServerList.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_list_by_resource_group.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_list_by_resource_group.py index 45a18c1ac62f..0f30b595ff64 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_list_by_resource_group.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerListByResourceGroup.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/ServerListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_restart.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_restart.py index 339996d87bdc..9d7ef1a2b93a 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_restart.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_restart.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerRestart.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/ServerRestart.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_restart_with_failover.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_restart_with_failover.py index 14a35b911db6..c7c7c1e35f50 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_restart_with_failover.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_restart_with_failover.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerRestartWithFailover.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/ServerRestartWithFailover.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_start.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_start.py index 10cf6d2d8f4b..b96556bea61e 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_start.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_start.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerStart.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/ServerStart.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_stop.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_stop.py index cdbaf46f6c11..bac6697ea709 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_stop.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_stop.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerStop.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/ServerStop.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_threat_protection_settings_create.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_threat_protection_settings_create.py new file mode 100644 index 000000000000..5b7035a6aee9 --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_threat_protection_settings_create.py @@ -0,0 +1,43 @@ +# 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.rdbms.postgresql_flexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python server_threat_protection_settings_create.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 = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.server_threat_protection_settings.begin_create_or_update( + resource_group_name="threatprotection-4799", + server_name="threatprotection-6440", + threat_protection_name="Default", + parameters={"properties": {"state": "Enabled"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/ServerThreatProtectionSettingsCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_threat_protection_settings_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_threat_protection_settings_get.py new file mode 100644 index 000000000000..6d8f4cfee54b --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_threat_protection_settings_get.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.rdbms.postgresql_flexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python server_threat_protection_settings_get.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 = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.server_threat_protection_settings.get( + resource_group_name="threatprotection-6852", + server_name="threatprotection-2080", + threat_protection_name="Default", + ) + print(response) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/ServerThreatProtectionSettingsGet.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_threat_protection_settings_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_threat_protection_settings_list_by_server.py new file mode 100644 index 000000000000..0ad951f0b8ff --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_threat_protection_settings_list_by_server.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.rdbms.postgresql_flexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python server_threat_protection_settings_list_by_server.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 = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.server_threat_protection_settings.list_by_server( + resource_group_name="threatprotection-6852", + server_name="threatprotection-2080", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/ServerThreatProtectionSettingsListByServer.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_update.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_update.py index 402ed9b64fb1..e7bded4471fe 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_update.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_update.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerUpdate.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/ServerUpdate.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_update_with_aad_auth_enabled.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_update_with_aad_auth_enabled.py index 92f7ce545ce8..1359b31642c3 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_update_with_aad_auth_enabled.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_update_with_aad_auth_enabled.py @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerUpdateWithAadAuthEnabled.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/ServerUpdateWithAadAuthEnabled.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_update_with_customer_maintenance_window.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_update_with_customer_maintenance_window.py index 7632eae04b39..dc593706bd41 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_update_with_customer_maintenance_window.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_update_with_customer_maintenance_window.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerUpdateWithCustomerMaintenanceWindow.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/ServerUpdateWithCustomerMaintenanceWindow.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_update_with_data_encryption_enabled.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_update_with_data_encryption_enabled.py index 2d942269d621..6a739ba6d5f4 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_update_with_data_encryption_enabled.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_update_with_data_encryption_enabled.py @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerUpdateWithDataEncryptionEnabled.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/ServerUpdateWithDataEncryptionEnabled.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_update_with_major_version_upgrade.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_update_with_major_version_upgrade.py index de065d920c26..f61bbe795c70 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_update_with_major_version_upgrade.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/server_update_with_major_version_upgrade.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerUpdateWithMajorVersionUpgrade.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/ServerUpdateWithMajorVersionUpgrade.json if __name__ == "__main__": main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/virtual_endpoint_create.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/virtual_endpoint_create.py new file mode 100644 index 000000000000..3b8881b2b78b --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/virtual_endpoint_create.py @@ -0,0 +1,43 @@ +# 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.rdbms.postgresql_flexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python virtual_endpoint_create.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 = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.virtual_endpoints.begin_create( + resource_group_name="testrg", + server_name="pgtestsvc4", + virtual_endpoint_name="pgVirtualEndpoint1", + parameters={"properties": {"endpointType": "ReadWrite", "members": ["testPrimary1"]}}, + ).result() + print(response) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/VirtualEndpointCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/virtual_endpoint_delete.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/virtual_endpoint_delete.py new file mode 100644 index 000000000000..6bd6e95260ea --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/virtual_endpoint_delete.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.rdbms.postgresql_flexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python virtual_endpoint_delete.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 = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + client.virtual_endpoints.begin_delete( + resource_group_name="testrg", + server_name="pgtestsvc4", + virtual_endpoint_name="pgVirtualEndpoint1", + ).result() + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/VirtualEndpointDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/virtual_endpoint_update.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/virtual_endpoint_update.py new file mode 100644 index 000000000000..aca699f91b71 --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/virtual_endpoint_update.py @@ -0,0 +1,43 @@ +# 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.rdbms.postgresql_flexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python virtual_endpoint_update.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 = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.virtual_endpoints.begin_update( + resource_group_name="testrg", + server_name="pgtestsvc4", + virtual_endpoint_name="pgVirtualEndpoint1", + parameters={"properties": {"endpointType": "ReadWrite", "members": ["testReplica1"]}}, + ).result() + print(response) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/VirtualEndpointUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/virtual_endpoints_get.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/virtual_endpoints_get.py new file mode 100644 index 000000000000..f79ddcdb0254 --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/virtual_endpoints_get.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.rdbms.postgresql_flexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python virtual_endpoints_get.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 = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.virtual_endpoints.get( + resource_group_name="testrg", + server_name="pgtestsvc4", + virtual_endpoint_name="pgVirtualEndpoint1", + ) + print(response) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/VirtualEndpointsGet.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/virtual_endpoints_list_by_server.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/virtual_endpoints_list_by_server.py new file mode 100644 index 000000000000..f215369e43f7 --- /dev/null +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/virtual_endpoints_list_by_server.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.rdbms.postgresql_flexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-rdbms +# USAGE + python virtual_endpoints_list_by_server.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 = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.virtual_endpoints.list_by_server( + resource_group_name="testrg", + server_name="pgtestsvc4", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/VirtualEndpointsListByServer.json +if __name__ == "__main__": + main() diff --git a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/virtual_network_subnet_usage.py b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/virtual_network_subnet_usage.py index fa54bbe4ea45..3e7492e8f6d9 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/virtual_network_subnet_usage.py +++ b/sdk/rdbms/azure-mgmt-rdbms/generated_samples/postgresql_flexibleservers/virtual_network_subnet_usage.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/VirtualNetworkSubnetUsage.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/examples/VirtualNetworkSubnetUsage.json if __name__ == "__main__": main()