diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py index 5312457b984e..7caf437cb9d9 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py @@ -165,6 +165,9 @@ from .usage_py3 import Usage from .managed_instance_py3 import ManagedInstance from .managed_instance_update_py3 import ManagedInstanceUpdate + from .private_endpoint_property_py3 import PrivateEndpointProperty + from .private_link_service_connection_state_property_py3 import PrivateLinkServiceConnectionStateProperty + from .private_endpoint_connection_py3 import PrivateEndpointConnection except (SyntaxError, ImportError): from .recoverable_database import RecoverableDatabase from .restorable_dropped_database import RestorableDroppedDatabase @@ -321,6 +324,9 @@ from .usage import Usage from .managed_instance import ManagedInstance from .managed_instance_update import ManagedInstanceUpdate + from .private_endpoint_property import PrivateEndpointProperty + from .private_link_service_connection_state_property import PrivateLinkServiceConnectionStateProperty + from .private_endpoint_connection import PrivateEndpointConnection from .recoverable_database_paged import RecoverableDatabasePaged from .restorable_dropped_database_paged import RestorableDroppedDatabasePaged from .server_paged import ServerPaged @@ -388,6 +394,7 @@ from .instance_pool_paged import InstancePoolPaged from .usage_paged import UsagePaged from .managed_instance_paged import ManagedInstancePaged +from .private_endpoint_connection_paged import PrivateEndpointConnectionPaged from .sql_management_client_enums import ( CheckNameAvailabilityReason, ServerConnectionType, @@ -628,6 +635,9 @@ 'Usage', 'ManagedInstance', 'ManagedInstanceUpdate', + 'PrivateEndpointProperty', + 'PrivateLinkServiceConnectionStateProperty', + 'PrivateEndpointConnection', 'RecoverableDatabasePaged', 'RestorableDroppedDatabasePaged', 'ServerPaged', @@ -695,6 +705,7 @@ 'InstancePoolPaged', 'UsagePaged', 'ManagedInstancePaged', + 'PrivateEndpointConnectionPaged', 'CheckNameAvailabilityReason', 'ServerConnectionType', 'SecurityAlertPolicyState', diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy.py index 6db06ede30ad..a876b8f41b7e 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy.py @@ -112,8 +112,8 @@ class DatabaseBlobAuditingPolicy(ProxyResource): :type is_storage_secondary_key_in_use: bool :param is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure Monitor. - In order to send the events to Azure Monitor, specify 'State' as 'Enabled' - and 'IsAzureMonitorTargetEnabled' as true. + In order to send the events to Azure Monitor, specify 'state' as 'Enabled' + and 'isAzureMonitorTargetEnabled' as true. When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy_py3.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy_py3.py index 2acc43dae952..61a10bea2826 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy_py3.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy_py3.py @@ -112,8 +112,8 @@ class DatabaseBlobAuditingPolicy(ProxyResource): :type is_storage_secondary_key_in_use: bool :param is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure Monitor. - In order to send the events to Azure Monitor, specify 'State' as 'Enabled' - and 'IsAzureMonitorTargetEnabled' as true. + In order to send the events to Azure Monitor, specify 'state' as 'Enabled' + and 'isAzureMonitorTargetEnabled' as true. When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy.py index 48c324aa3153..60094bcebfac 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy.py @@ -113,8 +113,8 @@ class ExtendedDatabaseBlobAuditingPolicy(ProxyResource): :type is_storage_secondary_key_in_use: bool :param is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure Monitor. - In order to send the events to Azure Monitor, specify 'State' as 'Enabled' - and 'IsAzureMonitorTargetEnabled' as true. + In order to send the events to Azure Monitor, specify 'state' as 'Enabled' + and 'isAzureMonitorTargetEnabled' as true. When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy_py3.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy_py3.py index 9550f279968c..d9afecba93ce 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy_py3.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy_py3.py @@ -113,8 +113,8 @@ class ExtendedDatabaseBlobAuditingPolicy(ProxyResource): :type is_storage_secondary_key_in_use: bool :param is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure Monitor. - In order to send the events to Azure Monitor, specify 'State' as 'Enabled' - and 'IsAzureMonitorTargetEnabled' as true. + In order to send the events to Azure Monitor, specify 'state' as 'Enabled' + and 'isAzureMonitorTargetEnabled' as true. When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy.py index ac110357f4b8..a01ca19ec921 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy.py @@ -113,8 +113,8 @@ class ExtendedServerBlobAuditingPolicy(ProxyResource): :type is_storage_secondary_key_in_use: bool :param is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure Monitor. - In order to send the events to Azure Monitor, specify 'State' as 'Enabled' - and 'IsAzureMonitorTargetEnabled' as true. + In order to send the events to Azure Monitor, specify 'state' as 'Enabled' + and 'isAzureMonitorTargetEnabled' as true. When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy_py3.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy_py3.py index 89b96febe17d..7144342ec5ff 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy_py3.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy_py3.py @@ -113,8 +113,8 @@ class ExtendedServerBlobAuditingPolicy(ProxyResource): :type is_storage_secondary_key_in_use: bool :param is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure Monitor. - In order to send the events to Azure Monitor, specify 'State' as 'Enabled' - and 'IsAzureMonitorTargetEnabled' as true. + In order to send the events to Azure Monitor, specify 'state' as 'Enabled' + and 'isAzureMonitorTargetEnabled' as true. When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/private_endpoint_connection.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/private_endpoint_connection.py new file mode 100644 index 000000000000..487ae55f264e --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/private_endpoint_connection.py @@ -0,0 +1,57 @@ +# 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 .proxy_resource import ProxyResource + + +class PrivateEndpointConnection(ProxyResource): + """A private endpoint connection. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param private_endpoint: Private endpoint which the connection belongs to. + :type private_endpoint: ~azure.mgmt.sql.models.PrivateEndpointProperty + :param private_link_service_connection_state: Connection State of the + Private Endpoint Connection. + :type private_link_service_connection_state: + ~azure.mgmt.sql.models.PrivateLinkServiceConnectionStateProperty + :ivar provisioning_state: State of the Private Endpoint Connection. + :vartype provisioning_state: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpointProperty'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionStateProperty'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.private_endpoint = kwargs.get('private_endpoint', None) + self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) + self.provisioning_state = None diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/private_endpoint_connection_paged.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/private_endpoint_connection_paged.py new file mode 100644 index 000000000000..a20046417e16 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/private_endpoint_connection_paged.py @@ -0,0 +1,27 @@ +# 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 msrest.paging import Paged + + +class PrivateEndpointConnectionPaged(Paged): + """ + A paging container for iterating over a list of :class:`PrivateEndpointConnection ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[PrivateEndpointConnection]'} + } + + def __init__(self, *args, **kwargs): + + super(PrivateEndpointConnectionPaged, self).__init__(*args, **kwargs) diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/private_endpoint_connection_py3.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/private_endpoint_connection_py3.py new file mode 100644 index 000000000000..9c8c34da2abd --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/private_endpoint_connection_py3.py @@ -0,0 +1,57 @@ +# 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 .proxy_resource_py3 import ProxyResource + + +class PrivateEndpointConnection(ProxyResource): + """A private endpoint connection. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param private_endpoint: Private endpoint which the connection belongs to. + :type private_endpoint: ~azure.mgmt.sql.models.PrivateEndpointProperty + :param private_link_service_connection_state: Connection State of the + Private Endpoint Connection. + :type private_link_service_connection_state: + ~azure.mgmt.sql.models.PrivateLinkServiceConnectionStateProperty + :ivar provisioning_state: State of the Private Endpoint Connection. + :vartype provisioning_state: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpointProperty'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionStateProperty'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__(self, *, private_endpoint=None, private_link_service_connection_state=None, **kwargs) -> None: + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = None diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/private_endpoint_property.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/private_endpoint_property.py new file mode 100644 index 000000000000..81e1299ae751 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/private_endpoint_property.py @@ -0,0 +1,28 @@ +# 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 msrest.serialization import Model + + +class PrivateEndpointProperty(Model): + """PrivateEndpointProperty. + + :param id: Resource id of the private endpoint. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PrivateEndpointProperty, self).__init__(**kwargs) + self.id = kwargs.get('id', None) diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/private_endpoint_property_py3.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/private_endpoint_property_py3.py new file mode 100644 index 000000000000..708fe94a4069 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/private_endpoint_property_py3.py @@ -0,0 +1,28 @@ +# 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 msrest.serialization import Model + + +class PrivateEndpointProperty(Model): + """PrivateEndpointProperty. + + :param id: Resource id of the private endpoint. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str=None, **kwargs) -> None: + super(PrivateEndpointProperty, self).__init__(**kwargs) + self.id = id diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/private_link_service_connection_state_property.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/private_link_service_connection_state_property.py new file mode 100644 index 000000000000..acda20a8240b --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/private_link_service_connection_state_property.py @@ -0,0 +1,48 @@ +# 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 msrest.serialization import Model + + +class PrivateLinkServiceConnectionStateProperty(Model): + """PrivateLinkServiceConnectionStateProperty. + + 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. + + :param status: Required. The private link service connection status. + :type status: str + :param description: Required. The private link service connection + description. + :type description: str + :ivar actions_required: The private link service connection description. + :vartype actions_required: str + """ + + _validation = { + 'status': {'required': True}, + 'description': {'required': True}, + 'actions_required': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PrivateLinkServiceConnectionStateProperty, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.description = kwargs.get('description', None) + self.actions_required = None diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/private_link_service_connection_state_property_py3.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/private_link_service_connection_state_property_py3.py new file mode 100644 index 000000000000..cd750ecf1a9a --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/private_link_service_connection_state_property_py3.py @@ -0,0 +1,48 @@ +# 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 msrest.serialization import Model + + +class PrivateLinkServiceConnectionStateProperty(Model): + """PrivateLinkServiceConnectionStateProperty. + + 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. + + :param status: Required. The private link service connection status. + :type status: str + :param description: Required. The private link service connection + description. + :type description: str + :ivar actions_required: The private link service connection description. + :vartype actions_required: str + """ + + _validation = { + 'status': {'required': True}, + 'description': {'required': True}, + 'actions_required': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__(self, *, status: str, description: str, **kwargs) -> None: + super(PrivateLinkServiceConnectionStateProperty, self).__init__(**kwargs) + self.status = status + self.description = description + self.actions_required = None diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy.py index 9a7bc69b8c5d..935f94a43a94 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy.py @@ -110,8 +110,8 @@ class ServerBlobAuditingPolicy(ProxyResource): :type is_storage_secondary_key_in_use: bool :param is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure Monitor. - In order to send the events to Azure Monitor, specify 'State' as 'Enabled' - and 'IsAzureMonitorTargetEnabled' as true. + In order to send the events to Azure Monitor, specify 'state' as 'Enabled' + and 'isAzureMonitorTargetEnabled' as true. When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy_py3.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy_py3.py index 120d066e6427..0e5e2afbae99 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy_py3.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy_py3.py @@ -110,8 +110,8 @@ class ServerBlobAuditingPolicy(ProxyResource): :type is_storage_secondary_key_in_use: bool :param is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure Monitor. - In order to send the events to Azure Monitor, specify 'State' as 'Enabled' - and 'IsAzureMonitorTargetEnabled' as true. + In order to send the events to Azure Monitor, specify 'state' as 'Enabled' + and 'isAzureMonitorTargetEnabled' as true. When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py index b5f1cf999537..ff22a325048e 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py @@ -91,6 +91,7 @@ from .instance_pools_operations import InstancePoolsOperations from .usages_operations import UsagesOperations from .managed_instances_operations import ManagedInstancesOperations +from .private_endpoint_connections_operations import PrivateEndpointConnectionsOperations __all__ = [ 'RecoverableDatabasesOperations', @@ -175,4 +176,5 @@ 'InstancePoolsOperations', 'UsagesOperations', 'ManagedInstancesOperations', + 'PrivateEndpointConnectionsOperations', ] diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/private_endpoint_connections_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/private_endpoint_connections_operations.py new file mode 100644 index 000000000000..c49083a21e6a --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/private_endpoint_connections_operations.py @@ -0,0 +1,380 @@ +# 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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class PrivateEndpointConnectionsOperations(object): + """PrivateEndpointConnectionsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2018-06-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-06-01-preview" + + self.config = config + + def get( + self, resource_group_name, server_name, private_endpoint_connection_name, custom_headers=None, raw=False, **operation_config): + """Gets a private endpoint connection. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param server_name: The name of the server. + :type server_name: str + :param private_endpoint_connection_name: The name of the private + endpoint connection. + :type private_endpoint_connection_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: PrivateEndpointConnection or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.PrivateEndpointConnection or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}'} + + + def _create_or_update_initial( + self, resource_group_name, server_name, private_endpoint_connection_name, private_endpoint=None, private_link_service_connection_state=None, custom_headers=None, raw=False, **operation_config): + parameters = models.PrivateEndpointConnection(private_endpoint=private_endpoint, private_link_service_connection_state=private_link_service_connection_state) + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'PrivateEndpointConnection') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, server_name, private_endpoint_connection_name, private_endpoint=None, private_link_service_connection_state=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Approve or reject a private endpoint connection with a given name. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param server_name: The name of the server. + :type server_name: str + :param private_endpoint_connection_name: + :type private_endpoint_connection_name: str + :param private_endpoint: Private endpoint which the connection belongs + to. + :type private_endpoint: ~azure.mgmt.sql.models.PrivateEndpointProperty + :param private_link_service_connection_state: Connection State of the + Private Endpoint Connection. + :type private_link_service_connection_state: + ~azure.mgmt.sql.models.PrivateLinkServiceConnectionStateProperty + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + PrivateEndpointConnection or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.PrivateEndpointConnection] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.sql.models.PrivateEndpointConnection]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint=private_endpoint, + private_link_service_connection_state=private_link_service_connection_state, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('PrivateEndpointConnection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}'} + + + def _delete_initial( + self, resource_group_name, server_name, private_endpoint_connection_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, server_name, private_endpoint_connection_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes a private endpoint connection with a given name. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param server_name: The name of the server. + :type server_name: str + :param private_endpoint_connection_name: + :type private_endpoint_connection_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + server_name=server_name, + private_endpoint_connection_name=private_endpoint_connection_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}'} + + def list_by_server( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + """Gets all private endpoint connections on a server. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param server_name: The name of the server. + :type server_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PrivateEndpointConnection + :rtype: + ~azure.mgmt.sql.models.PrivateEndpointConnectionPaged[~azure.mgmt.sql.models.PrivateEndpointConnection] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_server.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.PrivateEndpointConnectionPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.PrivateEndpointConnectionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_server.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/privateEndpointConnections'} diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py index 334be8304ad4..0f4c2b80605c 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py @@ -95,6 +95,7 @@ from .operations.instance_pools_operations import InstancePoolsOperations from .operations.usages_operations import UsagesOperations from .operations.managed_instances_operations import ManagedInstancesOperations +from .operations.private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from . import models @@ -301,6 +302,8 @@ class SqlManagementClient(SDKClient): :vartype usages: azure.mgmt.sql.operations.UsagesOperations :ivar managed_instances: ManagedInstances operations :vartype managed_instances: azure.mgmt.sql.operations.ManagedInstancesOperations + :ivar private_endpoint_connections: PrivateEndpointConnections operations + :vartype private_endpoint_connections: azure.mgmt.sql.operations.PrivateEndpointConnectionsOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -485,3 +488,5 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.managed_instances = ManagedInstancesOperations( self._client, self.config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self.config, self._serialize, self._deserialize)