diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/_maria_db_management_client.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/_maria_db_management_client.py index ba4232c42fdf..630e5446cf31 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/_maria_db_management_client.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/_maria_db_management_client.py @@ -23,6 +23,7 @@ from .operations import LogFilesOperations from .operations import LocationBasedPerformanceTierOperations from .operations import CheckNameAvailabilityOperations +from .operations import ServerSecurityAlertPoliciesOperations from .operations import Operations from .operations import QueryTextsOperations from .operations import TopQueryStatisticsOperations @@ -33,7 +34,6 @@ from .operations import LocationBasedRecommendedActionSessionsResultOperations from .operations import PrivateEndpointConnectionsOperations from .operations import PrivateLinkResourcesOperations -from .operations import ServerSecurityAlertPoliciesOperations from . import models @@ -61,6 +61,8 @@ class MariaDBManagementClient(MariaDBManagementClientOperationsMixin, SDKClient) :vartype location_based_performance_tier: azure.mgmt.rdbms.mariadb.operations.LocationBasedPerformanceTierOperations :ivar check_name_availability: CheckNameAvailability operations :vartype check_name_availability: azure.mgmt.rdbms.mariadb.operations.CheckNameAvailabilityOperations + :ivar server_security_alert_policies: ServerSecurityAlertPolicies operations + :vartype server_security_alert_policies: azure.mgmt.rdbms.mariadb.operations.ServerSecurityAlertPoliciesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.rdbms.mariadb.operations.Operations :ivar query_texts: QueryTexts operations @@ -81,8 +83,6 @@ class MariaDBManagementClient(MariaDBManagementClientOperationsMixin, SDKClient) :vartype private_endpoint_connections: azure.mgmt.rdbms.mariadb.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResources operations :vartype private_link_resources: azure.mgmt.rdbms.mariadb.operations.PrivateLinkResourcesOperations - :ivar server_security_alert_policies: ServerSecurityAlertPolicies operations - :vartype server_security_alert_policies: azure.mgmt.rdbms.mariadb.operations.ServerSecurityAlertPoliciesOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -121,6 +121,8 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.check_name_availability = CheckNameAvailabilityOperations( self._client, self.config, self._serialize, self._deserialize) + self.server_security_alert_policies = ServerSecurityAlertPoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) self.operations = Operations( self._client, self.config, self._serialize, self._deserialize) self.query_texts = QueryTextsOperations( @@ -141,5 +143,3 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.private_link_resources = PrivateLinkResourcesOperations( self._client, self.config, self._serialize, self._deserialize) - self.server_security_alert_policies = ServerSecurityAlertPoliciesOperations( - self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/__init__.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/__init__.py index 0b18bc99ed13..133208b9f021 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/__init__.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mariadb/operations/__init__.py @@ -18,6 +18,7 @@ from ._log_files_operations import LogFilesOperations from ._location_based_performance_tier_operations import LocationBasedPerformanceTierOperations from ._check_name_availability_operations import CheckNameAvailabilityOperations +from ._server_security_alert_policies_operations import ServerSecurityAlertPoliciesOperations from ._operations import Operations from ._query_texts_operations import QueryTextsOperations from ._top_query_statistics_operations import TopQueryStatisticsOperations @@ -28,7 +29,6 @@ from ._location_based_recommended_action_sessions_result_operations import LocationBasedRecommendedActionSessionsResultOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._server_security_alert_policies_operations import ServerSecurityAlertPoliciesOperations from ._maria_db_management_client_operations import MariaDBManagementClientOperationsMixin __all__ = [ @@ -41,6 +41,7 @@ 'LogFilesOperations', 'LocationBasedPerformanceTierOperations', 'CheckNameAvailabilityOperations', + 'ServerSecurityAlertPoliciesOperations', 'Operations', 'QueryTextsOperations', 'TopQueryStatisticsOperations', @@ -51,6 +52,5 @@ 'LocationBasedRecommendedActionSessionsResultOperations', 'PrivateEndpointConnectionsOperations', 'PrivateLinkResourcesOperations', - 'ServerSecurityAlertPoliciesOperations', 'MariaDBManagementClientOperationsMixin', ] diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/_my_sql_management_client.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/_my_sql_management_client.py index 59a458d85378..b5c77f5d2a71 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/_my_sql_management_client.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/_my_sql_management_client.py @@ -24,7 +24,6 @@ from .operations import ServerAdministratorsOperations from .operations import LocationBasedPerformanceTierOperations from .operations import CheckNameAvailabilityOperations -from .operations import ServerSecurityAlertPoliciesOperations from .operations import Operations from .operations import QueryTextsOperations from .operations import TopQueryStatisticsOperations @@ -36,6 +35,7 @@ from .operations import PrivateEndpointConnectionsOperations from .operations import PrivateLinkResourcesOperations from .operations import ServerKeysOperations +from .operations import ServerSecurityAlertPoliciesOperations from . import models @@ -65,8 +65,6 @@ class MySQLManagementClient(MySQLManagementClientOperationsMixin, SDKClient): :vartype location_based_performance_tier: azure.mgmt.rdbms.mysql.operations.LocationBasedPerformanceTierOperations :ivar check_name_availability: CheckNameAvailability operations :vartype check_name_availability: azure.mgmt.rdbms.mysql.operations.CheckNameAvailabilityOperations - :ivar server_security_alert_policies: ServerSecurityAlertPolicies operations - :vartype server_security_alert_policies: azure.mgmt.rdbms.mysql.operations.ServerSecurityAlertPoliciesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.rdbms.mysql.operations.Operations :ivar query_texts: QueryTexts operations @@ -89,6 +87,8 @@ class MySQLManagementClient(MySQLManagementClientOperationsMixin, SDKClient): :vartype private_link_resources: azure.mgmt.rdbms.mysql.operations.PrivateLinkResourcesOperations :ivar server_keys: ServerKeys operations :vartype server_keys: azure.mgmt.rdbms.mysql.operations.ServerKeysOperations + :ivar server_security_alert_policies: ServerSecurityAlertPolicies operations + :vartype server_security_alert_policies: azure.mgmt.rdbms.mysql.operations.ServerSecurityAlertPoliciesOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -128,8 +128,6 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.check_name_availability = CheckNameAvailabilityOperations( self._client, self.config, self._serialize, self._deserialize) - self.server_security_alert_policies = ServerSecurityAlertPoliciesOperations( - self._client, self.config, self._serialize, self._deserialize) self.operations = Operations( self._client, self.config, self._serialize, self._deserialize) self.query_texts = QueryTextsOperations( @@ -152,3 +150,5 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.server_keys = ServerKeysOperations( self._client, self.config, self._serialize, self._deserialize) + self.server_security_alert_policies = ServerSecurityAlertPoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/models/__init__.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/models/__init__.py index 8d9d59cf49ea..ed2975a68119 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/models/__init__.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/models/__init__.py @@ -54,6 +54,7 @@ from ._models_py3 import ServerUpdateParameters from ._models_py3 import Sku from ._models_py3 import StorageProfile + from ._models_py3 import SystemData from ._models_py3 import TagsObject from ._models_py3 import TopQueryStatisticsInput from ._models_py3 import TrackedResource @@ -105,6 +106,7 @@ from ._models import ServerUpdateParameters from ._models import Sku from ._models import StorageProfile + from ._models import SystemData from ._models import TagsObject from ._models import TopQueryStatisticsInput from ._models import TrackedResource @@ -125,6 +127,7 @@ from ._paged_models import ServerAdministratorResourcePaged from ._paged_models import ServerKeyPaged from ._paged_models import ServerPaged +from ._paged_models import ServerSecurityAlertPolicyPaged from ._paged_models import VirtualNetworkRulePaged from ._paged_models import WaitStatisticPaged from ._my_sql_management_client_enums import ( @@ -144,6 +147,7 @@ VirtualNetworkRuleState, OperationOrigin, ServerSecurityAlertPolicyState, + CreatedByType, ) __all__ = [ @@ -191,6 +195,7 @@ 'ServerUpdateParameters', 'Sku', 'StorageProfile', + 'SystemData', 'TagsObject', 'TopQueryStatisticsInput', 'TrackedResource', @@ -213,6 +218,7 @@ 'PrivateEndpointConnectionPaged', 'PrivateLinkResourcePaged', 'ServerKeyPaged', + 'ServerSecurityAlertPolicyPaged', 'ServerVersion', 'SslEnforcementEnum', 'MinimalTlsVersionEnum', @@ -229,4 +235,5 @@ 'VirtualNetworkRuleState', 'OperationOrigin', 'ServerSecurityAlertPolicyState', + 'CreatedByType', ] diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/models/_models.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/models/_models.py index 35c28b535292..1f73786bace3 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/models/_models.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/models/_models.py @@ -158,7 +158,7 @@ def __init__(self, **kwargs): class CloudError(Model): """An error response from the Batch service. - :param error: + :param error: Error message :type error: ~azure.mgmt.rdbms.mysql.models.ErrorResponse """ @@ -1864,26 +1864,8 @@ class ServerSecurityAlertPolicy(ProxyResource): enabled or disabled. Possible values include: 'Enabled', 'Disabled' :type state: str or ~azure.mgmt.rdbms.mysql.models.ServerSecurityAlertPolicyState - :param disabled_alerts: Specifies an array of alerts that are disabled. - Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, - Access_Anomaly - :type disabled_alerts: list[str] - :param email_addresses: Specifies an array of e-mail addresses to which - the alert is sent. - :type email_addresses: list[str] - :param email_account_admins: Specifies that the alert is sent to the - account administrators. - :type email_account_admins: bool - :param storage_endpoint: Specifies the blob storage endpoint (e.g. - https://MyAccount.blob.core.windows.net). This blob storage will hold all - Threat Detection audit logs. - :type storage_endpoint: str - :param storage_account_access_key: Specifies the identifier key of the - Threat Detection audit storage account. - :type storage_account_access_key: str - :param retention_days: Specifies the number of days to keep in the Threat - Detection audit logs. - :type retention_days: int + :ivar system_data: + :vartype system_data: ~azure.mgmt.rdbms.mysql.models.SystemData """ _validation = { @@ -1891,6 +1873,7 @@ class ServerSecurityAlertPolicy(ProxyResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'state': {'required': True}, + 'system_data': {'readonly': True}, } _attribute_map = { @@ -1898,23 +1881,13 @@ class ServerSecurityAlertPolicy(ProxyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'state': {'key': 'properties.state', 'type': 'ServerSecurityAlertPolicyState'}, - 'disabled_alerts': {'key': 'properties.disabledAlerts', 'type': '[str]'}, - 'email_addresses': {'key': 'properties.emailAddresses', 'type': '[str]'}, - 'email_account_admins': {'key': 'properties.emailAccountAdmins', 'type': 'bool'}, - 'storage_endpoint': {'key': 'properties.storageEndpoint', 'type': 'str'}, - 'storage_account_access_key': {'key': 'properties.storageAccountAccessKey', 'type': 'str'}, - 'retention_days': {'key': 'properties.retentionDays', 'type': 'int'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__(self, **kwargs): super(ServerSecurityAlertPolicy, self).__init__(**kwargs) self.state = kwargs.get('state', None) - self.disabled_alerts = kwargs.get('disabled_alerts', None) - self.email_addresses = kwargs.get('email_addresses', None) - self.email_account_admins = kwargs.get('email_account_admins', None) - self.storage_endpoint = kwargs.get('storage_endpoint', None) - self.storage_account_access_key = kwargs.get('storage_account_access_key', None) - self.retention_days = kwargs.get('retention_days', None) + self.system_data = None class ServerUpdateParameters(Model): @@ -2050,6 +2023,47 @@ def __init__(self, **kwargs): self.storage_autogrow = kwargs.get('storage_autogrow', None) +class SystemData(Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. + Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + :type created_by_type: str or ~azure.mgmt.rdbms.mysql.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the + resource. Possible values include: 'User', 'Application', + 'ManagedIdentity', 'Key' + :type last_modified_by_type: str or + ~azure.mgmt.rdbms.mysql.models.CreatedByType + :param last_modified_at: The type of identity that last modified the + resource. + :type last_modified_at: datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) + + class TagsObject(Model): """Tags object for patch operations. diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/models/_models_py3.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/models/_models_py3.py index 17d3aa9f63f7..fec9a12b3803 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/models/_models_py3.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/models/_models_py3.py @@ -158,7 +158,7 @@ def __init__(self, **kwargs) -> None: class CloudError(Model): """An error response from the Batch service. - :param error: + :param error: Error message :type error: ~azure.mgmt.rdbms.mysql.models.ErrorResponse """ @@ -1864,26 +1864,8 @@ class ServerSecurityAlertPolicy(ProxyResource): enabled or disabled. Possible values include: 'Enabled', 'Disabled' :type state: str or ~azure.mgmt.rdbms.mysql.models.ServerSecurityAlertPolicyState - :param disabled_alerts: Specifies an array of alerts that are disabled. - Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, - Access_Anomaly - :type disabled_alerts: list[str] - :param email_addresses: Specifies an array of e-mail addresses to which - the alert is sent. - :type email_addresses: list[str] - :param email_account_admins: Specifies that the alert is sent to the - account administrators. - :type email_account_admins: bool - :param storage_endpoint: Specifies the blob storage endpoint (e.g. - https://MyAccount.blob.core.windows.net). This blob storage will hold all - Threat Detection audit logs. - :type storage_endpoint: str - :param storage_account_access_key: Specifies the identifier key of the - Threat Detection audit storage account. - :type storage_account_access_key: str - :param retention_days: Specifies the number of days to keep in the Threat - Detection audit logs. - :type retention_days: int + :ivar system_data: + :vartype system_data: ~azure.mgmt.rdbms.mysql.models.SystemData """ _validation = { @@ -1891,6 +1873,7 @@ class ServerSecurityAlertPolicy(ProxyResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'state': {'required': True}, + 'system_data': {'readonly': True}, } _attribute_map = { @@ -1898,23 +1881,13 @@ class ServerSecurityAlertPolicy(ProxyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'state': {'key': 'properties.state', 'type': 'ServerSecurityAlertPolicyState'}, - 'disabled_alerts': {'key': 'properties.disabledAlerts', 'type': '[str]'}, - 'email_addresses': {'key': 'properties.emailAddresses', 'type': '[str]'}, - 'email_account_admins': {'key': 'properties.emailAccountAdmins', 'type': 'bool'}, - 'storage_endpoint': {'key': 'properties.storageEndpoint', 'type': 'str'}, - 'storage_account_access_key': {'key': 'properties.storageAccountAccessKey', 'type': 'str'}, - 'retention_days': {'key': 'properties.retentionDays', 'type': 'int'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } - def __init__(self, *, state, disabled_alerts=None, email_addresses=None, email_account_admins: bool=None, storage_endpoint: str=None, storage_account_access_key: str=None, retention_days: int=None, **kwargs) -> None: + def __init__(self, *, state, **kwargs) -> None: super(ServerSecurityAlertPolicy, self).__init__(**kwargs) self.state = state - self.disabled_alerts = disabled_alerts - self.email_addresses = email_addresses - self.email_account_admins = email_account_admins - self.storage_endpoint = storage_endpoint - self.storage_account_access_key = storage_account_access_key - self.retention_days = retention_days + self.system_data = None class ServerUpdateParameters(Model): @@ -2050,6 +2023,47 @@ def __init__(self, *, backup_retention_days: int=None, geo_redundant_backup=None self.storage_autogrow = storage_autogrow +class SystemData(Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. + Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + :type created_by_type: str or ~azure.mgmt.rdbms.mysql.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the + resource. Possible values include: 'User', 'Application', + 'ManagedIdentity', 'Key' + :type last_modified_by_type: str or + ~azure.mgmt.rdbms.mysql.models.CreatedByType + :param last_modified_at: The type of identity that last modified the + resource. + :type last_modified_at: datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__(self, *, created_by: str=None, created_by_type=None, created_at=None, last_modified_by: str=None, last_modified_by_type=None, last_modified_at=None, **kwargs) -> None: + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + class TagsObject(Model): """Tags object for patch operations. diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/models/_my_sql_management_client_enums.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/models/_my_sql_management_client_enums.py index 6f0b1e2c7d42..3aae6592fdd0 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/models/_my_sql_management_client_enums.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/models/_my_sql_management_client_enums.py @@ -35,8 +35,8 @@ class MinimalTlsVersionEnum(str, Enum): class InfrastructureEncryption(str, Enum): - enabled = "Enabled" - disabled = "Disabled" + enabled = "Enabled" #: Default value for single layer of encryption for data at rest. + disabled = "Disabled" #: Additional (2nd) layer of encryption for data at rest class PublicNetworkAccessEnum(str, Enum): @@ -119,3 +119,11 @@ class ServerSecurityAlertPolicyState(str, Enum): enabled = "Enabled" disabled = "Disabled" + + +class CreatedByType(str, Enum): + + user = "User" + application = "Application" + managed_identity = "ManagedIdentity" + key = "Key" diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/models/_paged_models.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/models/_paged_models.py index 6b4fde833ccd..8ddda0892e12 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/models/_paged_models.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/models/_paged_models.py @@ -220,3 +220,16 @@ class ServerKeyPaged(Paged): def __init__(self, *args, **kwargs): super(ServerKeyPaged, self).__init__(*args, **kwargs) +class ServerSecurityAlertPolicyPaged(Paged): + """ + A paging container for iterating over a list of :class:`ServerSecurityAlertPolicy ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ServerSecurityAlertPolicy]'} + } + + def __init__(self, *args, **kwargs): + + super(ServerSecurityAlertPolicyPaged, self).__init__(*args, **kwargs) diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/__init__.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/__init__.py index df66b2e41971..19934e980d2d 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/__init__.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/__init__.py @@ -19,7 +19,6 @@ from ._server_administrators_operations import ServerAdministratorsOperations from ._location_based_performance_tier_operations import LocationBasedPerformanceTierOperations from ._check_name_availability_operations import CheckNameAvailabilityOperations -from ._server_security_alert_policies_operations import ServerSecurityAlertPoliciesOperations from ._operations import Operations from ._query_texts_operations import QueryTextsOperations from ._top_query_statistics_operations import TopQueryStatisticsOperations @@ -31,6 +30,7 @@ from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._server_keys_operations import ServerKeysOperations +from ._server_security_alert_policies_operations import ServerSecurityAlertPoliciesOperations from ._my_sql_management_client_operations import MySQLManagementClientOperationsMixin __all__ = [ @@ -44,7 +44,6 @@ 'ServerAdministratorsOperations', 'LocationBasedPerformanceTierOperations', 'CheckNameAvailabilityOperations', - 'ServerSecurityAlertPoliciesOperations', 'Operations', 'QueryTextsOperations', 'TopQueryStatisticsOperations', @@ -56,5 +55,6 @@ 'PrivateEndpointConnectionsOperations', 'PrivateLinkResourcesOperations', 'ServerKeysOperations', + 'ServerSecurityAlertPoliciesOperations', 'MySQLManagementClientOperationsMixin', ] diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_server_security_alert_policies_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_server_security_alert_policies_operations.py index 0f7cac278722..b6a6d8063d4c 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_server_security_alert_policies_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_server_security_alert_policies_operations.py @@ -28,7 +28,7 @@ class ServerSecurityAlertPoliciesOperations(object): :param serializer: An object model serializer. :param deserializer: An object model deserializer. :ivar security_alert_policy_name: The name of the security alert policy. Constant value: "Default". - :ivar api_version: The API version to use for this operation. Constant value: "2017-12-01". + :ivar api_version: The API version to use for this operation. Constant value: "2020-01-01". """ models = models @@ -39,7 +39,7 @@ def __init__(self, client, config, serializer, deserializer): self._serialize = serializer self._deserialize = deserializer self.security_alert_policy_name = "Default" - self.api_version = "2017-12-01" + self.api_version = "2020-01-01" self.config = config @@ -108,7 +108,9 @@ def get( def _create_or_update_initial( - self, resource_group_name, server_name, parameters, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, server_name, state, custom_headers=None, raw=False, **operation_config): + parameters = models.ServerSecurityAlertPolicy(state=state) + # Construct URL url = self.create_or_update.metadata['url'] path_format_arguments = { @@ -158,7 +160,7 @@ def _create_or_update_initial( return deserialized def create_or_update( - self, resource_group_name, server_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + self, resource_group_name, server_name, state, custom_headers=None, raw=False, polling=True, **operation_config): """Creates or updates a threat detection policy. :param resource_group_name: The name of the resource group. The name @@ -166,9 +168,10 @@ def create_or_update( :type resource_group_name: str :param server_name: The name of the server. :type server_name: str - :param parameters: The server security alert policy. - :type parameters: - ~azure.mgmt.rdbms.mysql.models.ServerSecurityAlertPolicy + :param state: Specifies the state of the policy, whether it is enabled + or disabled. Possible values include: 'Enabled', 'Disabled' + :type state: str or + ~azure.mgmt.rdbms.mysql.models.ServerSecurityAlertPolicyState :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 @@ -186,7 +189,7 @@ def create_or_update( raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, server_name=server_name, - parameters=parameters, + state=state, custom_headers=custom_headers, raw=True, **operation_config @@ -209,3 +212,76 @@ def get_long_running_output(response): 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.DBforMySQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}'} + + def list_by_server( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + """Get the server's threat detection policies. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :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 ServerSecurityAlertPolicy + :rtype: + ~azure.mgmt.rdbms.mysql.models.ServerSecurityAlertPolicyPaged[~azure.mgmt.rdbms.mysql.models.ServerSecurityAlertPolicy] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + 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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1) + } + 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', min_length=1) + + 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) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + 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 + header_dict = None + if raw: + header_dict = {} + deserialized = models.ServerSecurityAlertPolicyPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_server.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/securityAlertPolicies'} diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_servers_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_servers_operations.py index bc547cbb22fd..6da4a5ba08b4 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_servers_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/operations/_servers_operations.py @@ -27,7 +27,6 @@ class ServersOperations(object): :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 this operation. Constant value: "2017-12-01". """ models = models @@ -37,13 +36,14 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2017-12-01" self.config = config def _create_initial( self, resource_group_name, server_name, parameters, custom_headers=None, raw=False, **operation_config): + api_version = "2017-12-01" + # Construct URL url = self.create.metadata['url'] path_format_arguments = { @@ -55,7 +55,7 @@ def _create_initial( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -149,6 +149,8 @@ def get_long_running_output(response): def _update_initial( self, resource_group_name, server_name, parameters, custom_headers=None, raw=False, **operation_config): + api_version = "2017-12-01" + # Construct URL url = self.update.metadata['url'] path_format_arguments = { @@ -160,7 +162,7 @@ def _update_initial( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -252,6 +254,8 @@ def get_long_running_output(response): def _delete_initial( self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + api_version = "2017-12-01" + # Construct URL url = self.delete.metadata['url'] path_format_arguments = { @@ -263,7 +267,7 @@ def _delete_initial( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -348,6 +352,8 @@ def get( ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ + api_version = "2017-12-01" + # Construct URL url = self.get.metadata['url'] path_format_arguments = { @@ -359,7 +365,7 @@ def get( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -408,6 +414,8 @@ def list_by_resource_group( ~azure.mgmt.rdbms.mysql.models.ServerPaged[~azure.mgmt.rdbms.mysql.models.Server] :raises: :class:`CloudError` """ + api_version = "2017-12-01" + def prepare_request(next_link=None): if not next_link: # Construct URL @@ -420,7 +428,7 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str', min_length=1) else: url = next_link @@ -475,6 +483,8 @@ def list( ~azure.mgmt.rdbms.mysql.models.ServerPaged[~azure.mgmt.rdbms.mysql.models.Server] :raises: :class:`CloudError` """ + api_version = "2017-12-01" + def prepare_request(next_link=None): if not next_link: # Construct URL @@ -486,7 +496,7 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str', min_length=1) else: url = next_link @@ -530,6 +540,8 @@ def internal_paging(next_link=None): def _restart_initial( self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + api_version = "2017-12-01" + # Construct URL url = self.restart.metadata['url'] path_format_arguments = { @@ -541,7 +553,7 @@ def _restart_initial( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -606,3 +618,167 @@ def get_long_running_output(response): else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/restart'} + + + def _start_initial( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + api_version = "2020-01-01" + + # Construct URL + url = self.start.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'serverName': self._serialize.url("server_name", server_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str', min_length=1) + + # 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.post(url, query_parameters, header_parameters) + 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 + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def start( + self, resource_group_name, server_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Starts a stopped server. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :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: 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._start_initial( + resource_group_name=resource_group_name, + server_name=server_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) + start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/start'} + + + def _stop_initial( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + api_version = "2020-01-01" + + # Construct URL + url = self.stop.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'serverName': self._serialize.url("server_name", server_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str', min_length=1) + + # 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.post(url, query_parameters, header_parameters) + 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 + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def stop( + self, resource_group_name, server_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Stops a running server. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :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: 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._stop_initial( + resource_group_name=resource_group_name, + server_name=server_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) + stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/stop'} diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_postgre_sql_management_client.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_postgre_sql_management_client.py index f1148989b5e7..febfd16ddd4d 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_postgre_sql_management_client.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_postgre_sql_management_client.py @@ -23,11 +23,11 @@ from .operations import ServerAdministratorsOperations from .operations import LocationBasedPerformanceTierOperations from .operations import CheckNameAvailabilityOperations +from .operations import ServerSecurityAlertPoliciesOperations from .operations import Operations from .operations import PrivateEndpointConnectionsOperations from .operations import PrivateLinkResourcesOperations from .operations import ServerKeysOperations -from .operations import ServerSecurityAlertPoliciesOperations from . import models @@ -57,6 +57,8 @@ class PostgreSQLManagementClient(SDKClient): :vartype location_based_performance_tier: azure.mgmt.rdbms.postgresql.operations.LocationBasedPerformanceTierOperations :ivar check_name_availability: CheckNameAvailability operations :vartype check_name_availability: azure.mgmt.rdbms.postgresql.operations.CheckNameAvailabilityOperations + :ivar server_security_alert_policies: ServerSecurityAlertPolicies operations + :vartype server_security_alert_policies: azure.mgmt.rdbms.postgresql.operations.ServerSecurityAlertPoliciesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.rdbms.postgresql.operations.Operations :ivar private_endpoint_connections: PrivateEndpointConnections operations @@ -65,8 +67,6 @@ class PostgreSQLManagementClient(SDKClient): :vartype private_link_resources: azure.mgmt.rdbms.postgresql.operations.PrivateLinkResourcesOperations :ivar server_keys: ServerKeys operations :vartype server_keys: azure.mgmt.rdbms.postgresql.operations.ServerKeysOperations - :ivar server_security_alert_policies: ServerSecurityAlertPolicies operations - :vartype server_security_alert_policies: azure.mgmt.rdbms.postgresql.operations.ServerSecurityAlertPoliciesOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -106,6 +106,8 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.check_name_availability = CheckNameAvailabilityOperations( self._client, self.config, self._serialize, self._deserialize) + self.server_security_alert_policies = ServerSecurityAlertPoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) self.operations = Operations( self._client, self.config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( @@ -114,5 +116,3 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.server_keys = ServerKeysOperations( self._client, self.config, self._serialize, self._deserialize) - self.server_security_alert_policies = ServerSecurityAlertPoliciesOperations( - self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/__init__.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/__init__.py index ae4b74863ead..595a3f8fd2ce 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/__init__.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/__init__.py @@ -48,7 +48,6 @@ from ._models_py3 import ServerUpdateParameters from ._models_py3 import Sku from ._models_py3 import StorageProfile - from ._models_py3 import SystemData from ._models_py3 import TagsObject from ._models_py3 import TrackedResource from ._models_py3 import VirtualNetworkRule @@ -91,7 +90,6 @@ from ._models import ServerUpdateParameters from ._models import Sku from ._models import StorageProfile - from ._models import SystemData from ._models import TagsObject from ._models import TrackedResource from ._models import VirtualNetworkRule @@ -105,7 +103,6 @@ from ._paged_models import ServerAdministratorResourcePaged from ._paged_models import ServerKeyPaged from ._paged_models import ServerPaged -from ._paged_models import ServerSecurityAlertPolicyPaged from ._paged_models import VirtualNetworkRulePaged from ._postgre_sql_management_client_enums import ( ServerVersion, @@ -124,7 +121,6 @@ VirtualNetworkRuleState, OperationOrigin, ServerSecurityAlertPolicyState, - CreatedByType, ) __all__ = [ @@ -166,7 +162,6 @@ 'ServerUpdateParameters', 'Sku', 'StorageProfile', - 'SystemData', 'TagsObject', 'TrackedResource', 'VirtualNetworkRule', @@ -181,7 +176,6 @@ 'PrivateEndpointConnectionPaged', 'PrivateLinkResourcePaged', 'ServerKeyPaged', - 'ServerSecurityAlertPolicyPaged', 'ServerVersion', 'SslEnforcementEnum', 'MinimalTlsVersionEnum', @@ -198,5 +192,4 @@ 'VirtualNetworkRuleState', 'OperationOrigin', 'ServerSecurityAlertPolicyState', - 'CreatedByType', ] diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/_models.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/_models.py index a8934b39f930..b7c386b0d76a 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/_models.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/_models.py @@ -1601,8 +1601,26 @@ class ServerSecurityAlertPolicy(ProxyResource): enabled or disabled. Possible values include: 'Enabled', 'Disabled' :type state: str or ~azure.mgmt.rdbms.postgresql.models.ServerSecurityAlertPolicyState - :ivar system_data: - :vartype system_data: ~azure.mgmt.rdbms.postgresql.models.SystemData + :param disabled_alerts: Specifies an array of alerts that are disabled. + Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, + Access_Anomaly + :type disabled_alerts: list[str] + :param email_addresses: Specifies an array of e-mail addresses to which + the alert is sent. + :type email_addresses: list[str] + :param email_account_admins: Specifies that the alert is sent to the + account administrators. + :type email_account_admins: bool + :param storage_endpoint: Specifies the blob storage endpoint (e.g. + https://MyAccount.blob.core.windows.net). This blob storage will hold all + Threat Detection audit logs. + :type storage_endpoint: str + :param storage_account_access_key: Specifies the identifier key of the + Threat Detection audit storage account. + :type storage_account_access_key: str + :param retention_days: Specifies the number of days to keep in the Threat + Detection audit logs. + :type retention_days: int """ _validation = { @@ -1610,7 +1628,6 @@ class ServerSecurityAlertPolicy(ProxyResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'state': {'required': True}, - 'system_data': {'readonly': True}, } _attribute_map = { @@ -1618,13 +1635,23 @@ class ServerSecurityAlertPolicy(ProxyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'state': {'key': 'properties.state', 'type': 'ServerSecurityAlertPolicyState'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'disabled_alerts': {'key': 'properties.disabledAlerts', 'type': '[str]'}, + 'email_addresses': {'key': 'properties.emailAddresses', 'type': '[str]'}, + 'email_account_admins': {'key': 'properties.emailAccountAdmins', 'type': 'bool'}, + 'storage_endpoint': {'key': 'properties.storageEndpoint', 'type': 'str'}, + 'storage_account_access_key': {'key': 'properties.storageAccountAccessKey', 'type': 'str'}, + 'retention_days': {'key': 'properties.retentionDays', 'type': 'int'}, } def __init__(self, **kwargs): super(ServerSecurityAlertPolicy, self).__init__(**kwargs) self.state = kwargs.get('state', None) - self.system_data = None + self.disabled_alerts = kwargs.get('disabled_alerts', None) + self.email_addresses = kwargs.get('email_addresses', None) + self.email_account_admins = kwargs.get('email_account_admins', None) + self.storage_endpoint = kwargs.get('storage_endpoint', None) + self.storage_account_access_key = kwargs.get('storage_account_access_key', None) + self.retention_days = kwargs.get('retention_days', None) class ServerUpdateParameters(Model): @@ -1760,48 +1787,6 @@ def __init__(self, **kwargs): self.storage_autogrow = kwargs.get('storage_autogrow', None) -class SystemData(Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. - Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' - :type created_by_type: str or - ~azure.mgmt.rdbms.postgresql.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the - resource. Possible values include: 'User', 'Application', - 'ManagedIdentity', 'Key' - :type last_modified_by_type: str or - ~azure.mgmt.rdbms.postgresql.models.CreatedByType - :param last_modified_at: The type of identity that last modified the - resource. - :type last_modified_at: datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__(self, **kwargs): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - class TagsObject(Model): """Tags object for patch operations. diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/_models_py3.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/_models_py3.py index bf61b4d533db..2a4fb4166d94 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/_models_py3.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/_models_py3.py @@ -1601,8 +1601,26 @@ class ServerSecurityAlertPolicy(ProxyResource): enabled or disabled. Possible values include: 'Enabled', 'Disabled' :type state: str or ~azure.mgmt.rdbms.postgresql.models.ServerSecurityAlertPolicyState - :ivar system_data: - :vartype system_data: ~azure.mgmt.rdbms.postgresql.models.SystemData + :param disabled_alerts: Specifies an array of alerts that are disabled. + Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, + Access_Anomaly + :type disabled_alerts: list[str] + :param email_addresses: Specifies an array of e-mail addresses to which + the alert is sent. + :type email_addresses: list[str] + :param email_account_admins: Specifies that the alert is sent to the + account administrators. + :type email_account_admins: bool + :param storage_endpoint: Specifies the blob storage endpoint (e.g. + https://MyAccount.blob.core.windows.net). This blob storage will hold all + Threat Detection audit logs. + :type storage_endpoint: str + :param storage_account_access_key: Specifies the identifier key of the + Threat Detection audit storage account. + :type storage_account_access_key: str + :param retention_days: Specifies the number of days to keep in the Threat + Detection audit logs. + :type retention_days: int """ _validation = { @@ -1610,7 +1628,6 @@ class ServerSecurityAlertPolicy(ProxyResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'state': {'required': True}, - 'system_data': {'readonly': True}, } _attribute_map = { @@ -1618,13 +1635,23 @@ class ServerSecurityAlertPolicy(ProxyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'state': {'key': 'properties.state', 'type': 'ServerSecurityAlertPolicyState'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'disabled_alerts': {'key': 'properties.disabledAlerts', 'type': '[str]'}, + 'email_addresses': {'key': 'properties.emailAddresses', 'type': '[str]'}, + 'email_account_admins': {'key': 'properties.emailAccountAdmins', 'type': 'bool'}, + 'storage_endpoint': {'key': 'properties.storageEndpoint', 'type': 'str'}, + 'storage_account_access_key': {'key': 'properties.storageAccountAccessKey', 'type': 'str'}, + 'retention_days': {'key': 'properties.retentionDays', 'type': 'int'}, } - def __init__(self, *, state, **kwargs) -> None: + def __init__(self, *, state, disabled_alerts=None, email_addresses=None, email_account_admins: bool=None, storage_endpoint: str=None, storage_account_access_key: str=None, retention_days: int=None, **kwargs) -> None: super(ServerSecurityAlertPolicy, self).__init__(**kwargs) self.state = state - self.system_data = None + self.disabled_alerts = disabled_alerts + self.email_addresses = email_addresses + self.email_account_admins = email_account_admins + self.storage_endpoint = storage_endpoint + self.storage_account_access_key = storage_account_access_key + self.retention_days = retention_days class ServerUpdateParameters(Model): @@ -1760,48 +1787,6 @@ def __init__(self, *, backup_retention_days: int=None, geo_redundant_backup=None self.storage_autogrow = storage_autogrow -class SystemData(Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. - Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' - :type created_by_type: str or - ~azure.mgmt.rdbms.postgresql.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the - resource. Possible values include: 'User', 'Application', - 'ManagedIdentity', 'Key' - :type last_modified_by_type: str or - ~azure.mgmt.rdbms.postgresql.models.CreatedByType - :param last_modified_at: The type of identity that last modified the - resource. - :type last_modified_at: datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__(self, *, created_by: str=None, created_by_type=None, created_at=None, last_modified_by: str=None, last_modified_by_type=None, last_modified_at=None, **kwargs) -> None: - super(SystemData, self).__init__(**kwargs) - self.created_by = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at - - class TagsObject(Model): """Tags object for patch operations. diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/_paged_models.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/_paged_models.py index 8c3f8cc2f06c..eb66a2bb4784 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/_paged_models.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/_paged_models.py @@ -155,16 +155,3 @@ class ServerKeyPaged(Paged): def __init__(self, *args, **kwargs): super(ServerKeyPaged, self).__init__(*args, **kwargs) -class ServerSecurityAlertPolicyPaged(Paged): - """ - A paging container for iterating over a list of :class:`ServerSecurityAlertPolicy ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ServerSecurityAlertPolicy]'} - } - - def __init__(self, *args, **kwargs): - - super(ServerSecurityAlertPolicyPaged, self).__init__(*args, **kwargs) diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/_postgre_sql_management_client_enums.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/_postgre_sql_management_client_enums.py index 07024cfbb376..354d4c8c9987 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/_postgre_sql_management_client_enums.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/_postgre_sql_management_client_enums.py @@ -38,8 +38,8 @@ class MinimalTlsVersionEnum(str, Enum): class InfrastructureEncryption(str, Enum): - enabled = "Enabled" #: Default value for single layer of encryption for data at rest. - disabled = "Disabled" #: Additional (2nd) layer of encryption for data at rest + enabled = "Enabled" + disabled = "Disabled" class PublicNetworkAccessEnum(str, Enum): @@ -122,11 +122,3 @@ class ServerSecurityAlertPolicyState(str, Enum): enabled = "Enabled" disabled = "Disabled" - - -class CreatedByType(str, Enum): - - user = "User" - application = "Application" - managed_identity = "ManagedIdentity" - key = "Key" diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/__init__.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/__init__.py index 2a236865816c..625d902647d7 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/__init__.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/__init__.py @@ -19,11 +19,11 @@ from ._server_administrators_operations import ServerAdministratorsOperations from ._location_based_performance_tier_operations import LocationBasedPerformanceTierOperations from ._check_name_availability_operations import CheckNameAvailabilityOperations +from ._server_security_alert_policies_operations import ServerSecurityAlertPoliciesOperations from ._operations import Operations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._server_keys_operations import ServerKeysOperations -from ._server_security_alert_policies_operations import ServerSecurityAlertPoliciesOperations __all__ = [ 'ServersOperations', @@ -36,9 +36,9 @@ 'ServerAdministratorsOperations', 'LocationBasedPerformanceTierOperations', 'CheckNameAvailabilityOperations', + 'ServerSecurityAlertPoliciesOperations', 'Operations', 'PrivateEndpointConnectionsOperations', 'PrivateLinkResourcesOperations', 'ServerKeysOperations', - 'ServerSecurityAlertPoliciesOperations', ] diff --git a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_security_alert_policies_operations.py b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_security_alert_policies_operations.py index 29b44b8808d4..d87af7b07f8c 100644 --- a/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_security_alert_policies_operations.py +++ b/sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_server_security_alert_policies_operations.py @@ -28,7 +28,7 @@ class ServerSecurityAlertPoliciesOperations(object): :param serializer: An object model serializer. :param deserializer: An object model deserializer. :ivar security_alert_policy_name: The name of the security alert policy. Constant value: "Default". - :ivar api_version: The API version to use for this operation. Constant value: "2020-01-01". + :ivar api_version: The API version to use for this operation. Constant value: "2017-12-01". """ models = models @@ -39,7 +39,7 @@ def __init__(self, client, config, serializer, deserializer): self._serialize = serializer self._deserialize = deserializer self.security_alert_policy_name = "Default" - self.api_version = "2020-01-01" + self.api_version = "2017-12-01" self.config = config @@ -108,9 +108,7 @@ def get( def _create_or_update_initial( - self, resource_group_name, server_name, state, custom_headers=None, raw=False, **operation_config): - parameters = models.ServerSecurityAlertPolicy(state=state) - + self, resource_group_name, server_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = self.create_or_update.metadata['url'] path_format_arguments = { @@ -160,7 +158,7 @@ def _create_or_update_initial( return deserialized def create_or_update( - self, resource_group_name, server_name, state, custom_headers=None, raw=False, polling=True, **operation_config): + self, resource_group_name, server_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): """Creates or updates a threat detection policy. :param resource_group_name: The name of the resource group. The name @@ -168,10 +166,9 @@ def create_or_update( :type resource_group_name: str :param server_name: The name of the server. :type server_name: str - :param state: Specifies the state of the policy, whether it is enabled - or disabled. Possible values include: 'Enabled', 'Disabled' - :type state: str or - ~azure.mgmt.rdbms.postgresql.models.ServerSecurityAlertPolicyState + :param parameters: The server security alert policy. + :type parameters: + ~azure.mgmt.rdbms.postgresql.models.ServerSecurityAlertPolicy :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 @@ -189,7 +186,7 @@ def create_or_update( raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, server_name=server_name, - state=state, + parameters=parameters, custom_headers=custom_headers, raw=True, **operation_config @@ -212,76 +209,3 @@ def get_long_running_output(response): 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.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}'} - - def list_by_server( - self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): - """Get the server's threat detection policies. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :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 ServerSecurityAlertPolicy - :rtype: - ~azure.mgmt.rdbms.postgresql.models.ServerSecurityAlertPolicyPaged[~azure.mgmt.rdbms.postgresql.models.ServerSecurityAlertPolicy] - :raises: :class:`CloudError` - """ - def prepare_request(next_link=None): - 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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'serverName': self._serialize.url("server_name", server_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1) - } - 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', min_length=1) - - 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) - return request - - def internal_paging(next_link=None): - request = prepare_request(next_link) - - 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 - header_dict = None - if raw: - header_dict = {} - deserialized = models.ServerSecurityAlertPolicyPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_server.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies'}