Skip to content

Commit

Permalink
Generated from 3ef310e770e8238acf53b192ef2a19295a7e3302 (#3150) (#3182)
Browse files Browse the repository at this point in the history
Add serverSecurityAlertPolicies APIs for MySQL servers
  • Loading branch information
AutorestCI authored and lmazuel committed Sep 13, 2018
1 parent bc0bbaa commit 63d80a9
Show file tree
Hide file tree
Showing 16 changed files with 467 additions and 83 deletions.
5 changes: 5 additions & 0 deletions azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
from .performance_tier_properties_py3 import PerformanceTierProperties
from .name_availability_request_py3 import NameAvailabilityRequest
from .name_availability_py3 import NameAvailability
from .server_security_alert_policy_py3 import ServerSecurityAlertPolicy
except (SyntaxError, ImportError):
from .proxy_resource import ProxyResource
from .tracked_resource import TrackedResource
Expand All @@ -57,6 +58,7 @@
from .performance_tier_properties import PerformanceTierProperties
from .name_availability_request import NameAvailabilityRequest
from .name_availability import NameAvailability
from .server_security_alert_policy import ServerSecurityAlertPolicy
from .server_paged import ServerPaged
from .firewall_rule_paged import FirewallRulePaged
from .virtual_network_rule_paged import VirtualNetworkRulePaged
Expand All @@ -72,6 +74,7 @@
SkuTier,
VirtualNetworkRuleState,
OperationOrigin,
ServerSecurityAlertPolicyState,
)

__all__ = [
Expand All @@ -98,6 +101,7 @@
'PerformanceTierProperties',
'NameAvailabilityRequest',
'NameAvailability',
'ServerSecurityAlertPolicy',
'ServerPaged',
'FirewallRulePaged',
'VirtualNetworkRulePaged',
Expand All @@ -112,4 +116,5 @@
'SkuTier',
'VirtualNetworkRuleState',
'OperationOrigin',
'ServerSecurityAlertPolicyState',
]
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,9 @@ class OperationOrigin(str, Enum):
not_specified = "NotSpecified"
user = "user"
system = "system"


class ServerSecurityAlertPolicyState(str, Enum):

enabled = "Enabled"
disabled = "Disabled"
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# 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 ServerSecurityAlertPolicy(ProxyResource):
"""A server security alert policy.
Variables are only populated by the server, and will be ignored when
sending a request.
All required parameters must be populated in order to send to Azure.
:ivar id: Resource ID
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:param state: Required. 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 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 = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'state': {'required': True},
}

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'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'},
}

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)
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# 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 ServerSecurityAlertPolicy(ProxyResource):
"""A server security alert policy.
Variables are only populated by the server, and will be ignored when
sending a request.
All required parameters must be populated in order to send to Azure.
:ivar id: Resource ID
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:param state: Required. 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 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 = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'state': {'required': True},
}

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'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'},
}

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.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
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from .operations.log_files_operations import LogFilesOperations
from .operations.location_based_performance_tier_operations import LocationBasedPerformanceTierOperations
from .operations.check_name_availability_operations import CheckNameAvailabilityOperations
from .operations.server_security_alert_policies_operations import ServerSecurityAlertPoliciesOperations
from .operations.operations import Operations
from . import models

Expand Down Expand Up @@ -80,6 +81,8 @@ class MySQLManagementClient(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
Expand Down Expand Up @@ -119,5 +122,7 @@ 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)
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,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

__all__ = [
Expand All @@ -28,5 +29,6 @@
'LogFilesOperations',
'LocationBasedPerformanceTierOperations',
'CheckNameAvailabilityOperations',
'ServerSecurityAlertPoliciesOperations',
'Operations',
]
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def execute(

# 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())
Expand All @@ -82,9 +83,8 @@ def execute(
body_content = self._serialize.body(name_availability_request, 'NameAvailabilityRequest')

# Construct and send request
request = self._client.post(url, query_parameters)
response = self._client.send(
request, header_parameters, body_content, stream=False, **operation_config)
request = self._client.post(url, query_parameters, header_parameters, body_content)
response = self._client.send(request, stream=False, **operation_config)

if response.status_code not in [200]:
exp = CloudError(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def _create_or_update_initial(

# 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())
Expand All @@ -72,9 +73,8 @@ def _create_or_update_initial(
body_content = self._serialize.body(parameters, 'Configuration')

# Construct and send request
request = self._client.put(url, query_parameters)
response = self._client.send(
request, header_parameters, body_content, stream=False, **operation_config)
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)
Expand Down Expand Up @@ -188,7 +188,7 @@ def get(

# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
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:
Expand All @@ -197,8 +197,8 @@ def get(
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)
response = self._client.send(request, header_parameters, stream=False, **operation_config)
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)
Expand Down Expand Up @@ -259,7 +259,7 @@ def internal_paging(next_link=None, raw=False):

# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
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:
Expand All @@ -268,9 +268,8 @@ def internal_paging(next_link=None, raw=False):
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)
response = self._client.send(
request, header_parameters, stream=False, **operation_config)
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)
Expand Down
Loading

0 comments on commit 63d80a9

Please sign in to comment.