From 62057939db07f2516132727b4cac4e21b0f71af3 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 31 May 2018 09:23:20 -0700 Subject: [PATCH 01/19] [AutoPR sql/resource-manager] Adding new value to VA baseline name (#2640) * Generated from 03645a856ba34f572618832814b410d8e2410ba2 Adding new value to VA baseline name Adding new value to VA baseline name * Generated from c9946efbfaf9f6a9f7765878a337784756ce951c Fix typo Fix typo * Generated from c3621b01ece4897d91763a7e4ba8d1e29d4d6832 Updating VulnerabilityAssessmentPolicyBaselineName * Generated from 5c8646bff054ea42bb05bef708e3c66c7d005c2e Fixed all comments --- .../azure/mgmt/sql/models/__init__.py | 2 ++ .../sql/models/sql_management_client_enums.py | 6 ++++ ...ty_assessment_rule_baselines_operations.py | 32 ++++++++++++++----- azure-mgmt-sql/azure/mgmt/sql/version.py | 2 +- 4 files changed, 33 insertions(+), 9 deletions(-) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py index fb3533b20adf..6570ace507ee 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py @@ -405,6 +405,7 @@ VulnerabilityAssessmentScanState, InstanceFailoverGroupReplicationRole, LongTermRetentionDatabaseState, + VulnerabilityAssessmentPolicyBaselineName, CapabilityGroup, ) @@ -668,5 +669,6 @@ 'VulnerabilityAssessmentScanState', 'InstanceFailoverGroupReplicationRole', 'LongTermRetentionDatabaseState', + 'VulnerabilityAssessmentPolicyBaselineName', 'CapabilityGroup', ] diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py b/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py index e4a76e0f84e5..273dd0d3484b 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py @@ -657,6 +657,12 @@ class LongTermRetentionDatabaseState(str, Enum): deleted = "Deleted" +class VulnerabilityAssessmentPolicyBaselineName(str, Enum): + + master = "master" + default = "default" + + class CapabilityGroup(str, Enum): supported_editions = "supportedEditions" diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/database_vulnerability_assessment_rule_baselines_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/database_vulnerability_assessment_rule_baselines_operations.py index 16a909e27a1a..558ad0135821 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/database_vulnerability_assessment_rule_baselines_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/database_vulnerability_assessment_rule_baselines_operations.py @@ -24,7 +24,6 @@ class DatabaseVulnerabilityAssessmentRuleBaselinesOperations(object): :param serializer: An object model serializer. :param deserializer: An object model deserializer. :ivar vulnerability_assessment_name: The name of the vulnerability assessment. Constant value: "default". - :ivar baseline_name: The name of the vulnerability assessment rule baseline. Constant value: "default". :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". """ @@ -36,13 +35,12 @@ def __init__(self, client, config, serializer, deserializer): self._serialize = serializer self._deserialize = deserializer self.vulnerability_assessment_name = "default" - self.baseline_name = "default" self.api_version = "2017-03-01-preview" self.config = config def get( - self, resource_group_name, server_name, database_name, rule_id, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, server_name, database_name, rule_id, baseline_name, custom_headers=None, raw=False, **operation_config): """Gets a database's vulnerability assessment rule baseline. :param resource_group_name: The name of the resource group that @@ -56,6 +54,12 @@ def get( :type database_name: str :param rule_id: The vulnerability assessment rule ID. :type rule_id: str + :param baseline_name: The name of the vulnerability assessment rule + baseline (default implies a baseline on a database level rule and + master for server level rule). Possible values include: 'master', + 'default' + :type baseline_name: str or + ~azure.mgmt.sql.models.VulnerabilityAssessmentPolicyBaselineName :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -76,7 +80,7 @@ def get( 'databaseName': self._serialize.url("database_name", database_name, 'str'), 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_name, 'str'), 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), - 'baselineName': self._serialize.url("self.baseline_name", self.baseline_name, 'str'), + 'baselineName': self._serialize.url("baseline_name", baseline_name, 'VulnerabilityAssessmentPolicyBaselineName'), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -117,7 +121,7 @@ def get( get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}'} def create_or_update( - self, resource_group_name, server_name, database_name, rule_id, baseline_results, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, server_name, database_name, rule_id, baseline_name, baseline_results, custom_headers=None, raw=False, **operation_config): """Creates or updates a database's vulnerability assessment rule baseline. :param resource_group_name: The name of the resource group that @@ -131,6 +135,12 @@ def create_or_update( :type database_name: str :param rule_id: The vulnerability assessment rule ID. :type rule_id: str + :param baseline_name: The name of the vulnerability assessment rule + baseline (default implies a baseline on a database level rule and + master for server level rule). Possible values include: 'master', + 'default' + :type baseline_name: str or + ~azure.mgmt.sql.models.VulnerabilityAssessmentPolicyBaselineName :param baseline_results: The rule baseline result :type baseline_results: list[~azure.mgmt.sql.models.DatabaseVulnerabilityAssessmentRuleBaselineItem] @@ -156,7 +166,7 @@ def create_or_update( 'databaseName': self._serialize.url("database_name", database_name, 'str'), 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_name, 'str'), 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), - 'baselineName': self._serialize.url("self.baseline_name", self.baseline_name, 'str'), + 'baselineName': self._serialize.url("baseline_name", baseline_name, 'VulnerabilityAssessmentPolicyBaselineName'), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -201,7 +211,7 @@ def create_or_update( create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}'} def delete( - self, resource_group_name, server_name, database_name, rule_id, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, server_name, database_name, rule_id, baseline_name, custom_headers=None, raw=False, **operation_config): """Removes the database's vulnerability assessment rule baseline. :param resource_group_name: The name of the resource group that @@ -215,6 +225,12 @@ def delete( :type database_name: str :param rule_id: The vulnerability assessment rule ID. :type rule_id: str + :param baseline_name: The name of the vulnerability assessment rule + baseline (default implies a baseline on a database level rule and + master for server level rule). Possible values include: 'master', + 'default' + :type baseline_name: str or + ~azure.mgmt.sql.models.VulnerabilityAssessmentPolicyBaselineName :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -232,7 +248,7 @@ def delete( 'databaseName': self._serialize.url("database_name", database_name, 'str'), 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_name, 'str'), 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), - 'baselineName': self._serialize.url("self.baseline_name", self.baseline_name, 'str'), + 'baselineName': self._serialize.url("baseline_name", baseline_name, 'VulnerabilityAssessmentPolicyBaselineName'), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) diff --git a/azure-mgmt-sql/azure/mgmt/sql/version.py b/azure-mgmt-sql/azure/mgmt/sql/version.py index 413a68a462da..3697d9b71739 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/version.py +++ b/azure-mgmt-sql/azure/mgmt/sql/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.9.1" +VERSION = "0.9.0" From bff56107ef35b8f197cefc254e3ca59c84e90975 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 11 Jun 2018 12:43:27 -0700 Subject: [PATCH 02/19] [AutoPR sql/resource-manager] Adding serverSecurityAlertPolicies.json from pr (#2697) * Generated from 462e8a68d6f8e8d169a1bf4340ca64ebdbce314d Fix validation error * Generated from bd7ff47b3e8549566c77c4ebc7de1e86703ac29e fixed comments * Generated from bd7ff47b3e8549566c77c4ebc7de1e86703ac29e fixed comments --- .../azure/mgmt/sql/models/__init__.py | 5 + .../models/server_security_alert_policy.py | 82 +++++++ .../server_security_alert_policy_py3.py | 82 +++++++ .../sql/models/sql_management_client_enums.py | 6 + .../azure/mgmt/sql/operations/__init__.py | 2 + ...rver_security_alert_policies_operations.py | 211 ++++++++++++++++++ .../azure/mgmt/sql/sql_management_client.py | 5 + 7 files changed, 393 insertions(+) create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy_py3.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/server_security_alert_policies_operations.py diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py index 6570ace507ee..6d4bd5f3c186 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py @@ -108,6 +108,7 @@ from .server_automatic_tuning_py3 import ServerAutomaticTuning from .server_dns_alias_py3 import ServerDnsAlias from .server_dns_alias_acquisition_py3 import ServerDnsAliasAcquisition + from .server_security_alert_policy_py3 import ServerSecurityAlertPolicy from .restore_point_py3 import RestorePoint from .create_database_restore_point_definition_py3 import CreateDatabaseRestorePointDefinition from .database_operation_py3 import DatabaseOperation @@ -243,6 +244,7 @@ from .server_automatic_tuning import ServerAutomaticTuning from .server_dns_alias import ServerDnsAlias from .server_dns_alias_acquisition import ServerDnsAliasAcquisition + from .server_security_alert_policy import ServerSecurityAlertPolicy from .restore_point import RestorePoint from .create_database_restore_point_definition import CreateDatabaseRestorePointDefinition from .database_operation import DatabaseOperation @@ -388,6 +390,7 @@ ManagedDatabaseCreateMode, AutomaticTuningServerMode, AutomaticTuningServerReason, + SecurityAlertState, RestorePointType, ManagementOperationState, MaxSizeUnit, @@ -508,6 +511,7 @@ 'ServerAutomaticTuning', 'ServerDnsAlias', 'ServerDnsAliasAcquisition', + 'ServerSecurityAlertPolicy', 'RestorePoint', 'CreateDatabaseRestorePointDefinition', 'DatabaseOperation', @@ -652,6 +656,7 @@ 'ManagedDatabaseCreateMode', 'AutomaticTuningServerMode', 'AutomaticTuningServerReason', + 'SecurityAlertState', 'RestorePointType', 'ManagementOperationState', 'MaxSizeUnit', diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy.py new file mode 100644 index 000000000000..428a8edb608b --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy.py @@ -0,0 +1,82 @@ +# 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.sql.models.SecurityAlertState + :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': 'SecurityAlertState'}, + '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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy_py3.py new file mode 100644 index 000000000000..62457fadcf25 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy_py3.py @@ -0,0 +1,82 @@ +# 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.sql.models.SecurityAlertState + :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': 'SecurityAlertState'}, + '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 diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py b/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py index 273dd0d3484b..1a9912914186 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py @@ -515,6 +515,12 @@ class AutomaticTuningServerReason(str, Enum): auto_configured = "AutoConfigured" +class SecurityAlertState(str, Enum): + + enabled = "Enabled" + disabled = "Disabled" + + class RestorePointType(str, Enum): continuous = "CONTINUOUS" diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py index 953bb00775df..6a439bd7367f 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py @@ -60,6 +60,7 @@ from .managed_databases_operations import ManagedDatabasesOperations from .server_automatic_tuning_operations import ServerAutomaticTuningOperations from .server_dns_aliases_operations import ServerDnsAliasesOperations +from .server_security_alert_policies_operations import ServerSecurityAlertPoliciesOperations from .restore_points_operations import RestorePointsOperations from .database_operations import DatabaseOperations from .elastic_pool_operations import ElasticPoolOperations @@ -120,6 +121,7 @@ 'ManagedDatabasesOperations', 'ServerAutomaticTuningOperations', 'ServerDnsAliasesOperations', + 'ServerSecurityAlertPoliciesOperations', 'RestorePointsOperations', 'DatabaseOperations', 'ElasticPoolOperations', diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/server_security_alert_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/server_security_alert_policies_operations.py new file mode 100644 index 000000000000..ddbd335574b4 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/server_security_alert_policies_operations.py @@ -0,0 +1,211 @@ +# 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 ServerSecurityAlertPoliciesOperations(object): + """ServerSecurityAlertPoliciesOperations 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 security_alert_policy_name: The name of the security alert policy. Constant value: "Default". + :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.security_alert_policy_name = "Default" + self.api_version = "2017-03-01-preview" + + self.config = config + + def get( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + """Get a server's security alert policy. + + :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: ServerSecurityAlertPolicy or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.ServerSecurityAlertPolicy 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'), + 'securityAlertPolicyName': self._serialize.url("self.security_alert_policy_name", self.security_alert_policy_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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, 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('ServerSecurityAlertPolicy', 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}/securityAlertPolicies/{securityAlertPolicyName}'} + + + def _create_or_update_initial( + 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 = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'securityAlertPolicyName': self._serialize.url("self.security_alert_policy_name", self.security_alert_policy_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['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, 'ServerSecurityAlertPolicy') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, 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('ServerSecurityAlertPolicy', 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, 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 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 parameters: The server security alert policy. + :type parameters: ~azure.mgmt.sql.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 + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + ServerSecurityAlertPolicy or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ServerSecurityAlertPolicy] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.sql.models.ServerSecurityAlertPolicy]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ServerSecurityAlertPolicy', 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}/securityAlertPolicies/{securityAlertPolicyName}'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py index 39a53dad15fb..9afb33b63ea4 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py +++ b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py @@ -64,6 +64,7 @@ from .operations.managed_databases_operations import ManagedDatabasesOperations from .operations.server_automatic_tuning_operations import ServerAutomaticTuningOperations from .operations.server_dns_aliases_operations import ServerDnsAliasesOperations +from .operations.server_security_alert_policies_operations import ServerSecurityAlertPoliciesOperations from .operations.restore_points_operations import RestorePointsOperations from .operations.database_operations import DatabaseOperations from .operations.elastic_pool_operations import ElasticPoolOperations @@ -215,6 +216,8 @@ class SqlManagementClient(SDKClient): :vartype server_automatic_tuning: azure.mgmt.sql.operations.ServerAutomaticTuningOperations :ivar server_dns_aliases: ServerDnsAliases operations :vartype server_dns_aliases: azure.mgmt.sql.operations.ServerDnsAliasesOperations + :ivar server_security_alert_policies: ServerSecurityAlertPolicies operations + :vartype server_security_alert_policies: azure.mgmt.sql.operations.ServerSecurityAlertPoliciesOperations :ivar restore_points: RestorePoints operations :vartype restore_points: azure.mgmt.sql.operations.RestorePointsOperations :ivar database_operations: DatabaseOperations operations @@ -351,6 +354,8 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.server_dns_aliases = ServerDnsAliasesOperations( self._client, self.config, self._serialize, self._deserialize) + self.server_security_alert_policies = ServerSecurityAlertPoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) self.restore_points = RestorePointsOperations( self._client, self.config, self._serialize, self._deserialize) self.database_operations = DatabaseOperations( From 0c504348c902433d0245858f53c47c904fa74549 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 12 Jun 2018 15:42:36 -0700 Subject: [PATCH 03/19] [AutoPR sql/resource-manager] Add BackupShortTermRetentionListResult and update exceptions (#2711) * Generated from f2bb07205397d5771778173d8fc08e1660441fc7 Add BackupShortTermRetentionListResult and update exceptions * Generated from ca8661c9673dc5775e0bc7ce94fb773805235953 Use comnmon definition for ProxyResource * Generated from 65482c1a0eb55bd7b3dbf9be9f7018a0df05d229 Add ListShortTermRetentionPoliciesByDatabase example --- .../azure/mgmt/sql/models/__init__.py | 21 +- ...ackup_short_term_retention_policy_paged.py | 27 +++ .../models/database_blob_auditing_policy.py | 62 ++++- .../database_blob_auditing_policy_py3.py | 62 ++++- .../extended_database_blob_auditing_policy.py | 146 ++++++++++++ ...ended_database_blob_auditing_policy_py3.py | 146 ++++++++++++ .../extended_server_blob_auditing_policy.py | 146 ++++++++++++ ...xtended_server_blob_auditing_policy_py3.py | 146 ++++++++++++ .../sql/models/server_blob_auditing_policy.py | 141 ++++++++++++ .../models/server_blob_auditing_policy_py3.py | 141 ++++++++++++ .../sql/models/sql_management_client_enums.py | 12 +- .../azure/mgmt/sql/operations/__init__.py | 10 +- ...hort_term_retention_policies_operations.py | 76 +++++++ ...abase_blob_auditing_policies_operations.py | 10 +- ...abase_blob_auditing_policies_operations.py | 187 +++++++++++++++ ...erver_blob_auditing_policies_operations.py | 213 ++++++++++++++++++ ...erver_blob_auditing_policies_operations.py | 211 +++++++++++++++++ .../azure/mgmt/sql/sql_management_client.py | 25 +- 18 files changed, 1754 insertions(+), 28 deletions(-) create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/backup_short_term_retention_policy_paged.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy_py3.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy_py3.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy_py3.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/extended_database_blob_auditing_policies_operations.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/extended_server_blob_auditing_policies_operations.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/server_blob_auditing_policies_operations.py diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py index 6d4bd5f3c186..bbb8651e588a 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py @@ -48,7 +48,6 @@ from .transparent_data_encryption_activity_py3 import TransparentDataEncryptionActivity from .server_usage_py3 import ServerUsage from .database_usage_py3 import DatabaseUsage - from .database_blob_auditing_policy_py3 import DatabaseBlobAuditingPolicy from .automatic_tuning_options_py3 import AutomaticTuningOptions from .database_automatic_tuning_py3 import DatabaseAutomaticTuning from .encryption_protector_py3 import EncryptionProtector @@ -81,6 +80,10 @@ from .sync_member_py3 import SyncMember from .subscription_usage_py3 import SubscriptionUsage from .virtual_network_rule_py3 import VirtualNetworkRule + from .extended_database_blob_auditing_policy_py3 import ExtendedDatabaseBlobAuditingPolicy + from .extended_server_blob_auditing_policy_py3 import ExtendedServerBlobAuditingPolicy + from .server_blob_auditing_policy_py3 import ServerBlobAuditingPolicy + from .database_blob_auditing_policy_py3 import DatabaseBlobAuditingPolicy from .database_vulnerability_assessment_rule_baseline_item_py3 import DatabaseVulnerabilityAssessmentRuleBaselineItem from .database_vulnerability_assessment_rule_baseline_py3 import DatabaseVulnerabilityAssessmentRuleBaseline from .vulnerability_assessment_recurring_scans_properties_py3 import VulnerabilityAssessmentRecurringScansProperties @@ -184,7 +187,6 @@ from .transparent_data_encryption_activity import TransparentDataEncryptionActivity from .server_usage import ServerUsage from .database_usage import DatabaseUsage - from .database_blob_auditing_policy import DatabaseBlobAuditingPolicy from .automatic_tuning_options import AutomaticTuningOptions from .database_automatic_tuning import DatabaseAutomaticTuning from .encryption_protector import EncryptionProtector @@ -217,6 +219,10 @@ from .sync_member import SyncMember from .subscription_usage import SubscriptionUsage from .virtual_network_rule import VirtualNetworkRule + from .extended_database_blob_auditing_policy import ExtendedDatabaseBlobAuditingPolicy + from .extended_server_blob_auditing_policy import ExtendedServerBlobAuditingPolicy + from .server_blob_auditing_policy import ServerBlobAuditingPolicy + from .database_blob_auditing_policy import DatabaseBlobAuditingPolicy from .database_vulnerability_assessment_rule_baseline_item import DatabaseVulnerabilityAssessmentRuleBaselineItem from .database_vulnerability_assessment_rule_baseline import DatabaseVulnerabilityAssessmentRuleBaseline from .vulnerability_assessment_recurring_scans_properties import VulnerabilityAssessmentRecurringScansProperties @@ -332,6 +338,7 @@ from .elastic_pool_operation_paged import ElasticPoolOperationPaged from .vulnerability_assessment_scan_record_paged import VulnerabilityAssessmentScanRecordPaged from .instance_failover_group_paged import InstanceFailoverGroupPaged +from .backup_short_term_retention_policy_paged import BackupShortTermRetentionPolicyPaged from .sql_management_client_enums import ( CheckNameAvailabilityReason, ServerConnectionType, @@ -357,7 +364,6 @@ RecommendedIndexType, TransparentDataEncryptionStatus, TransparentDataEncryptionActivityStatus, - BlobAuditingPolicyState, AutomaticTuningMode, AutomaticTuningOptionModeDesired, AutomaticTuningOptionModeActual, @@ -376,6 +382,7 @@ SyncDirection, SyncMemberState, VirtualNetworkRuleState, + BlobAuditingPolicyState, JobAgentState, JobExecutionLifecycle, ProvisioningState, @@ -451,7 +458,6 @@ 'TransparentDataEncryptionActivity', 'ServerUsage', 'DatabaseUsage', - 'DatabaseBlobAuditingPolicy', 'AutomaticTuningOptions', 'DatabaseAutomaticTuning', 'EncryptionProtector', @@ -484,6 +490,10 @@ 'SyncMember', 'SubscriptionUsage', 'VirtualNetworkRule', + 'ExtendedDatabaseBlobAuditingPolicy', + 'ExtendedServerBlobAuditingPolicy', + 'ServerBlobAuditingPolicy', + 'DatabaseBlobAuditingPolicy', 'DatabaseVulnerabilityAssessmentRuleBaselineItem', 'DatabaseVulnerabilityAssessmentRuleBaseline', 'VulnerabilityAssessmentRecurringScansProperties', @@ -599,6 +609,7 @@ 'ElasticPoolOperationPaged', 'VulnerabilityAssessmentScanRecordPaged', 'InstanceFailoverGroupPaged', + 'BackupShortTermRetentionPolicyPaged', 'CheckNameAvailabilityReason', 'ServerConnectionType', 'SecurityAlertPolicyState', @@ -623,7 +634,6 @@ 'RecommendedIndexType', 'TransparentDataEncryptionStatus', 'TransparentDataEncryptionActivityStatus', - 'BlobAuditingPolicyState', 'AutomaticTuningMode', 'AutomaticTuningOptionModeDesired', 'AutomaticTuningOptionModeActual', @@ -642,6 +652,7 @@ 'SyncDirection', 'SyncMemberState', 'VirtualNetworkRuleState', + 'BlobAuditingPolicyState', 'JobAgentState', 'JobExecutionLifecycle', 'ProvisioningState', diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/backup_short_term_retention_policy_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/backup_short_term_retention_policy_paged.py new file mode 100644 index 000000000000..16d31e341795 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/backup_short_term_retention_policy_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 BackupShortTermRetentionPolicyPaged(Paged): + """ + A paging container for iterating over a list of :class:`BackupShortTermRetentionPolicy ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[BackupShortTermRetentionPolicy]'} + } + + def __init__(self, *args, **kwargs): + + super(BackupShortTermRetentionPolicyPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy.py b/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy.py index 407713325e7d..963b7674ac16 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy.py @@ -43,14 +43,72 @@ class DatabaseBlobAuditingPolicy(ProxyResource): :param retention_days: Specifies the number of days to keep in the audit logs. :type retention_days: int - :param audit_actions_and_groups: Specifies the Actions and Actions-Groups + :param audit_actions_and_groups: Specifies the Actions-Groups and Actions to audit. + The recommended set of action groups to use is the following combination - + this will audit all the queries and stored procedures executed against the + database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when + enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific + groups that cover your auditing needs. Using unnecessary groups could lead + to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures + executed against the database, and should not be used in combination with + other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action + Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note + that Actions cannot be specified for Server auditing policy). The + supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + ON BY + Note that in the above format can refer to an object like a + table, view, or stored procedure, or an entire database or schema. For the + latter cases, the forms DATABASE:: and SCHEMA:: are + used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit + Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) :type audit_actions_and_groups: list[str] :param storage_account_subscription_id: Specifies the blob storage subscription Id. :type storage_account_subscription_id: str :param is_storage_secondary_key_in_use: Specifies whether - storageAccountAccessKey value is the storage’s secondary key. + storageAccountAccessKey value is the storage's secondary key. :type is_storage_secondary_key_in_use: bool """ diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy_py3.py index bfc95370f0fc..1c58ec560a03 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy_py3.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy_py3.py @@ -43,14 +43,72 @@ class DatabaseBlobAuditingPolicy(ProxyResource): :param retention_days: Specifies the number of days to keep in the audit logs. :type retention_days: int - :param audit_actions_and_groups: Specifies the Actions and Actions-Groups + :param audit_actions_and_groups: Specifies the Actions-Groups and Actions to audit. + The recommended set of action groups to use is the following combination - + this will audit all the queries and stored procedures executed against the + database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when + enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific + groups that cover your auditing needs. Using unnecessary groups could lead + to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures + executed against the database, and should not be used in combination with + other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action + Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note + that Actions cannot be specified for Server auditing policy). The + supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + ON BY + Note that in the above format can refer to an object like a + table, view, or stored procedure, or an entire database or schema. For the + latter cases, the forms DATABASE:: and SCHEMA:: are + used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit + Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) :type audit_actions_and_groups: list[str] :param storage_account_subscription_id: Specifies the blob storage subscription Id. :type storage_account_subscription_id: str :param is_storage_secondary_key_in_use: Specifies whether - storageAccountAccessKey value is the storage’s secondary key. + storageAccountAccessKey value is the storage's secondary key. :type is_storage_secondary_key_in_use: bool """ diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy.py b/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy.py new file mode 100644 index 000000000000..cdfb75e47f2a --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy.py @@ -0,0 +1,146 @@ +# 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 ExtendedDatabaseBlobAuditingPolicy(ProxyResource): + """An extended database blob auditing 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 predicate_expression: Specifies condition of where clause when + creating an audit. + :type predicate_expression: str + :param state: Required. Specifies the state of the policy. If state is + Enabled, storageEndpoint and storageAccountAccessKey are required. + Possible values include: 'Enabled', 'Disabled' + :type state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState + :param storage_endpoint: Specifies the blob storage endpoint (e.g. + https://MyAccount.blob.core.windows.net). If state is Enabled, + storageEndpoint is required. + :type storage_endpoint: str + :param storage_account_access_key: Specifies the identifier key of the + auditing storage account. If state is Enabled, storageAccountAccessKey is + required. + :type storage_account_access_key: str + :param retention_days: Specifies the number of days to keep in the audit + logs. + :type retention_days: int + :param audit_actions_and_groups: Specifies the Actions-Groups and Actions + to audit. + The recommended set of action groups to use is the following combination - + this will audit all the queries and stored procedures executed against the + database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when + enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific + groups that cover your auditing needs. Using unnecessary groups could lead + to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures + executed against the database, and should not be used in combination with + other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action + Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note + that Actions cannot be specified for Server auditing policy). The + supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + ON BY + Note that in the above format can refer to an object like a + table, view, or stored procedure, or an entire database or schema. For the + latter cases, the forms DATABASE:: and SCHEMA:: are + used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit + Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) + :type audit_actions_and_groups: list[str] + :param storage_account_subscription_id: Specifies the blob storage + subscription Id. + :type storage_account_subscription_id: str + :param is_storage_secondary_key_in_use: Specifies whether + storageAccountAccessKey value is the storage's secondary key. + :type is_storage_secondary_key_in_use: bool + """ + + _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'}, + 'predicate_expression': {'key': 'properties.predicateExpression', 'type': 'str'}, + 'state': {'key': 'properties.state', 'type': 'BlobAuditingPolicyState'}, + 'storage_endpoint': {'key': 'properties.storageEndpoint', 'type': 'str'}, + 'storage_account_access_key': {'key': 'properties.storageAccountAccessKey', 'type': 'str'}, + 'retention_days': {'key': 'properties.retentionDays', 'type': 'int'}, + 'audit_actions_and_groups': {'key': 'properties.auditActionsAndGroups', 'type': '[str]'}, + 'storage_account_subscription_id': {'key': 'properties.storageAccountSubscriptionId', 'type': 'str'}, + 'is_storage_secondary_key_in_use': {'key': 'properties.isStorageSecondaryKeyInUse', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(ExtendedDatabaseBlobAuditingPolicy, self).__init__(**kwargs) + self.predicate_expression = kwargs.get('predicate_expression', None) + self.state = kwargs.get('state', 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.audit_actions_and_groups = kwargs.get('audit_actions_and_groups', None) + self.storage_account_subscription_id = kwargs.get('storage_account_subscription_id', None) + self.is_storage_secondary_key_in_use = kwargs.get('is_storage_secondary_key_in_use', None) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy_py3.py new file mode 100644 index 000000000000..ee5ce27523e1 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy_py3.py @@ -0,0 +1,146 @@ +# 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 ExtendedDatabaseBlobAuditingPolicy(ProxyResource): + """An extended database blob auditing 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 predicate_expression: Specifies condition of where clause when + creating an audit. + :type predicate_expression: str + :param state: Required. Specifies the state of the policy. If state is + Enabled, storageEndpoint and storageAccountAccessKey are required. + Possible values include: 'Enabled', 'Disabled' + :type state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState + :param storage_endpoint: Specifies the blob storage endpoint (e.g. + https://MyAccount.blob.core.windows.net). If state is Enabled, + storageEndpoint is required. + :type storage_endpoint: str + :param storage_account_access_key: Specifies the identifier key of the + auditing storage account. If state is Enabled, storageAccountAccessKey is + required. + :type storage_account_access_key: str + :param retention_days: Specifies the number of days to keep in the audit + logs. + :type retention_days: int + :param audit_actions_and_groups: Specifies the Actions-Groups and Actions + to audit. + The recommended set of action groups to use is the following combination - + this will audit all the queries and stored procedures executed against the + database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when + enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific + groups that cover your auditing needs. Using unnecessary groups could lead + to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures + executed against the database, and should not be used in combination with + other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action + Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note + that Actions cannot be specified for Server auditing policy). The + supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + ON BY + Note that in the above format can refer to an object like a + table, view, or stored procedure, or an entire database or schema. For the + latter cases, the forms DATABASE:: and SCHEMA:: are + used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit + Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) + :type audit_actions_and_groups: list[str] + :param storage_account_subscription_id: Specifies the blob storage + subscription Id. + :type storage_account_subscription_id: str + :param is_storage_secondary_key_in_use: Specifies whether + storageAccountAccessKey value is the storage's secondary key. + :type is_storage_secondary_key_in_use: bool + """ + + _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'}, + 'predicate_expression': {'key': 'properties.predicateExpression', 'type': 'str'}, + 'state': {'key': 'properties.state', 'type': 'BlobAuditingPolicyState'}, + 'storage_endpoint': {'key': 'properties.storageEndpoint', 'type': 'str'}, + 'storage_account_access_key': {'key': 'properties.storageAccountAccessKey', 'type': 'str'}, + 'retention_days': {'key': 'properties.retentionDays', 'type': 'int'}, + 'audit_actions_and_groups': {'key': 'properties.auditActionsAndGroups', 'type': '[str]'}, + 'storage_account_subscription_id': {'key': 'properties.storageAccountSubscriptionId', 'type': 'str'}, + 'is_storage_secondary_key_in_use': {'key': 'properties.isStorageSecondaryKeyInUse', 'type': 'bool'}, + } + + def __init__(self, *, state, predicate_expression: str=None, storage_endpoint: str=None, storage_account_access_key: str=None, retention_days: int=None, audit_actions_and_groups=None, storage_account_subscription_id: str=None, is_storage_secondary_key_in_use: bool=None, **kwargs) -> None: + super(ExtendedDatabaseBlobAuditingPolicy, self).__init__(**kwargs) + self.predicate_expression = predicate_expression + self.state = state + self.storage_endpoint = storage_endpoint + self.storage_account_access_key = storage_account_access_key + self.retention_days = retention_days + self.audit_actions_and_groups = audit_actions_and_groups + self.storage_account_subscription_id = storage_account_subscription_id + self.is_storage_secondary_key_in_use = is_storage_secondary_key_in_use diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy.py b/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy.py new file mode 100644 index 000000000000..a11e18ac68b1 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy.py @@ -0,0 +1,146 @@ +# 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 ExtendedServerBlobAuditingPolicy(ProxyResource): + """An extended server blob auditing 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 predicate_expression: Specifies condition of where clause when + creating an audit. + :type predicate_expression: str + :param state: Required. Specifies the state of the policy. If state is + Enabled, storageEndpoint and storageAccountAccessKey are required. + Possible values include: 'Enabled', 'Disabled' + :type state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState + :param storage_endpoint: Specifies the blob storage endpoint (e.g. + https://MyAccount.blob.core.windows.net). If state is Enabled, + storageEndpoint is required. + :type storage_endpoint: str + :param storage_account_access_key: Specifies the identifier key of the + auditing storage account. If state is Enabled, storageAccountAccessKey is + required. + :type storage_account_access_key: str + :param retention_days: Specifies the number of days to keep in the audit + logs. + :type retention_days: int + :param audit_actions_and_groups: Specifies the Actions-Groups and Actions + to audit. + The recommended set of action groups to use is the following combination - + this will audit all the queries and stored procedures executed against the + database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when + enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific + groups that cover your auditing needs. Using unnecessary groups could lead + to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures + executed against the database, and should not be used in combination with + other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action + Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note + that Actions cannot be specified for Server auditing policy). The + supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + ON BY + Note that in the above format can refer to an object like a + table, view, or stored procedure, or an entire database or schema. For the + latter cases, the forms DATABASE:: and SCHEMA:: are + used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit + Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) + :type audit_actions_and_groups: list[str] + :param storage_account_subscription_id: Specifies the blob storage + subscription Id. + :type storage_account_subscription_id: str + :param is_storage_secondary_key_in_use: Specifies whether + storageAccountAccessKey value is the storage's secondary key. + :type is_storage_secondary_key_in_use: bool + """ + + _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'}, + 'predicate_expression': {'key': 'properties.predicateExpression', 'type': 'str'}, + 'state': {'key': 'properties.state', 'type': 'BlobAuditingPolicyState'}, + 'storage_endpoint': {'key': 'properties.storageEndpoint', 'type': 'str'}, + 'storage_account_access_key': {'key': 'properties.storageAccountAccessKey', 'type': 'str'}, + 'retention_days': {'key': 'properties.retentionDays', 'type': 'int'}, + 'audit_actions_and_groups': {'key': 'properties.auditActionsAndGroups', 'type': '[str]'}, + 'storage_account_subscription_id': {'key': 'properties.storageAccountSubscriptionId', 'type': 'str'}, + 'is_storage_secondary_key_in_use': {'key': 'properties.isStorageSecondaryKeyInUse', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(ExtendedServerBlobAuditingPolicy, self).__init__(**kwargs) + self.predicate_expression = kwargs.get('predicate_expression', None) + self.state = kwargs.get('state', 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.audit_actions_and_groups = kwargs.get('audit_actions_and_groups', None) + self.storage_account_subscription_id = kwargs.get('storage_account_subscription_id', None) + self.is_storage_secondary_key_in_use = kwargs.get('is_storage_secondary_key_in_use', None) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy_py3.py new file mode 100644 index 000000000000..ac522801a8dd --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy_py3.py @@ -0,0 +1,146 @@ +# 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 ExtendedServerBlobAuditingPolicy(ProxyResource): + """An extended server blob auditing 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 predicate_expression: Specifies condition of where clause when + creating an audit. + :type predicate_expression: str + :param state: Required. Specifies the state of the policy. If state is + Enabled, storageEndpoint and storageAccountAccessKey are required. + Possible values include: 'Enabled', 'Disabled' + :type state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState + :param storage_endpoint: Specifies the blob storage endpoint (e.g. + https://MyAccount.blob.core.windows.net). If state is Enabled, + storageEndpoint is required. + :type storage_endpoint: str + :param storage_account_access_key: Specifies the identifier key of the + auditing storage account. If state is Enabled, storageAccountAccessKey is + required. + :type storage_account_access_key: str + :param retention_days: Specifies the number of days to keep in the audit + logs. + :type retention_days: int + :param audit_actions_and_groups: Specifies the Actions-Groups and Actions + to audit. + The recommended set of action groups to use is the following combination - + this will audit all the queries and stored procedures executed against the + database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when + enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific + groups that cover your auditing needs. Using unnecessary groups could lead + to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures + executed against the database, and should not be used in combination with + other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action + Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note + that Actions cannot be specified for Server auditing policy). The + supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + ON BY + Note that in the above format can refer to an object like a + table, view, or stored procedure, or an entire database or schema. For the + latter cases, the forms DATABASE:: and SCHEMA:: are + used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit + Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) + :type audit_actions_and_groups: list[str] + :param storage_account_subscription_id: Specifies the blob storage + subscription Id. + :type storage_account_subscription_id: str + :param is_storage_secondary_key_in_use: Specifies whether + storageAccountAccessKey value is the storage's secondary key. + :type is_storage_secondary_key_in_use: bool + """ + + _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'}, + 'predicate_expression': {'key': 'properties.predicateExpression', 'type': 'str'}, + 'state': {'key': 'properties.state', 'type': 'BlobAuditingPolicyState'}, + 'storage_endpoint': {'key': 'properties.storageEndpoint', 'type': 'str'}, + 'storage_account_access_key': {'key': 'properties.storageAccountAccessKey', 'type': 'str'}, + 'retention_days': {'key': 'properties.retentionDays', 'type': 'int'}, + 'audit_actions_and_groups': {'key': 'properties.auditActionsAndGroups', 'type': '[str]'}, + 'storage_account_subscription_id': {'key': 'properties.storageAccountSubscriptionId', 'type': 'str'}, + 'is_storage_secondary_key_in_use': {'key': 'properties.isStorageSecondaryKeyInUse', 'type': 'bool'}, + } + + def __init__(self, *, state, predicate_expression: str=None, storage_endpoint: str=None, storage_account_access_key: str=None, retention_days: int=None, audit_actions_and_groups=None, storage_account_subscription_id: str=None, is_storage_secondary_key_in_use: bool=None, **kwargs) -> None: + super(ExtendedServerBlobAuditingPolicy, self).__init__(**kwargs) + self.predicate_expression = predicate_expression + self.state = state + self.storage_endpoint = storage_endpoint + self.storage_account_access_key = storage_account_access_key + self.retention_days = retention_days + self.audit_actions_and_groups = audit_actions_and_groups + self.storage_account_subscription_id = storage_account_subscription_id + self.is_storage_secondary_key_in_use = is_storage_secondary_key_in_use diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy.py new file mode 100644 index 000000000000..0232582a4237 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy.py @@ -0,0 +1,141 @@ +# 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 ServerBlobAuditingPolicy(ProxyResource): + """A server blob auditing 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. If state is + Enabled, storageEndpoint and storageAccountAccessKey are required. + Possible values include: 'Enabled', 'Disabled' + :type state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState + :param storage_endpoint: Specifies the blob storage endpoint (e.g. + https://MyAccount.blob.core.windows.net). If state is Enabled, + storageEndpoint is required. + :type storage_endpoint: str + :param storage_account_access_key: Specifies the identifier key of the + auditing storage account. If state is Enabled, storageAccountAccessKey is + required. + :type storage_account_access_key: str + :param retention_days: Specifies the number of days to keep in the audit + logs. + :type retention_days: int + :param audit_actions_and_groups: Specifies the Actions-Groups and Actions + to audit. + The recommended set of action groups to use is the following combination - + this will audit all the queries and stored procedures executed against the + database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when + enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific + groups that cover your auditing needs. Using unnecessary groups could lead + to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures + executed against the database, and should not be used in combination with + other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action + Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note + that Actions cannot be specified for Server auditing policy). The + supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + ON BY + Note that in the above format can refer to an object like a + table, view, or stored procedure, or an entire database or schema. For the + latter cases, the forms DATABASE:: and SCHEMA:: are + used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit + Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) + :type audit_actions_and_groups: list[str] + :param storage_account_subscription_id: Specifies the blob storage + subscription Id. + :type storage_account_subscription_id: str + :param is_storage_secondary_key_in_use: Specifies whether + storageAccountAccessKey value is the storage's secondary key. + :type is_storage_secondary_key_in_use: bool + """ + + _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': 'BlobAuditingPolicyState'}, + 'storage_endpoint': {'key': 'properties.storageEndpoint', 'type': 'str'}, + 'storage_account_access_key': {'key': 'properties.storageAccountAccessKey', 'type': 'str'}, + 'retention_days': {'key': 'properties.retentionDays', 'type': 'int'}, + 'audit_actions_and_groups': {'key': 'properties.auditActionsAndGroups', 'type': '[str]'}, + 'storage_account_subscription_id': {'key': 'properties.storageAccountSubscriptionId', 'type': 'str'}, + 'is_storage_secondary_key_in_use': {'key': 'properties.isStorageSecondaryKeyInUse', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(ServerBlobAuditingPolicy, self).__init__(**kwargs) + self.state = kwargs.get('state', 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.audit_actions_and_groups = kwargs.get('audit_actions_and_groups', None) + self.storage_account_subscription_id = kwargs.get('storage_account_subscription_id', None) + self.is_storage_secondary_key_in_use = kwargs.get('is_storage_secondary_key_in_use', None) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy_py3.py new file mode 100644 index 000000000000..51dcc8c41d4c --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy_py3.py @@ -0,0 +1,141 @@ +# 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 ServerBlobAuditingPolicy(ProxyResource): + """A server blob auditing 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. If state is + Enabled, storageEndpoint and storageAccountAccessKey are required. + Possible values include: 'Enabled', 'Disabled' + :type state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState + :param storage_endpoint: Specifies the blob storage endpoint (e.g. + https://MyAccount.blob.core.windows.net). If state is Enabled, + storageEndpoint is required. + :type storage_endpoint: str + :param storage_account_access_key: Specifies the identifier key of the + auditing storage account. If state is Enabled, storageAccountAccessKey is + required. + :type storage_account_access_key: str + :param retention_days: Specifies the number of days to keep in the audit + logs. + :type retention_days: int + :param audit_actions_and_groups: Specifies the Actions-Groups and Actions + to audit. + The recommended set of action groups to use is the following combination - + this will audit all the queries and stored procedures executed against the + database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when + enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific + groups that cover your auditing needs. Using unnecessary groups could lead + to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures + executed against the database, and should not be used in combination with + other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action + Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note + that Actions cannot be specified for Server auditing policy). The + supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + ON BY + Note that in the above format can refer to an object like a + table, view, or stored procedure, or an entire database or schema. For the + latter cases, the forms DATABASE:: and SCHEMA:: are + used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit + Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) + :type audit_actions_and_groups: list[str] + :param storage_account_subscription_id: Specifies the blob storage + subscription Id. + :type storage_account_subscription_id: str + :param is_storage_secondary_key_in_use: Specifies whether + storageAccountAccessKey value is the storage's secondary key. + :type is_storage_secondary_key_in_use: bool + """ + + _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': 'BlobAuditingPolicyState'}, + 'storage_endpoint': {'key': 'properties.storageEndpoint', 'type': 'str'}, + 'storage_account_access_key': {'key': 'properties.storageAccountAccessKey', 'type': 'str'}, + 'retention_days': {'key': 'properties.retentionDays', 'type': 'int'}, + 'audit_actions_and_groups': {'key': 'properties.auditActionsAndGroups', 'type': '[str]'}, + 'storage_account_subscription_id': {'key': 'properties.storageAccountSubscriptionId', 'type': 'str'}, + 'is_storage_secondary_key_in_use': {'key': 'properties.isStorageSecondaryKeyInUse', 'type': 'bool'}, + } + + def __init__(self, *, state, storage_endpoint: str=None, storage_account_access_key: str=None, retention_days: int=None, audit_actions_and_groups=None, storage_account_subscription_id: str=None, is_storage_secondary_key_in_use: bool=None, **kwargs) -> None: + super(ServerBlobAuditingPolicy, self).__init__(**kwargs) + self.state = state + self.storage_endpoint = storage_endpoint + self.storage_account_access_key = storage_account_access_key + self.retention_days = retention_days + self.audit_actions_and_groups = audit_actions_and_groups + self.storage_account_subscription_id = storage_account_subscription_id + self.is_storage_secondary_key_in_use = is_storage_secondary_key_in_use diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py b/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py index 1a9912914186..a1ebb2af3196 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py @@ -264,12 +264,6 @@ class TransparentDataEncryptionActivityStatus(str, Enum): decrypting = "Decrypting" -class BlobAuditingPolicyState(str, Enum): - - enabled = "Enabled" - disabled = "Disabled" - - class AutomaticTuningMode(str, Enum): inherit = "Inherit" @@ -411,6 +405,12 @@ class VirtualNetworkRuleState(str, Enum): unknown = "Unknown" +class BlobAuditingPolicyState(str, Enum): + + enabled = "Enabled" + disabled = "Disabled" + + class JobAgentState(str, Enum): creating = "Creating" diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py index 6a439bd7367f..5512e9c68b84 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py @@ -32,7 +32,6 @@ from .transparent_data_encryption_activities_operations import TransparentDataEncryptionActivitiesOperations from .server_usages_operations import ServerUsagesOperations from .database_usages_operations import DatabaseUsagesOperations -from .database_blob_auditing_policies_operations import DatabaseBlobAuditingPoliciesOperations from .database_automatic_tuning_operations import DatabaseAutomaticTuningOperations from .encryption_protectors_operations import EncryptionProtectorsOperations from .failover_groups_operations import FailoverGroupsOperations @@ -44,6 +43,10 @@ from .sync_members_operations import SyncMembersOperations from .subscription_usages_operations import SubscriptionUsagesOperations from .virtual_network_rules_operations import VirtualNetworkRulesOperations +from .extended_database_blob_auditing_policies_operations import ExtendedDatabaseBlobAuditingPoliciesOperations +from .extended_server_blob_auditing_policies_operations import ExtendedServerBlobAuditingPoliciesOperations +from .server_blob_auditing_policies_operations import ServerBlobAuditingPoliciesOperations +from .database_blob_auditing_policies_operations import DatabaseBlobAuditingPoliciesOperations from .database_vulnerability_assessment_rule_baselines_operations import DatabaseVulnerabilityAssessmentRuleBaselinesOperations from .database_vulnerability_assessments_operations import DatabaseVulnerabilityAssessmentsOperations from .job_agents_operations import JobAgentsOperations @@ -93,7 +96,6 @@ 'TransparentDataEncryptionActivitiesOperations', 'ServerUsagesOperations', 'DatabaseUsagesOperations', - 'DatabaseBlobAuditingPoliciesOperations', 'DatabaseAutomaticTuningOperations', 'EncryptionProtectorsOperations', 'FailoverGroupsOperations', @@ -105,6 +107,10 @@ 'SyncMembersOperations', 'SubscriptionUsagesOperations', 'VirtualNetworkRulesOperations', + 'ExtendedDatabaseBlobAuditingPoliciesOperations', + 'ExtendedServerBlobAuditingPoliciesOperations', + 'ServerBlobAuditingPoliciesOperations', + 'DatabaseBlobAuditingPoliciesOperations', 'DatabaseVulnerabilityAssessmentRuleBaselinesOperations', 'DatabaseVulnerabilityAssessmentsOperations', 'JobAgentsOperations', diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/backup_short_term_retention_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/backup_short_term_retention_policies_operations.py index e50f15c2a997..ce01d24f68c7 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/backup_short_term_retention_policies_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/backup_short_term_retention_policies_operations.py @@ -331,3 +331,79 @@ def get_long_running_output(response): else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}'} + + def list_by_database( + self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets a database's short term retention policy. + + :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 database_name: The name of the database. + :type database_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 BackupShortTermRetentionPolicy + :rtype: + ~azure.mgmt.sql.models.BackupShortTermRetentionPolicyPaged[~azure.mgmt.sql.models.BackupShortTermRetentionPolicy] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_database.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'), + 'databaseName': self._serialize.url("database_name", database_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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, 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.BackupShortTermRetentionPolicyPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.BackupShortTermRetentionPolicyPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/database_blob_auditing_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/database_blob_auditing_policies_operations.py index fa915bf7c00d..425ace0b8cc3 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/database_blob_auditing_policies_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/database_blob_auditing_policies_operations.py @@ -24,7 +24,7 @@ class DatabaseBlobAuditingPoliciesOperations(object): :param serializer: An object model serializer. :param deserializer: An object model deserializer. :ivar blob_auditing_policy_name: The name of the blob auditing policy. Constant value: "default". - :ivar api_version: The API version to use for the request. Constant value: "2015-05-01-preview". + :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". """ models = models @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._serialize = serializer self._deserialize = deserializer self.blob_auditing_policy_name = "default" - self.api_version = "2015-05-01-preview" + self.api_version = "2017-03-01-preview" self.config = config @@ -49,8 +49,7 @@ def get( :type resource_group_name: str :param server_name: The name of the server. :type server_name: str - :param database_name: The name of the database for which the blob - audit policy is defined. + :param database_name: The name of the database. :type database_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the @@ -118,8 +117,7 @@ def create_or_update( :type resource_group_name: str :param server_name: The name of the server. :type server_name: str - :param database_name: The name of the database for which the blob - auditing policy will be defined. + :param database_name: The name of the database. :type database_name: str :param parameters: The database blob auditing policy. :type parameters: ~azure.mgmt.sql.models.DatabaseBlobAuditingPolicy diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/extended_database_blob_auditing_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/extended_database_blob_auditing_policies_operations.py new file mode 100644 index 000000000000..73ff8454c8b5 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/extended_database_blob_auditing_policies_operations.py @@ -0,0 +1,187 @@ +# 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 .. import models + + +class ExtendedDatabaseBlobAuditingPoliciesOperations(object): + """ExtendedDatabaseBlobAuditingPoliciesOperations 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 blob_auditing_policy_name: The name of the blob auditing policy. Constant value: "default". + :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.blob_auditing_policy_name = "default" + self.api_version = "2017-03-01-preview" + + self.config = config + + def get( + self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets an extended database's blob auditing policy. + + :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 database_name: The name of the database. + :type database_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: ExtendedDatabaseBlobAuditingPolicy or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.sql.models.ExtendedDatabaseBlobAuditingPolicy 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'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'blobAuditingPolicyName': self._serialize.url("self.blob_auditing_policy_name", self.blob_auditing_policy_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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, 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('ExtendedDatabaseBlobAuditingPolicy', 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}/databases/{databaseName}/extendedAuditingSettings/{blobAuditingPolicyName}'} + + def create_or_update( + self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates an extended database's blob auditing policy. + + :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 database_name: The name of the database. + :type database_name: str + :param parameters: The extended database blob auditing policy. + :type parameters: + ~azure.mgmt.sql.models.ExtendedDatabaseBlobAuditingPolicy + :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: ExtendedDatabaseBlobAuditingPolicy or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.sql.models.ExtendedDatabaseBlobAuditingPolicy or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # 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'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'blobAuditingPolicyName': self._serialize.url("self.blob_auditing_policy_name", self.blob_auditing_policy_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['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, 'ExtendedDatabaseBlobAuditingPolicy') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + 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('ExtendedDatabaseBlobAuditingPolicy', response) + if response.status_code == 201: + deserialized = self._deserialize('ExtendedDatabaseBlobAuditingPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extendedAuditingSettings/{blobAuditingPolicyName}'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/extended_server_blob_auditing_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/extended_server_blob_auditing_policies_operations.py new file mode 100644 index 000000000000..02830132aa3f --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/extended_server_blob_auditing_policies_operations.py @@ -0,0 +1,213 @@ +# 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 ExtendedServerBlobAuditingPoliciesOperations(object): + """ExtendedServerBlobAuditingPoliciesOperations 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 blob_auditing_policy_name: The name of the blob auditing policy. Constant value: "default". + :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.blob_auditing_policy_name = "default" + self.api_version = "2017-03-01-preview" + + self.config = config + + def get( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + """Gets an extended server's blob auditing policy. + + :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: ExtendedServerBlobAuditingPolicy or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.sql.models.ExtendedServerBlobAuditingPolicy 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'), + 'blobAuditingPolicyName': self._serialize.url("self.blob_auditing_policy_name", self.blob_auditing_policy_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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, 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('ExtendedServerBlobAuditingPolicy', 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}/extendedAuditingSettings/{blobAuditingPolicyName}'} + + + def _create_or_update_initial( + 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 = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'blobAuditingPolicyName': self._serialize.url("self.blob_auditing_policy_name", self.blob_auditing_policy_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['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, 'ExtendedServerBlobAuditingPolicy') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, 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('ExtendedServerBlobAuditingPolicy', 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, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates or updates an extended server's blob auditing policy. + + :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 parameters: Properties of extended blob auditing policy + :type parameters: + ~azure.mgmt.sql.models.ExtendedServerBlobAuditingPolicy + :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 + ExtendedServerBlobAuditingPolicy or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ExtendedServerBlobAuditingPolicy] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.sql.models.ExtendedServerBlobAuditingPolicy]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ExtendedServerBlobAuditingPolicy', 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}/extendedAuditingSettings/{blobAuditingPolicyName}'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/server_blob_auditing_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/server_blob_auditing_policies_operations.py new file mode 100644 index 000000000000..ae38710656f9 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/server_blob_auditing_policies_operations.py @@ -0,0 +1,211 @@ +# 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 ServerBlobAuditingPoliciesOperations(object): + """ServerBlobAuditingPoliciesOperations 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 blob_auditing_policy_name: The name of the blob auditing policy. Constant value: "default". + :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.blob_auditing_policy_name = "default" + self.api_version = "2017-03-01-preview" + + self.config = config + + def get( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + """Gets a server's blob auditing policy. + + :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: ServerBlobAuditingPolicy or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.ServerBlobAuditingPolicy 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'), + 'blobAuditingPolicyName': self._serialize.url("self.blob_auditing_policy_name", self.blob_auditing_policy_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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, 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('ServerBlobAuditingPolicy', 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}/auditingSettings/{blobAuditingPolicyName}'} + + + def _create_or_update_initial( + 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 = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'blobAuditingPolicyName': self._serialize.url("self.blob_auditing_policy_name", self.blob_auditing_policy_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['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, 'ServerBlobAuditingPolicy') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, 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('ServerBlobAuditingPolicy', 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, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates or updates a server's blob auditing policy. + + :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 parameters: Properties of blob auditing policy + :type parameters: ~azure.mgmt.sql.models.ServerBlobAuditingPolicy + :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 + ServerBlobAuditingPolicy or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ServerBlobAuditingPolicy] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.sql.models.ServerBlobAuditingPolicy]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ServerBlobAuditingPolicy', 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}/auditingSettings/{blobAuditingPolicyName}'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py index 9afb33b63ea4..404b7b7bc740 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py +++ b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py @@ -36,7 +36,6 @@ from .operations.transparent_data_encryption_activities_operations import TransparentDataEncryptionActivitiesOperations from .operations.server_usages_operations import ServerUsagesOperations from .operations.database_usages_operations import DatabaseUsagesOperations -from .operations.database_blob_auditing_policies_operations import DatabaseBlobAuditingPoliciesOperations from .operations.database_automatic_tuning_operations import DatabaseAutomaticTuningOperations from .operations.encryption_protectors_operations import EncryptionProtectorsOperations from .operations.failover_groups_operations import FailoverGroupsOperations @@ -48,6 +47,10 @@ from .operations.sync_members_operations import SyncMembersOperations from .operations.subscription_usages_operations import SubscriptionUsagesOperations from .operations.virtual_network_rules_operations import VirtualNetworkRulesOperations +from .operations.extended_database_blob_auditing_policies_operations import ExtendedDatabaseBlobAuditingPoliciesOperations +from .operations.extended_server_blob_auditing_policies_operations import ExtendedServerBlobAuditingPoliciesOperations +from .operations.server_blob_auditing_policies_operations import ServerBlobAuditingPoliciesOperations +from .operations.database_blob_auditing_policies_operations import DatabaseBlobAuditingPoliciesOperations from .operations.database_vulnerability_assessment_rule_baselines_operations import DatabaseVulnerabilityAssessmentRuleBaselinesOperations from .operations.database_vulnerability_assessments_operations import DatabaseVulnerabilityAssessmentsOperations from .operations.job_agents_operations import JobAgentsOperations @@ -160,8 +163,6 @@ class SqlManagementClient(SDKClient): :vartype server_usages: azure.mgmt.sql.operations.ServerUsagesOperations :ivar database_usages: DatabaseUsages operations :vartype database_usages: azure.mgmt.sql.operations.DatabaseUsagesOperations - :ivar database_blob_auditing_policies: DatabaseBlobAuditingPolicies operations - :vartype database_blob_auditing_policies: azure.mgmt.sql.operations.DatabaseBlobAuditingPoliciesOperations :ivar database_automatic_tuning: DatabaseAutomaticTuning operations :vartype database_automatic_tuning: azure.mgmt.sql.operations.DatabaseAutomaticTuningOperations :ivar encryption_protectors: EncryptionProtectors operations @@ -184,6 +185,14 @@ class SqlManagementClient(SDKClient): :vartype subscription_usages: azure.mgmt.sql.operations.SubscriptionUsagesOperations :ivar virtual_network_rules: VirtualNetworkRules operations :vartype virtual_network_rules: azure.mgmt.sql.operations.VirtualNetworkRulesOperations + :ivar extended_database_blob_auditing_policies: ExtendedDatabaseBlobAuditingPolicies operations + :vartype extended_database_blob_auditing_policies: azure.mgmt.sql.operations.ExtendedDatabaseBlobAuditingPoliciesOperations + :ivar extended_server_blob_auditing_policies: ExtendedServerBlobAuditingPolicies operations + :vartype extended_server_blob_auditing_policies: azure.mgmt.sql.operations.ExtendedServerBlobAuditingPoliciesOperations + :ivar server_blob_auditing_policies: ServerBlobAuditingPolicies operations + :vartype server_blob_auditing_policies: azure.mgmt.sql.operations.ServerBlobAuditingPoliciesOperations + :ivar database_blob_auditing_policies: DatabaseBlobAuditingPolicies operations + :vartype database_blob_auditing_policies: azure.mgmt.sql.operations.DatabaseBlobAuditingPoliciesOperations :ivar database_vulnerability_assessment_rule_baselines: DatabaseVulnerabilityAssessmentRuleBaselines operations :vartype database_vulnerability_assessment_rule_baselines: azure.mgmt.sql.operations.DatabaseVulnerabilityAssessmentRuleBaselinesOperations :ivar database_vulnerability_assessments: DatabaseVulnerabilityAssessments operations @@ -298,8 +307,6 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.database_usages = DatabaseUsagesOperations( self._client, self.config, self._serialize, self._deserialize) - self.database_blob_auditing_policies = DatabaseBlobAuditingPoliciesOperations( - self._client, self.config, self._serialize, self._deserialize) self.database_automatic_tuning = DatabaseAutomaticTuningOperations( self._client, self.config, self._serialize, self._deserialize) self.encryption_protectors = EncryptionProtectorsOperations( @@ -322,6 +329,14 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.virtual_network_rules = VirtualNetworkRulesOperations( self._client, self.config, self._serialize, self._deserialize) + self.extended_database_blob_auditing_policies = ExtendedDatabaseBlobAuditingPoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.extended_server_blob_auditing_policies = ExtendedServerBlobAuditingPoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.server_blob_auditing_policies = ServerBlobAuditingPoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.database_blob_auditing_policies = DatabaseBlobAuditingPoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) self.database_vulnerability_assessment_rule_baselines = DatabaseVulnerabilityAssessmentRuleBaselinesOperations( self._client, self.config, self._serialize, self._deserialize) self.database_vulnerability_assessments = DatabaseVulnerabilityAssessmentsOperations( From a393fa9f62027ea346b9fd6a57bbe34c763306ef Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 12 Jun 2018 17:16:33 -0700 Subject: [PATCH 04/19] [AutoPR sql/resource-manager] Fixed inconsistent definitions for SQL 2014 apis. (#2719) * Generated from 929fcc6c506c0ca401f39a48a3ea55a0a948f9e9 Fixed inconsistent definitions for SQL 2014 apis. * Generated from 929fcc6c506c0ca401f39a48a3ea55a0a948f9e9 Fixed inconsistent definitions for SQL 2014 apis. --- .../azure/mgmt/sql/models/__init__.py | 5 - .../models/server_security_alert_policy.py | 82 ------- .../server_security_alert_policy_py3.py | 82 ------- .../sql/models/sql_management_client_enums.py | 6 - .../azure/mgmt/sql/operations/__init__.py | 2 - ...rver_security_alert_policies_operations.py | 211 ------------------ .../azure/mgmt/sql/sql_management_client.py | 5 - 7 files changed, 393 deletions(-) delete mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy.py delete mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy_py3.py delete mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/server_security_alert_policies_operations.py diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py index bbb8651e588a..07ae995a4485 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py @@ -111,7 +111,6 @@ from .server_automatic_tuning_py3 import ServerAutomaticTuning from .server_dns_alias_py3 import ServerDnsAlias from .server_dns_alias_acquisition_py3 import ServerDnsAliasAcquisition - from .server_security_alert_policy_py3 import ServerSecurityAlertPolicy from .restore_point_py3 import RestorePoint from .create_database_restore_point_definition_py3 import CreateDatabaseRestorePointDefinition from .database_operation_py3 import DatabaseOperation @@ -250,7 +249,6 @@ from .server_automatic_tuning import ServerAutomaticTuning from .server_dns_alias import ServerDnsAlias from .server_dns_alias_acquisition import ServerDnsAliasAcquisition - from .server_security_alert_policy import ServerSecurityAlertPolicy from .restore_point import RestorePoint from .create_database_restore_point_definition import CreateDatabaseRestorePointDefinition from .database_operation import DatabaseOperation @@ -397,7 +395,6 @@ ManagedDatabaseCreateMode, AutomaticTuningServerMode, AutomaticTuningServerReason, - SecurityAlertState, RestorePointType, ManagementOperationState, MaxSizeUnit, @@ -521,7 +518,6 @@ 'ServerAutomaticTuning', 'ServerDnsAlias', 'ServerDnsAliasAcquisition', - 'ServerSecurityAlertPolicy', 'RestorePoint', 'CreateDatabaseRestorePointDefinition', 'DatabaseOperation', @@ -667,7 +663,6 @@ 'ManagedDatabaseCreateMode', 'AutomaticTuningServerMode', 'AutomaticTuningServerReason', - 'SecurityAlertState', 'RestorePointType', 'ManagementOperationState', 'MaxSizeUnit', diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy.py deleted file mode 100644 index 428a8edb608b..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy.py +++ /dev/null @@ -1,82 +0,0 @@ -# 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.sql.models.SecurityAlertState - :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': 'SecurityAlertState'}, - '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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy_py3.py deleted file mode 100644 index 62457fadcf25..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy_py3.py +++ /dev/null @@ -1,82 +0,0 @@ -# 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.sql.models.SecurityAlertState - :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': 'SecurityAlertState'}, - '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 diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py b/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py index a1ebb2af3196..90b01d122079 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py @@ -515,12 +515,6 @@ class AutomaticTuningServerReason(str, Enum): auto_configured = "AutoConfigured" -class SecurityAlertState(str, Enum): - - enabled = "Enabled" - disabled = "Disabled" - - class RestorePointType(str, Enum): continuous = "CONTINUOUS" diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py index 5512e9c68b84..d996acfe707b 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py @@ -63,7 +63,6 @@ from .managed_databases_operations import ManagedDatabasesOperations from .server_automatic_tuning_operations import ServerAutomaticTuningOperations from .server_dns_aliases_operations import ServerDnsAliasesOperations -from .server_security_alert_policies_operations import ServerSecurityAlertPoliciesOperations from .restore_points_operations import RestorePointsOperations from .database_operations import DatabaseOperations from .elastic_pool_operations import ElasticPoolOperations @@ -127,7 +126,6 @@ 'ManagedDatabasesOperations', 'ServerAutomaticTuningOperations', 'ServerDnsAliasesOperations', - 'ServerSecurityAlertPoliciesOperations', 'RestorePointsOperations', 'DatabaseOperations', 'ElasticPoolOperations', diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/server_security_alert_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/server_security_alert_policies_operations.py deleted file mode 100644 index ddbd335574b4..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/server_security_alert_policies_operations.py +++ /dev/null @@ -1,211 +0,0 @@ -# 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 ServerSecurityAlertPoliciesOperations(object): - """ServerSecurityAlertPoliciesOperations 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 security_alert_policy_name: The name of the security alert policy. Constant value: "Default". - :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.security_alert_policy_name = "Default" - self.api_version = "2017-03-01-preview" - - self.config = config - - def get( - self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): - """Get a server's security alert policy. - - :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: ServerSecurityAlertPolicy or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.sql.models.ServerSecurityAlertPolicy 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'), - 'securityAlertPolicyName': self._serialize.url("self.security_alert_policy_name", self.security_alert_policy_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['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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, 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('ServerSecurityAlertPolicy', 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}/securityAlertPolicies/{securityAlertPolicyName}'} - - - def _create_or_update_initial( - 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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serverName': self._serialize.url("server_name", server_name, 'str'), - 'securityAlertPolicyName': self._serialize.url("self.security_alert_policy_name", self.security_alert_policy_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['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, 'ServerSecurityAlertPolicy') - - # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, 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('ServerSecurityAlertPolicy', 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, 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 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 parameters: The server security alert policy. - :type parameters: ~azure.mgmt.sql.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 - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns - ServerSecurityAlertPolicy or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ServerSecurityAlertPolicy] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.sql.models.ServerSecurityAlertPolicy]] - :raises: :class:`CloudError` - """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - server_name=server_name, - parameters=parameters, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - deserialized = self._deserialize('ServerSecurityAlertPolicy', 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}/securityAlertPolicies/{securityAlertPolicyName}'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py index 404b7b7bc740..b2566c07fb89 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py +++ b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py @@ -67,7 +67,6 @@ from .operations.managed_databases_operations import ManagedDatabasesOperations from .operations.server_automatic_tuning_operations import ServerAutomaticTuningOperations from .operations.server_dns_aliases_operations import ServerDnsAliasesOperations -from .operations.server_security_alert_policies_operations import ServerSecurityAlertPoliciesOperations from .operations.restore_points_operations import RestorePointsOperations from .operations.database_operations import DatabaseOperations from .operations.elastic_pool_operations import ElasticPoolOperations @@ -225,8 +224,6 @@ class SqlManagementClient(SDKClient): :vartype server_automatic_tuning: azure.mgmt.sql.operations.ServerAutomaticTuningOperations :ivar server_dns_aliases: ServerDnsAliases operations :vartype server_dns_aliases: azure.mgmt.sql.operations.ServerDnsAliasesOperations - :ivar server_security_alert_policies: ServerSecurityAlertPolicies operations - :vartype server_security_alert_policies: azure.mgmt.sql.operations.ServerSecurityAlertPoliciesOperations :ivar restore_points: RestorePoints operations :vartype restore_points: azure.mgmt.sql.operations.RestorePointsOperations :ivar database_operations: DatabaseOperations operations @@ -369,8 +366,6 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.server_dns_aliases = ServerDnsAliasesOperations( self._client, self.config, self._serialize, self._deserialize) - self.server_security_alert_policies = ServerSecurityAlertPoliciesOperations( - self._client, self.config, self._serialize, self._deserialize) self.restore_points = RestorePointsOperations( self._client, self.config, self._serialize, self._deserialize) self.database_operations = DatabaseOperations( From 0f759c690b734ed0c969d9a8b07ef76f7828a3d6 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 14 Jun 2018 11:21:58 -0700 Subject: [PATCH 05/19] Generated from a82909eab07e7a383975701b09d09a5fd0dfb967 (#2751) adding new state value to keep backward competiblity adding new state value to keep backward competiblity --- .../azure/mgmt/sql/models/__init__.py | 3 + .../models/server_security_alert_policy.py | 82 +++++++ .../server_security_alert_policy_py3.py | 82 +++++++ .../azure/mgmt/sql/operations/__init__.py | 2 + ...rver_security_alert_policies_operations.py | 211 ++++++++++++++++++ .../azure/mgmt/sql/sql_management_client.py | 5 + 6 files changed, 385 insertions(+) create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy_py3.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/server_security_alert_policies_operations.py diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py index 07ae995a4485..216997863581 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py @@ -111,6 +111,7 @@ from .server_automatic_tuning_py3 import ServerAutomaticTuning from .server_dns_alias_py3 import ServerDnsAlias from .server_dns_alias_acquisition_py3 import ServerDnsAliasAcquisition + from .server_security_alert_policy_py3 import ServerSecurityAlertPolicy from .restore_point_py3 import RestorePoint from .create_database_restore_point_definition_py3 import CreateDatabaseRestorePointDefinition from .database_operation_py3 import DatabaseOperation @@ -249,6 +250,7 @@ from .server_automatic_tuning import ServerAutomaticTuning from .server_dns_alias import ServerDnsAlias from .server_dns_alias_acquisition import ServerDnsAliasAcquisition + from .server_security_alert_policy import ServerSecurityAlertPolicy from .restore_point import RestorePoint from .create_database_restore_point_definition import CreateDatabaseRestorePointDefinition from .database_operation import DatabaseOperation @@ -518,6 +520,7 @@ 'ServerAutomaticTuning', 'ServerDnsAlias', 'ServerDnsAliasAcquisition', + 'ServerSecurityAlertPolicy', 'RestorePoint', 'CreateDatabaseRestorePointDefinition', 'DatabaseOperation', diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy.py new file mode 100644 index 000000000000..4e5d69dbcd27 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy.py @@ -0,0 +1,82 @@ +# 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: 'New', 'Enabled', 'Disabled' + :type state: str or ~azure.mgmt.sql.models.SecurityAlertPolicyState + :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': 'SecurityAlertPolicyState'}, + '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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy_py3.py new file mode 100644 index 000000000000..2a65b5d19078 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy_py3.py @@ -0,0 +1,82 @@ +# 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: 'New', 'Enabled', 'Disabled' + :type state: str or ~azure.mgmt.sql.models.SecurityAlertPolicyState + :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': 'SecurityAlertPolicyState'}, + '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 diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py index d996acfe707b..5512e9c68b84 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py @@ -63,6 +63,7 @@ from .managed_databases_operations import ManagedDatabasesOperations from .server_automatic_tuning_operations import ServerAutomaticTuningOperations from .server_dns_aliases_operations import ServerDnsAliasesOperations +from .server_security_alert_policies_operations import ServerSecurityAlertPoliciesOperations from .restore_points_operations import RestorePointsOperations from .database_operations import DatabaseOperations from .elastic_pool_operations import ElasticPoolOperations @@ -126,6 +127,7 @@ 'ManagedDatabasesOperations', 'ServerAutomaticTuningOperations', 'ServerDnsAliasesOperations', + 'ServerSecurityAlertPoliciesOperations', 'RestorePointsOperations', 'DatabaseOperations', 'ElasticPoolOperations', diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/server_security_alert_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/server_security_alert_policies_operations.py new file mode 100644 index 000000000000..ddbd335574b4 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/server_security_alert_policies_operations.py @@ -0,0 +1,211 @@ +# 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 ServerSecurityAlertPoliciesOperations(object): + """ServerSecurityAlertPoliciesOperations 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 security_alert_policy_name: The name of the security alert policy. Constant value: "Default". + :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.security_alert_policy_name = "Default" + self.api_version = "2017-03-01-preview" + + self.config = config + + def get( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + """Get a server's security alert policy. + + :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: ServerSecurityAlertPolicy or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.ServerSecurityAlertPolicy 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'), + 'securityAlertPolicyName': self._serialize.url("self.security_alert_policy_name", self.security_alert_policy_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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, 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('ServerSecurityAlertPolicy', 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}/securityAlertPolicies/{securityAlertPolicyName}'} + + + def _create_or_update_initial( + 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 = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'securityAlertPolicyName': self._serialize.url("self.security_alert_policy_name", self.security_alert_policy_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['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, 'ServerSecurityAlertPolicy') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, 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('ServerSecurityAlertPolicy', 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, 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 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 parameters: The server security alert policy. + :type parameters: ~azure.mgmt.sql.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 + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + ServerSecurityAlertPolicy or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ServerSecurityAlertPolicy] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.sql.models.ServerSecurityAlertPolicy]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ServerSecurityAlertPolicy', 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}/securityAlertPolicies/{securityAlertPolicyName}'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py index b2566c07fb89..404b7b7bc740 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py +++ b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py @@ -67,6 +67,7 @@ from .operations.managed_databases_operations import ManagedDatabasesOperations from .operations.server_automatic_tuning_operations import ServerAutomaticTuningOperations from .operations.server_dns_aliases_operations import ServerDnsAliasesOperations +from .operations.server_security_alert_policies_operations import ServerSecurityAlertPoliciesOperations from .operations.restore_points_operations import RestorePointsOperations from .operations.database_operations import DatabaseOperations from .operations.elastic_pool_operations import ElasticPoolOperations @@ -224,6 +225,8 @@ class SqlManagementClient(SDKClient): :vartype server_automatic_tuning: azure.mgmt.sql.operations.ServerAutomaticTuningOperations :ivar server_dns_aliases: ServerDnsAliases operations :vartype server_dns_aliases: azure.mgmt.sql.operations.ServerDnsAliasesOperations + :ivar server_security_alert_policies: ServerSecurityAlertPolicies operations + :vartype server_security_alert_policies: azure.mgmt.sql.operations.ServerSecurityAlertPoliciesOperations :ivar restore_points: RestorePoints operations :vartype restore_points: azure.mgmt.sql.operations.RestorePointsOperations :ivar database_operations: DatabaseOperations operations @@ -366,6 +369,8 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.server_dns_aliases = ServerDnsAliasesOperations( self._client, self.config, self._serialize, self._deserialize) + self.server_security_alert_policies = ServerSecurityAlertPoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) self.restore_points = RestorePointsOperations( self._client, self.config, self._serialize, self._deserialize) self.database_operations = DatabaseOperations( From 9e863b422e8a2bfd81a97d6cc5b742ab3883ebac Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 21 Jun 2018 08:55:32 -0700 Subject: [PATCH 06/19] [AutoPR sql/resource-manager] Adding Swagger for POST APIs used to upload a customer TDE certificates (#2759) * Generated from e3529a46fd8d20ae6db5a542fe9762a365879439 Adding Swagger for POST APIs used to upload a customer TDE certificate in CMS * Generated from 9f0ba3d29675d6160b4cd881c52991fef58e0927 Addressing Jared's comment on PR - Remove certificateName property - Remove Resource and ProxyResource manually - Edit TdeCertificate to reference "../../../common/v1/types.json#/definitions/ProxyResource" * Generated from 8a72b9ba5c2b5c8621cd628c62702a0bd4933259 Adding to all package-composite-v* and package-pure of appropriate version --- .../azure/mgmt/sql/models/__init__.py | 29 +-- ...ackup_short_term_retention_policy_paged.py | 27 --- .../models/database_blob_auditing_policy.py | 62 +---- .../database_blob_auditing_policy_py3.py | 62 +---- .../extended_database_blob_auditing_policy.py | 146 ------------ ...ended_database_blob_auditing_policy_py3.py | 146 ------------ .../extended_server_blob_auditing_policy.py | 146 ------------ ...xtended_server_blob_auditing_policy_py3.py | 146 ------------ .../sql/models/server_blob_auditing_policy.py | 141 ------------ .../models/server_blob_auditing_policy_py3.py | 141 ------------ .../models/server_security_alert_policy.py | 82 ------- .../server_security_alert_policy_py3.py | 82 ------- .../sql/models/sql_management_client_enums.py | 18 +- .../azure/mgmt/sql/models/tde_certificate.py | 54 +++++ .../mgmt/sql/models/tde_certificate_py3.py | 54 +++++ .../azure/mgmt/sql/operations/__init__.py | 16 +- ...hort_term_retention_policies_operations.py | 76 ------- ...abase_blob_auditing_policies_operations.py | 10 +- ...ty_assessment_rule_baselines_operations.py | 32 +-- ...abase_blob_auditing_policies_operations.py | 187 --------------- ...erver_blob_auditing_policies_operations.py | 213 ------------------ ...ed_instance_tde_certificates_operations.py | 134 +++++++++++ ...erver_blob_auditing_policies_operations.py | 211 ----------------- ...rver_security_alert_policies_operations.py | 211 ----------------- .../operations/tde_certificates_operations.py | 134 +++++++++++ .../azure/mgmt/sql/sql_management_client.py | 40 ++-- 26 files changed, 429 insertions(+), 2171 deletions(-) delete mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/backup_short_term_retention_policy_paged.py delete mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy.py delete mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy_py3.py delete mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy.py delete mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy_py3.py delete mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy.py delete mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy_py3.py delete mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy.py delete mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy_py3.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/tde_certificate.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/tde_certificate_py3.py delete mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/extended_database_blob_auditing_policies_operations.py delete mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/extended_server_blob_auditing_policies_operations.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/managed_instance_tde_certificates_operations.py delete mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/server_blob_auditing_policies_operations.py delete mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/server_security_alert_policies_operations.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/tde_certificates_operations.py diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py index 216997863581..a1dcb657e770 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py @@ -48,6 +48,7 @@ from .transparent_data_encryption_activity_py3 import TransparentDataEncryptionActivity from .server_usage_py3 import ServerUsage from .database_usage_py3 import DatabaseUsage + from .database_blob_auditing_policy_py3 import DatabaseBlobAuditingPolicy from .automatic_tuning_options_py3 import AutomaticTuningOptions from .database_automatic_tuning_py3 import DatabaseAutomaticTuning from .encryption_protector_py3 import EncryptionProtector @@ -80,10 +81,6 @@ from .sync_member_py3 import SyncMember from .subscription_usage_py3 import SubscriptionUsage from .virtual_network_rule_py3 import VirtualNetworkRule - from .extended_database_blob_auditing_policy_py3 import ExtendedDatabaseBlobAuditingPolicy - from .extended_server_blob_auditing_policy_py3 import ExtendedServerBlobAuditingPolicy - from .server_blob_auditing_policy_py3 import ServerBlobAuditingPolicy - from .database_blob_auditing_policy_py3 import DatabaseBlobAuditingPolicy from .database_vulnerability_assessment_rule_baseline_item_py3 import DatabaseVulnerabilityAssessmentRuleBaselineItem from .database_vulnerability_assessment_rule_baseline_py3 import DatabaseVulnerabilityAssessmentRuleBaseline from .vulnerability_assessment_recurring_scans_properties_py3 import VulnerabilityAssessmentRecurringScansProperties @@ -111,7 +108,6 @@ from .server_automatic_tuning_py3 import ServerAutomaticTuning from .server_dns_alias_py3 import ServerDnsAlias from .server_dns_alias_acquisition_py3 import ServerDnsAliasAcquisition - from .server_security_alert_policy_py3 import ServerSecurityAlertPolicy from .restore_point_py3 import RestorePoint from .create_database_restore_point_definition_py3 import CreateDatabaseRestorePointDefinition from .database_operation_py3 import DatabaseOperation @@ -148,6 +144,7 @@ from .managed_instance_pair_info_py3 import ManagedInstancePairInfo from .instance_failover_group_py3 import InstanceFailoverGroup from .backup_short_term_retention_policy_py3 import BackupShortTermRetentionPolicy + from .tde_certificate_py3 import TdeCertificate except (SyntaxError, ImportError): from .recoverable_database import RecoverableDatabase from .restorable_dropped_database import RestorableDroppedDatabase @@ -187,6 +184,7 @@ from .transparent_data_encryption_activity import TransparentDataEncryptionActivity from .server_usage import ServerUsage from .database_usage import DatabaseUsage + from .database_blob_auditing_policy import DatabaseBlobAuditingPolicy from .automatic_tuning_options import AutomaticTuningOptions from .database_automatic_tuning import DatabaseAutomaticTuning from .encryption_protector import EncryptionProtector @@ -219,10 +217,6 @@ from .sync_member import SyncMember from .subscription_usage import SubscriptionUsage from .virtual_network_rule import VirtualNetworkRule - from .extended_database_blob_auditing_policy import ExtendedDatabaseBlobAuditingPolicy - from .extended_server_blob_auditing_policy import ExtendedServerBlobAuditingPolicy - from .server_blob_auditing_policy import ServerBlobAuditingPolicy - from .database_blob_auditing_policy import DatabaseBlobAuditingPolicy from .database_vulnerability_assessment_rule_baseline_item import DatabaseVulnerabilityAssessmentRuleBaselineItem from .database_vulnerability_assessment_rule_baseline import DatabaseVulnerabilityAssessmentRuleBaseline from .vulnerability_assessment_recurring_scans_properties import VulnerabilityAssessmentRecurringScansProperties @@ -250,7 +244,6 @@ from .server_automatic_tuning import ServerAutomaticTuning from .server_dns_alias import ServerDnsAlias from .server_dns_alias_acquisition import ServerDnsAliasAcquisition - from .server_security_alert_policy import ServerSecurityAlertPolicy from .restore_point import RestorePoint from .create_database_restore_point_definition import CreateDatabaseRestorePointDefinition from .database_operation import DatabaseOperation @@ -287,6 +280,7 @@ from .managed_instance_pair_info import ManagedInstancePairInfo from .instance_failover_group import InstanceFailoverGroup from .backup_short_term_retention_policy import BackupShortTermRetentionPolicy + from .tde_certificate import TdeCertificate from .recoverable_database_paged import RecoverableDatabasePaged from .restorable_dropped_database_paged import RestorableDroppedDatabasePaged from .server_paged import ServerPaged @@ -338,7 +332,6 @@ from .elastic_pool_operation_paged import ElasticPoolOperationPaged from .vulnerability_assessment_scan_record_paged import VulnerabilityAssessmentScanRecordPaged from .instance_failover_group_paged import InstanceFailoverGroupPaged -from .backup_short_term_retention_policy_paged import BackupShortTermRetentionPolicyPaged from .sql_management_client_enums import ( CheckNameAvailabilityReason, ServerConnectionType, @@ -364,6 +357,7 @@ RecommendedIndexType, TransparentDataEncryptionStatus, TransparentDataEncryptionActivityStatus, + BlobAuditingPolicyState, AutomaticTuningMode, AutomaticTuningOptionModeDesired, AutomaticTuningOptionModeActual, @@ -382,7 +376,6 @@ SyncDirection, SyncMemberState, VirtualNetworkRuleState, - BlobAuditingPolicyState, JobAgentState, JobExecutionLifecycle, ProvisioningState, @@ -414,7 +407,6 @@ VulnerabilityAssessmentScanState, InstanceFailoverGroupReplicationRole, LongTermRetentionDatabaseState, - VulnerabilityAssessmentPolicyBaselineName, CapabilityGroup, ) @@ -457,6 +449,7 @@ 'TransparentDataEncryptionActivity', 'ServerUsage', 'DatabaseUsage', + 'DatabaseBlobAuditingPolicy', 'AutomaticTuningOptions', 'DatabaseAutomaticTuning', 'EncryptionProtector', @@ -489,10 +482,6 @@ 'SyncMember', 'SubscriptionUsage', 'VirtualNetworkRule', - 'ExtendedDatabaseBlobAuditingPolicy', - 'ExtendedServerBlobAuditingPolicy', - 'ServerBlobAuditingPolicy', - 'DatabaseBlobAuditingPolicy', 'DatabaseVulnerabilityAssessmentRuleBaselineItem', 'DatabaseVulnerabilityAssessmentRuleBaseline', 'VulnerabilityAssessmentRecurringScansProperties', @@ -520,7 +509,6 @@ 'ServerAutomaticTuning', 'ServerDnsAlias', 'ServerDnsAliasAcquisition', - 'ServerSecurityAlertPolicy', 'RestorePoint', 'CreateDatabaseRestorePointDefinition', 'DatabaseOperation', @@ -557,6 +545,7 @@ 'ManagedInstancePairInfo', 'InstanceFailoverGroup', 'BackupShortTermRetentionPolicy', + 'TdeCertificate', 'RecoverableDatabasePaged', 'RestorableDroppedDatabasePaged', 'ServerPaged', @@ -608,7 +597,6 @@ 'ElasticPoolOperationPaged', 'VulnerabilityAssessmentScanRecordPaged', 'InstanceFailoverGroupPaged', - 'BackupShortTermRetentionPolicyPaged', 'CheckNameAvailabilityReason', 'ServerConnectionType', 'SecurityAlertPolicyState', @@ -633,6 +621,7 @@ 'RecommendedIndexType', 'TransparentDataEncryptionStatus', 'TransparentDataEncryptionActivityStatus', + 'BlobAuditingPolicyState', 'AutomaticTuningMode', 'AutomaticTuningOptionModeDesired', 'AutomaticTuningOptionModeActual', @@ -651,7 +640,6 @@ 'SyncDirection', 'SyncMemberState', 'VirtualNetworkRuleState', - 'BlobAuditingPolicyState', 'JobAgentState', 'JobExecutionLifecycle', 'ProvisioningState', @@ -683,6 +671,5 @@ 'VulnerabilityAssessmentScanState', 'InstanceFailoverGroupReplicationRole', 'LongTermRetentionDatabaseState', - 'VulnerabilityAssessmentPolicyBaselineName', 'CapabilityGroup', ] diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/backup_short_term_retention_policy_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/backup_short_term_retention_policy_paged.py deleted file mode 100644 index 16d31e341795..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/models/backup_short_term_retention_policy_paged.py +++ /dev/null @@ -1,27 +0,0 @@ -# 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 BackupShortTermRetentionPolicyPaged(Paged): - """ - A paging container for iterating over a list of :class:`BackupShortTermRetentionPolicy ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[BackupShortTermRetentionPolicy]'} - } - - def __init__(self, *args, **kwargs): - - super(BackupShortTermRetentionPolicyPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy.py b/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy.py index 963b7674ac16..407713325e7d 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy.py @@ -43,72 +43,14 @@ class DatabaseBlobAuditingPolicy(ProxyResource): :param retention_days: Specifies the number of days to keep in the audit logs. :type retention_days: int - :param audit_actions_and_groups: Specifies the Actions-Groups and Actions + :param audit_actions_and_groups: Specifies the Actions and Actions-Groups to audit. - The recommended set of action groups to use is the following combination - - this will audit all the queries and stored procedures executed against the - database, as well as successful and failed logins: - BATCH_COMPLETED_GROUP, - SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, - FAILED_DATABASE_AUTHENTICATION_GROUP. - This above combination is also the set that is configured by default when - enabling auditing from the Azure portal. - The supported action groups to audit are (note: choose only specific - groups that cover your auditing needs. Using unnecessary groups could lead - to very large quantities of audit records): - APPLICATION_ROLE_CHANGE_PASSWORD_GROUP - BACKUP_RESTORE_GROUP - DATABASE_LOGOUT_GROUP - DATABASE_OBJECT_CHANGE_GROUP - DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP - DATABASE_OBJECT_PERMISSION_CHANGE_GROUP - DATABASE_OPERATION_GROUP - DATABASE_PERMISSION_CHANGE_GROUP - DATABASE_PRINCIPAL_CHANGE_GROUP - DATABASE_PRINCIPAL_IMPERSONATION_GROUP - DATABASE_ROLE_MEMBER_CHANGE_GROUP - FAILED_DATABASE_AUTHENTICATION_GROUP - SCHEMA_OBJECT_ACCESS_GROUP - SCHEMA_OBJECT_CHANGE_GROUP - SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP - SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP - SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP - USER_CHANGE_PASSWORD_GROUP - BATCH_STARTED_GROUP - BATCH_COMPLETED_GROUP - These are groups that cover all sql statements and stored procedures - executed against the database, and should not be used in combination with - other groups as this will result in duplicate audit logs. - For more information, see [Database-Level Audit Action - Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). - For Database auditing policy, specific Actions can also be specified (note - that Actions cannot be specified for Server auditing policy). The - supported actions to audit are: - SELECT - UPDATE - INSERT - DELETE - EXECUTE - RECEIVE - REFERENCES - The general form for defining an action to be audited is: - ON BY - Note that in the above format can refer to an object like a - table, view, or stored procedure, or an entire database or schema. For the - latter cases, the forms DATABASE:: and SCHEMA:: are - used, respectively. - For example: - SELECT on dbo.myTable by public - SELECT on DATABASE::myDatabase by public - SELECT on SCHEMA::mySchema by public - For more information, see [Database-Level Audit - Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) :type audit_actions_and_groups: list[str] :param storage_account_subscription_id: Specifies the blob storage subscription Id. :type storage_account_subscription_id: str :param is_storage_secondary_key_in_use: Specifies whether - storageAccountAccessKey value is the storage's secondary key. + storageAccountAccessKey value is the storage’s secondary key. :type is_storage_secondary_key_in_use: bool """ diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy_py3.py index 1c58ec560a03..bfc95370f0fc 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy_py3.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy_py3.py @@ -43,72 +43,14 @@ class DatabaseBlobAuditingPolicy(ProxyResource): :param retention_days: Specifies the number of days to keep in the audit logs. :type retention_days: int - :param audit_actions_and_groups: Specifies the Actions-Groups and Actions + :param audit_actions_and_groups: Specifies the Actions and Actions-Groups to audit. - The recommended set of action groups to use is the following combination - - this will audit all the queries and stored procedures executed against the - database, as well as successful and failed logins: - BATCH_COMPLETED_GROUP, - SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, - FAILED_DATABASE_AUTHENTICATION_GROUP. - This above combination is also the set that is configured by default when - enabling auditing from the Azure portal. - The supported action groups to audit are (note: choose only specific - groups that cover your auditing needs. Using unnecessary groups could lead - to very large quantities of audit records): - APPLICATION_ROLE_CHANGE_PASSWORD_GROUP - BACKUP_RESTORE_GROUP - DATABASE_LOGOUT_GROUP - DATABASE_OBJECT_CHANGE_GROUP - DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP - DATABASE_OBJECT_PERMISSION_CHANGE_GROUP - DATABASE_OPERATION_GROUP - DATABASE_PERMISSION_CHANGE_GROUP - DATABASE_PRINCIPAL_CHANGE_GROUP - DATABASE_PRINCIPAL_IMPERSONATION_GROUP - DATABASE_ROLE_MEMBER_CHANGE_GROUP - FAILED_DATABASE_AUTHENTICATION_GROUP - SCHEMA_OBJECT_ACCESS_GROUP - SCHEMA_OBJECT_CHANGE_GROUP - SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP - SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP - SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP - USER_CHANGE_PASSWORD_GROUP - BATCH_STARTED_GROUP - BATCH_COMPLETED_GROUP - These are groups that cover all sql statements and stored procedures - executed against the database, and should not be used in combination with - other groups as this will result in duplicate audit logs. - For more information, see [Database-Level Audit Action - Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). - For Database auditing policy, specific Actions can also be specified (note - that Actions cannot be specified for Server auditing policy). The - supported actions to audit are: - SELECT - UPDATE - INSERT - DELETE - EXECUTE - RECEIVE - REFERENCES - The general form for defining an action to be audited is: - ON BY - Note that in the above format can refer to an object like a - table, view, or stored procedure, or an entire database or schema. For the - latter cases, the forms DATABASE:: and SCHEMA:: are - used, respectively. - For example: - SELECT on dbo.myTable by public - SELECT on DATABASE::myDatabase by public - SELECT on SCHEMA::mySchema by public - For more information, see [Database-Level Audit - Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) :type audit_actions_and_groups: list[str] :param storage_account_subscription_id: Specifies the blob storage subscription Id. :type storage_account_subscription_id: str :param is_storage_secondary_key_in_use: Specifies whether - storageAccountAccessKey value is the storage's secondary key. + storageAccountAccessKey value is the storage’s secondary key. :type is_storage_secondary_key_in_use: bool """ diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy.py b/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy.py deleted file mode 100644 index cdfb75e47f2a..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy.py +++ /dev/null @@ -1,146 +0,0 @@ -# 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 ExtendedDatabaseBlobAuditingPolicy(ProxyResource): - """An extended database blob auditing 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 predicate_expression: Specifies condition of where clause when - creating an audit. - :type predicate_expression: str - :param state: Required. Specifies the state of the policy. If state is - Enabled, storageEndpoint and storageAccountAccessKey are required. - Possible values include: 'Enabled', 'Disabled' - :type state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState - :param storage_endpoint: Specifies the blob storage endpoint (e.g. - https://MyAccount.blob.core.windows.net). If state is Enabled, - storageEndpoint is required. - :type storage_endpoint: str - :param storage_account_access_key: Specifies the identifier key of the - auditing storage account. If state is Enabled, storageAccountAccessKey is - required. - :type storage_account_access_key: str - :param retention_days: Specifies the number of days to keep in the audit - logs. - :type retention_days: int - :param audit_actions_and_groups: Specifies the Actions-Groups and Actions - to audit. - The recommended set of action groups to use is the following combination - - this will audit all the queries and stored procedures executed against the - database, as well as successful and failed logins: - BATCH_COMPLETED_GROUP, - SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, - FAILED_DATABASE_AUTHENTICATION_GROUP. - This above combination is also the set that is configured by default when - enabling auditing from the Azure portal. - The supported action groups to audit are (note: choose only specific - groups that cover your auditing needs. Using unnecessary groups could lead - to very large quantities of audit records): - APPLICATION_ROLE_CHANGE_PASSWORD_GROUP - BACKUP_RESTORE_GROUP - DATABASE_LOGOUT_GROUP - DATABASE_OBJECT_CHANGE_GROUP - DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP - DATABASE_OBJECT_PERMISSION_CHANGE_GROUP - DATABASE_OPERATION_GROUP - DATABASE_PERMISSION_CHANGE_GROUP - DATABASE_PRINCIPAL_CHANGE_GROUP - DATABASE_PRINCIPAL_IMPERSONATION_GROUP - DATABASE_ROLE_MEMBER_CHANGE_GROUP - FAILED_DATABASE_AUTHENTICATION_GROUP - SCHEMA_OBJECT_ACCESS_GROUP - SCHEMA_OBJECT_CHANGE_GROUP - SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP - SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP - SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP - USER_CHANGE_PASSWORD_GROUP - BATCH_STARTED_GROUP - BATCH_COMPLETED_GROUP - These are groups that cover all sql statements and stored procedures - executed against the database, and should not be used in combination with - other groups as this will result in duplicate audit logs. - For more information, see [Database-Level Audit Action - Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). - For Database auditing policy, specific Actions can also be specified (note - that Actions cannot be specified for Server auditing policy). The - supported actions to audit are: - SELECT - UPDATE - INSERT - DELETE - EXECUTE - RECEIVE - REFERENCES - The general form for defining an action to be audited is: - ON BY - Note that in the above format can refer to an object like a - table, view, or stored procedure, or an entire database or schema. For the - latter cases, the forms DATABASE:: and SCHEMA:: are - used, respectively. - For example: - SELECT on dbo.myTable by public - SELECT on DATABASE::myDatabase by public - SELECT on SCHEMA::mySchema by public - For more information, see [Database-Level Audit - Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) - :type audit_actions_and_groups: list[str] - :param storage_account_subscription_id: Specifies the blob storage - subscription Id. - :type storage_account_subscription_id: str - :param is_storage_secondary_key_in_use: Specifies whether - storageAccountAccessKey value is the storage's secondary key. - :type is_storage_secondary_key_in_use: bool - """ - - _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'}, - 'predicate_expression': {'key': 'properties.predicateExpression', 'type': 'str'}, - 'state': {'key': 'properties.state', 'type': 'BlobAuditingPolicyState'}, - 'storage_endpoint': {'key': 'properties.storageEndpoint', 'type': 'str'}, - 'storage_account_access_key': {'key': 'properties.storageAccountAccessKey', 'type': 'str'}, - 'retention_days': {'key': 'properties.retentionDays', 'type': 'int'}, - 'audit_actions_and_groups': {'key': 'properties.auditActionsAndGroups', 'type': '[str]'}, - 'storage_account_subscription_id': {'key': 'properties.storageAccountSubscriptionId', 'type': 'str'}, - 'is_storage_secondary_key_in_use': {'key': 'properties.isStorageSecondaryKeyInUse', 'type': 'bool'}, - } - - def __init__(self, **kwargs): - super(ExtendedDatabaseBlobAuditingPolicy, self).__init__(**kwargs) - self.predicate_expression = kwargs.get('predicate_expression', None) - self.state = kwargs.get('state', 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.audit_actions_and_groups = kwargs.get('audit_actions_and_groups', None) - self.storage_account_subscription_id = kwargs.get('storage_account_subscription_id', None) - self.is_storage_secondary_key_in_use = kwargs.get('is_storage_secondary_key_in_use', None) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy_py3.py deleted file mode 100644 index ee5ce27523e1..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy_py3.py +++ /dev/null @@ -1,146 +0,0 @@ -# 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 ExtendedDatabaseBlobAuditingPolicy(ProxyResource): - """An extended database blob auditing 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 predicate_expression: Specifies condition of where clause when - creating an audit. - :type predicate_expression: str - :param state: Required. Specifies the state of the policy. If state is - Enabled, storageEndpoint and storageAccountAccessKey are required. - Possible values include: 'Enabled', 'Disabled' - :type state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState - :param storage_endpoint: Specifies the blob storage endpoint (e.g. - https://MyAccount.blob.core.windows.net). If state is Enabled, - storageEndpoint is required. - :type storage_endpoint: str - :param storage_account_access_key: Specifies the identifier key of the - auditing storage account. If state is Enabled, storageAccountAccessKey is - required. - :type storage_account_access_key: str - :param retention_days: Specifies the number of days to keep in the audit - logs. - :type retention_days: int - :param audit_actions_and_groups: Specifies the Actions-Groups and Actions - to audit. - The recommended set of action groups to use is the following combination - - this will audit all the queries and stored procedures executed against the - database, as well as successful and failed logins: - BATCH_COMPLETED_GROUP, - SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, - FAILED_DATABASE_AUTHENTICATION_GROUP. - This above combination is also the set that is configured by default when - enabling auditing from the Azure portal. - The supported action groups to audit are (note: choose only specific - groups that cover your auditing needs. Using unnecessary groups could lead - to very large quantities of audit records): - APPLICATION_ROLE_CHANGE_PASSWORD_GROUP - BACKUP_RESTORE_GROUP - DATABASE_LOGOUT_GROUP - DATABASE_OBJECT_CHANGE_GROUP - DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP - DATABASE_OBJECT_PERMISSION_CHANGE_GROUP - DATABASE_OPERATION_GROUP - DATABASE_PERMISSION_CHANGE_GROUP - DATABASE_PRINCIPAL_CHANGE_GROUP - DATABASE_PRINCIPAL_IMPERSONATION_GROUP - DATABASE_ROLE_MEMBER_CHANGE_GROUP - FAILED_DATABASE_AUTHENTICATION_GROUP - SCHEMA_OBJECT_ACCESS_GROUP - SCHEMA_OBJECT_CHANGE_GROUP - SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP - SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP - SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP - USER_CHANGE_PASSWORD_GROUP - BATCH_STARTED_GROUP - BATCH_COMPLETED_GROUP - These are groups that cover all sql statements and stored procedures - executed against the database, and should not be used in combination with - other groups as this will result in duplicate audit logs. - For more information, see [Database-Level Audit Action - Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). - For Database auditing policy, specific Actions can also be specified (note - that Actions cannot be specified for Server auditing policy). The - supported actions to audit are: - SELECT - UPDATE - INSERT - DELETE - EXECUTE - RECEIVE - REFERENCES - The general form for defining an action to be audited is: - ON BY - Note that in the above format can refer to an object like a - table, view, or stored procedure, or an entire database or schema. For the - latter cases, the forms DATABASE:: and SCHEMA:: are - used, respectively. - For example: - SELECT on dbo.myTable by public - SELECT on DATABASE::myDatabase by public - SELECT on SCHEMA::mySchema by public - For more information, see [Database-Level Audit - Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) - :type audit_actions_and_groups: list[str] - :param storage_account_subscription_id: Specifies the blob storage - subscription Id. - :type storage_account_subscription_id: str - :param is_storage_secondary_key_in_use: Specifies whether - storageAccountAccessKey value is the storage's secondary key. - :type is_storage_secondary_key_in_use: bool - """ - - _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'}, - 'predicate_expression': {'key': 'properties.predicateExpression', 'type': 'str'}, - 'state': {'key': 'properties.state', 'type': 'BlobAuditingPolicyState'}, - 'storage_endpoint': {'key': 'properties.storageEndpoint', 'type': 'str'}, - 'storage_account_access_key': {'key': 'properties.storageAccountAccessKey', 'type': 'str'}, - 'retention_days': {'key': 'properties.retentionDays', 'type': 'int'}, - 'audit_actions_and_groups': {'key': 'properties.auditActionsAndGroups', 'type': '[str]'}, - 'storage_account_subscription_id': {'key': 'properties.storageAccountSubscriptionId', 'type': 'str'}, - 'is_storage_secondary_key_in_use': {'key': 'properties.isStorageSecondaryKeyInUse', 'type': 'bool'}, - } - - def __init__(self, *, state, predicate_expression: str=None, storage_endpoint: str=None, storage_account_access_key: str=None, retention_days: int=None, audit_actions_and_groups=None, storage_account_subscription_id: str=None, is_storage_secondary_key_in_use: bool=None, **kwargs) -> None: - super(ExtendedDatabaseBlobAuditingPolicy, self).__init__(**kwargs) - self.predicate_expression = predicate_expression - self.state = state - self.storage_endpoint = storage_endpoint - self.storage_account_access_key = storage_account_access_key - self.retention_days = retention_days - self.audit_actions_and_groups = audit_actions_and_groups - self.storage_account_subscription_id = storage_account_subscription_id - self.is_storage_secondary_key_in_use = is_storage_secondary_key_in_use diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy.py b/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy.py deleted file mode 100644 index a11e18ac68b1..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy.py +++ /dev/null @@ -1,146 +0,0 @@ -# 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 ExtendedServerBlobAuditingPolicy(ProxyResource): - """An extended server blob auditing 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 predicate_expression: Specifies condition of where clause when - creating an audit. - :type predicate_expression: str - :param state: Required. Specifies the state of the policy. If state is - Enabled, storageEndpoint and storageAccountAccessKey are required. - Possible values include: 'Enabled', 'Disabled' - :type state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState - :param storage_endpoint: Specifies the blob storage endpoint (e.g. - https://MyAccount.blob.core.windows.net). If state is Enabled, - storageEndpoint is required. - :type storage_endpoint: str - :param storage_account_access_key: Specifies the identifier key of the - auditing storage account. If state is Enabled, storageAccountAccessKey is - required. - :type storage_account_access_key: str - :param retention_days: Specifies the number of days to keep in the audit - logs. - :type retention_days: int - :param audit_actions_and_groups: Specifies the Actions-Groups and Actions - to audit. - The recommended set of action groups to use is the following combination - - this will audit all the queries and stored procedures executed against the - database, as well as successful and failed logins: - BATCH_COMPLETED_GROUP, - SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, - FAILED_DATABASE_AUTHENTICATION_GROUP. - This above combination is also the set that is configured by default when - enabling auditing from the Azure portal. - The supported action groups to audit are (note: choose only specific - groups that cover your auditing needs. Using unnecessary groups could lead - to very large quantities of audit records): - APPLICATION_ROLE_CHANGE_PASSWORD_GROUP - BACKUP_RESTORE_GROUP - DATABASE_LOGOUT_GROUP - DATABASE_OBJECT_CHANGE_GROUP - DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP - DATABASE_OBJECT_PERMISSION_CHANGE_GROUP - DATABASE_OPERATION_GROUP - DATABASE_PERMISSION_CHANGE_GROUP - DATABASE_PRINCIPAL_CHANGE_GROUP - DATABASE_PRINCIPAL_IMPERSONATION_GROUP - DATABASE_ROLE_MEMBER_CHANGE_GROUP - FAILED_DATABASE_AUTHENTICATION_GROUP - SCHEMA_OBJECT_ACCESS_GROUP - SCHEMA_OBJECT_CHANGE_GROUP - SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP - SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP - SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP - USER_CHANGE_PASSWORD_GROUP - BATCH_STARTED_GROUP - BATCH_COMPLETED_GROUP - These are groups that cover all sql statements and stored procedures - executed against the database, and should not be used in combination with - other groups as this will result in duplicate audit logs. - For more information, see [Database-Level Audit Action - Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). - For Database auditing policy, specific Actions can also be specified (note - that Actions cannot be specified for Server auditing policy). The - supported actions to audit are: - SELECT - UPDATE - INSERT - DELETE - EXECUTE - RECEIVE - REFERENCES - The general form for defining an action to be audited is: - ON BY - Note that in the above format can refer to an object like a - table, view, or stored procedure, or an entire database or schema. For the - latter cases, the forms DATABASE:: and SCHEMA:: are - used, respectively. - For example: - SELECT on dbo.myTable by public - SELECT on DATABASE::myDatabase by public - SELECT on SCHEMA::mySchema by public - For more information, see [Database-Level Audit - Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) - :type audit_actions_and_groups: list[str] - :param storage_account_subscription_id: Specifies the blob storage - subscription Id. - :type storage_account_subscription_id: str - :param is_storage_secondary_key_in_use: Specifies whether - storageAccountAccessKey value is the storage's secondary key. - :type is_storage_secondary_key_in_use: bool - """ - - _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'}, - 'predicate_expression': {'key': 'properties.predicateExpression', 'type': 'str'}, - 'state': {'key': 'properties.state', 'type': 'BlobAuditingPolicyState'}, - 'storage_endpoint': {'key': 'properties.storageEndpoint', 'type': 'str'}, - 'storage_account_access_key': {'key': 'properties.storageAccountAccessKey', 'type': 'str'}, - 'retention_days': {'key': 'properties.retentionDays', 'type': 'int'}, - 'audit_actions_and_groups': {'key': 'properties.auditActionsAndGroups', 'type': '[str]'}, - 'storage_account_subscription_id': {'key': 'properties.storageAccountSubscriptionId', 'type': 'str'}, - 'is_storage_secondary_key_in_use': {'key': 'properties.isStorageSecondaryKeyInUse', 'type': 'bool'}, - } - - def __init__(self, **kwargs): - super(ExtendedServerBlobAuditingPolicy, self).__init__(**kwargs) - self.predicate_expression = kwargs.get('predicate_expression', None) - self.state = kwargs.get('state', 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.audit_actions_and_groups = kwargs.get('audit_actions_and_groups', None) - self.storage_account_subscription_id = kwargs.get('storage_account_subscription_id', None) - self.is_storage_secondary_key_in_use = kwargs.get('is_storage_secondary_key_in_use', None) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy_py3.py deleted file mode 100644 index ac522801a8dd..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy_py3.py +++ /dev/null @@ -1,146 +0,0 @@ -# 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 ExtendedServerBlobAuditingPolicy(ProxyResource): - """An extended server blob auditing 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 predicate_expression: Specifies condition of where clause when - creating an audit. - :type predicate_expression: str - :param state: Required. Specifies the state of the policy. If state is - Enabled, storageEndpoint and storageAccountAccessKey are required. - Possible values include: 'Enabled', 'Disabled' - :type state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState - :param storage_endpoint: Specifies the blob storage endpoint (e.g. - https://MyAccount.blob.core.windows.net). If state is Enabled, - storageEndpoint is required. - :type storage_endpoint: str - :param storage_account_access_key: Specifies the identifier key of the - auditing storage account. If state is Enabled, storageAccountAccessKey is - required. - :type storage_account_access_key: str - :param retention_days: Specifies the number of days to keep in the audit - logs. - :type retention_days: int - :param audit_actions_and_groups: Specifies the Actions-Groups and Actions - to audit. - The recommended set of action groups to use is the following combination - - this will audit all the queries and stored procedures executed against the - database, as well as successful and failed logins: - BATCH_COMPLETED_GROUP, - SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, - FAILED_DATABASE_AUTHENTICATION_GROUP. - This above combination is also the set that is configured by default when - enabling auditing from the Azure portal. - The supported action groups to audit are (note: choose only specific - groups that cover your auditing needs. Using unnecessary groups could lead - to very large quantities of audit records): - APPLICATION_ROLE_CHANGE_PASSWORD_GROUP - BACKUP_RESTORE_GROUP - DATABASE_LOGOUT_GROUP - DATABASE_OBJECT_CHANGE_GROUP - DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP - DATABASE_OBJECT_PERMISSION_CHANGE_GROUP - DATABASE_OPERATION_GROUP - DATABASE_PERMISSION_CHANGE_GROUP - DATABASE_PRINCIPAL_CHANGE_GROUP - DATABASE_PRINCIPAL_IMPERSONATION_GROUP - DATABASE_ROLE_MEMBER_CHANGE_GROUP - FAILED_DATABASE_AUTHENTICATION_GROUP - SCHEMA_OBJECT_ACCESS_GROUP - SCHEMA_OBJECT_CHANGE_GROUP - SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP - SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP - SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP - USER_CHANGE_PASSWORD_GROUP - BATCH_STARTED_GROUP - BATCH_COMPLETED_GROUP - These are groups that cover all sql statements and stored procedures - executed against the database, and should not be used in combination with - other groups as this will result in duplicate audit logs. - For more information, see [Database-Level Audit Action - Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). - For Database auditing policy, specific Actions can also be specified (note - that Actions cannot be specified for Server auditing policy). The - supported actions to audit are: - SELECT - UPDATE - INSERT - DELETE - EXECUTE - RECEIVE - REFERENCES - The general form for defining an action to be audited is: - ON BY - Note that in the above format can refer to an object like a - table, view, or stored procedure, or an entire database or schema. For the - latter cases, the forms DATABASE:: and SCHEMA:: are - used, respectively. - For example: - SELECT on dbo.myTable by public - SELECT on DATABASE::myDatabase by public - SELECT on SCHEMA::mySchema by public - For more information, see [Database-Level Audit - Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) - :type audit_actions_and_groups: list[str] - :param storage_account_subscription_id: Specifies the blob storage - subscription Id. - :type storage_account_subscription_id: str - :param is_storage_secondary_key_in_use: Specifies whether - storageAccountAccessKey value is the storage's secondary key. - :type is_storage_secondary_key_in_use: bool - """ - - _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'}, - 'predicate_expression': {'key': 'properties.predicateExpression', 'type': 'str'}, - 'state': {'key': 'properties.state', 'type': 'BlobAuditingPolicyState'}, - 'storage_endpoint': {'key': 'properties.storageEndpoint', 'type': 'str'}, - 'storage_account_access_key': {'key': 'properties.storageAccountAccessKey', 'type': 'str'}, - 'retention_days': {'key': 'properties.retentionDays', 'type': 'int'}, - 'audit_actions_and_groups': {'key': 'properties.auditActionsAndGroups', 'type': '[str]'}, - 'storage_account_subscription_id': {'key': 'properties.storageAccountSubscriptionId', 'type': 'str'}, - 'is_storage_secondary_key_in_use': {'key': 'properties.isStorageSecondaryKeyInUse', 'type': 'bool'}, - } - - def __init__(self, *, state, predicate_expression: str=None, storage_endpoint: str=None, storage_account_access_key: str=None, retention_days: int=None, audit_actions_and_groups=None, storage_account_subscription_id: str=None, is_storage_secondary_key_in_use: bool=None, **kwargs) -> None: - super(ExtendedServerBlobAuditingPolicy, self).__init__(**kwargs) - self.predicate_expression = predicate_expression - self.state = state - self.storage_endpoint = storage_endpoint - self.storage_account_access_key = storage_account_access_key - self.retention_days = retention_days - self.audit_actions_and_groups = audit_actions_and_groups - self.storage_account_subscription_id = storage_account_subscription_id - self.is_storage_secondary_key_in_use = is_storage_secondary_key_in_use diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy.py deleted file mode 100644 index 0232582a4237..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy.py +++ /dev/null @@ -1,141 +0,0 @@ -# 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 ServerBlobAuditingPolicy(ProxyResource): - """A server blob auditing 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. If state is - Enabled, storageEndpoint and storageAccountAccessKey are required. - Possible values include: 'Enabled', 'Disabled' - :type state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState - :param storage_endpoint: Specifies the blob storage endpoint (e.g. - https://MyAccount.blob.core.windows.net). If state is Enabled, - storageEndpoint is required. - :type storage_endpoint: str - :param storage_account_access_key: Specifies the identifier key of the - auditing storage account. If state is Enabled, storageAccountAccessKey is - required. - :type storage_account_access_key: str - :param retention_days: Specifies the number of days to keep in the audit - logs. - :type retention_days: int - :param audit_actions_and_groups: Specifies the Actions-Groups and Actions - to audit. - The recommended set of action groups to use is the following combination - - this will audit all the queries and stored procedures executed against the - database, as well as successful and failed logins: - BATCH_COMPLETED_GROUP, - SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, - FAILED_DATABASE_AUTHENTICATION_GROUP. - This above combination is also the set that is configured by default when - enabling auditing from the Azure portal. - The supported action groups to audit are (note: choose only specific - groups that cover your auditing needs. Using unnecessary groups could lead - to very large quantities of audit records): - APPLICATION_ROLE_CHANGE_PASSWORD_GROUP - BACKUP_RESTORE_GROUP - DATABASE_LOGOUT_GROUP - DATABASE_OBJECT_CHANGE_GROUP - DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP - DATABASE_OBJECT_PERMISSION_CHANGE_GROUP - DATABASE_OPERATION_GROUP - DATABASE_PERMISSION_CHANGE_GROUP - DATABASE_PRINCIPAL_CHANGE_GROUP - DATABASE_PRINCIPAL_IMPERSONATION_GROUP - DATABASE_ROLE_MEMBER_CHANGE_GROUP - FAILED_DATABASE_AUTHENTICATION_GROUP - SCHEMA_OBJECT_ACCESS_GROUP - SCHEMA_OBJECT_CHANGE_GROUP - SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP - SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP - SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP - USER_CHANGE_PASSWORD_GROUP - BATCH_STARTED_GROUP - BATCH_COMPLETED_GROUP - These are groups that cover all sql statements and stored procedures - executed against the database, and should not be used in combination with - other groups as this will result in duplicate audit logs. - For more information, see [Database-Level Audit Action - Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). - For Database auditing policy, specific Actions can also be specified (note - that Actions cannot be specified for Server auditing policy). The - supported actions to audit are: - SELECT - UPDATE - INSERT - DELETE - EXECUTE - RECEIVE - REFERENCES - The general form for defining an action to be audited is: - ON BY - Note that in the above format can refer to an object like a - table, view, or stored procedure, or an entire database or schema. For the - latter cases, the forms DATABASE:: and SCHEMA:: are - used, respectively. - For example: - SELECT on dbo.myTable by public - SELECT on DATABASE::myDatabase by public - SELECT on SCHEMA::mySchema by public - For more information, see [Database-Level Audit - Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) - :type audit_actions_and_groups: list[str] - :param storage_account_subscription_id: Specifies the blob storage - subscription Id. - :type storage_account_subscription_id: str - :param is_storage_secondary_key_in_use: Specifies whether - storageAccountAccessKey value is the storage's secondary key. - :type is_storage_secondary_key_in_use: bool - """ - - _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': 'BlobAuditingPolicyState'}, - 'storage_endpoint': {'key': 'properties.storageEndpoint', 'type': 'str'}, - 'storage_account_access_key': {'key': 'properties.storageAccountAccessKey', 'type': 'str'}, - 'retention_days': {'key': 'properties.retentionDays', 'type': 'int'}, - 'audit_actions_and_groups': {'key': 'properties.auditActionsAndGroups', 'type': '[str]'}, - 'storage_account_subscription_id': {'key': 'properties.storageAccountSubscriptionId', 'type': 'str'}, - 'is_storage_secondary_key_in_use': {'key': 'properties.isStorageSecondaryKeyInUse', 'type': 'bool'}, - } - - def __init__(self, **kwargs): - super(ServerBlobAuditingPolicy, self).__init__(**kwargs) - self.state = kwargs.get('state', 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.audit_actions_and_groups = kwargs.get('audit_actions_and_groups', None) - self.storage_account_subscription_id = kwargs.get('storage_account_subscription_id', None) - self.is_storage_secondary_key_in_use = kwargs.get('is_storage_secondary_key_in_use', None) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy_py3.py deleted file mode 100644 index 51dcc8c41d4c..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy_py3.py +++ /dev/null @@ -1,141 +0,0 @@ -# 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 ServerBlobAuditingPolicy(ProxyResource): - """A server blob auditing 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. If state is - Enabled, storageEndpoint and storageAccountAccessKey are required. - Possible values include: 'Enabled', 'Disabled' - :type state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState - :param storage_endpoint: Specifies the blob storage endpoint (e.g. - https://MyAccount.blob.core.windows.net). If state is Enabled, - storageEndpoint is required. - :type storage_endpoint: str - :param storage_account_access_key: Specifies the identifier key of the - auditing storage account. If state is Enabled, storageAccountAccessKey is - required. - :type storage_account_access_key: str - :param retention_days: Specifies the number of days to keep in the audit - logs. - :type retention_days: int - :param audit_actions_and_groups: Specifies the Actions-Groups and Actions - to audit. - The recommended set of action groups to use is the following combination - - this will audit all the queries and stored procedures executed against the - database, as well as successful and failed logins: - BATCH_COMPLETED_GROUP, - SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, - FAILED_DATABASE_AUTHENTICATION_GROUP. - This above combination is also the set that is configured by default when - enabling auditing from the Azure portal. - The supported action groups to audit are (note: choose only specific - groups that cover your auditing needs. Using unnecessary groups could lead - to very large quantities of audit records): - APPLICATION_ROLE_CHANGE_PASSWORD_GROUP - BACKUP_RESTORE_GROUP - DATABASE_LOGOUT_GROUP - DATABASE_OBJECT_CHANGE_GROUP - DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP - DATABASE_OBJECT_PERMISSION_CHANGE_GROUP - DATABASE_OPERATION_GROUP - DATABASE_PERMISSION_CHANGE_GROUP - DATABASE_PRINCIPAL_CHANGE_GROUP - DATABASE_PRINCIPAL_IMPERSONATION_GROUP - DATABASE_ROLE_MEMBER_CHANGE_GROUP - FAILED_DATABASE_AUTHENTICATION_GROUP - SCHEMA_OBJECT_ACCESS_GROUP - SCHEMA_OBJECT_CHANGE_GROUP - SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP - SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP - SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP - USER_CHANGE_PASSWORD_GROUP - BATCH_STARTED_GROUP - BATCH_COMPLETED_GROUP - These are groups that cover all sql statements and stored procedures - executed against the database, and should not be used in combination with - other groups as this will result in duplicate audit logs. - For more information, see [Database-Level Audit Action - Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). - For Database auditing policy, specific Actions can also be specified (note - that Actions cannot be specified for Server auditing policy). The - supported actions to audit are: - SELECT - UPDATE - INSERT - DELETE - EXECUTE - RECEIVE - REFERENCES - The general form for defining an action to be audited is: - ON BY - Note that in the above format can refer to an object like a - table, view, or stored procedure, or an entire database or schema. For the - latter cases, the forms DATABASE:: and SCHEMA:: are - used, respectively. - For example: - SELECT on dbo.myTable by public - SELECT on DATABASE::myDatabase by public - SELECT on SCHEMA::mySchema by public - For more information, see [Database-Level Audit - Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) - :type audit_actions_and_groups: list[str] - :param storage_account_subscription_id: Specifies the blob storage - subscription Id. - :type storage_account_subscription_id: str - :param is_storage_secondary_key_in_use: Specifies whether - storageAccountAccessKey value is the storage's secondary key. - :type is_storage_secondary_key_in_use: bool - """ - - _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': 'BlobAuditingPolicyState'}, - 'storage_endpoint': {'key': 'properties.storageEndpoint', 'type': 'str'}, - 'storage_account_access_key': {'key': 'properties.storageAccountAccessKey', 'type': 'str'}, - 'retention_days': {'key': 'properties.retentionDays', 'type': 'int'}, - 'audit_actions_and_groups': {'key': 'properties.auditActionsAndGroups', 'type': '[str]'}, - 'storage_account_subscription_id': {'key': 'properties.storageAccountSubscriptionId', 'type': 'str'}, - 'is_storage_secondary_key_in_use': {'key': 'properties.isStorageSecondaryKeyInUse', 'type': 'bool'}, - } - - def __init__(self, *, state, storage_endpoint: str=None, storage_account_access_key: str=None, retention_days: int=None, audit_actions_and_groups=None, storage_account_subscription_id: str=None, is_storage_secondary_key_in_use: bool=None, **kwargs) -> None: - super(ServerBlobAuditingPolicy, self).__init__(**kwargs) - self.state = state - self.storage_endpoint = storage_endpoint - self.storage_account_access_key = storage_account_access_key - self.retention_days = retention_days - self.audit_actions_and_groups = audit_actions_and_groups - self.storage_account_subscription_id = storage_account_subscription_id - self.is_storage_secondary_key_in_use = is_storage_secondary_key_in_use diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy.py deleted file mode 100644 index 4e5d69dbcd27..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy.py +++ /dev/null @@ -1,82 +0,0 @@ -# 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: 'New', 'Enabled', 'Disabled' - :type state: str or ~azure.mgmt.sql.models.SecurityAlertPolicyState - :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': 'SecurityAlertPolicyState'}, - '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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy_py3.py deleted file mode 100644 index 2a65b5d19078..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy_py3.py +++ /dev/null @@ -1,82 +0,0 @@ -# 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: 'New', 'Enabled', 'Disabled' - :type state: str or ~azure.mgmt.sql.models.SecurityAlertPolicyState - :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': 'SecurityAlertPolicyState'}, - '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 diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py b/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py index 90b01d122079..e4a76e0f84e5 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py @@ -264,6 +264,12 @@ class TransparentDataEncryptionActivityStatus(str, Enum): decrypting = "Decrypting" +class BlobAuditingPolicyState(str, Enum): + + enabled = "Enabled" + disabled = "Disabled" + + class AutomaticTuningMode(str, Enum): inherit = "Inherit" @@ -405,12 +411,6 @@ class VirtualNetworkRuleState(str, Enum): unknown = "Unknown" -class BlobAuditingPolicyState(str, Enum): - - enabled = "Enabled" - disabled = "Disabled" - - class JobAgentState(str, Enum): creating = "Creating" @@ -657,12 +657,6 @@ class LongTermRetentionDatabaseState(str, Enum): deleted = "Deleted" -class VulnerabilityAssessmentPolicyBaselineName(str, Enum): - - master = "master" - default = "default" - - class CapabilityGroup(str, Enum): supported_editions = "supportedEditions" diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/tde_certificate.py b/azure-mgmt-sql/azure/mgmt/sql/models/tde_certificate.py new file mode 100644 index 000000000000..1171ee8adf94 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/tde_certificate.py @@ -0,0 +1,54 @@ +# 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 TdeCertificate(ProxyResource): + """A TDE certificate that can be uploaded into a server. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param private_blob: Required. The base64 encoded certificate private + blob. + :type private_blob: str + :param cert_password: The certificate password. + :type cert_password: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'private_blob': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'private_blob': {'key': 'properties.privateBlob', 'type': 'str'}, + 'cert_password': {'key': 'properties.certPassword', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(TdeCertificate, self).__init__(**kwargs) + self.private_blob = kwargs.get('private_blob', None) + self.cert_password = kwargs.get('cert_password', None) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/tde_certificate_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/tde_certificate_py3.py new file mode 100644 index 000000000000..b4e54453cae1 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/tde_certificate_py3.py @@ -0,0 +1,54 @@ +# 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 TdeCertificate(ProxyResource): + """A TDE certificate that can be uploaded into a server. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param private_blob: Required. The base64 encoded certificate private + blob. + :type private_blob: str + :param cert_password: The certificate password. + :type cert_password: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'private_blob': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'private_blob': {'key': 'properties.privateBlob', 'type': 'str'}, + 'cert_password': {'key': 'properties.certPassword', 'type': 'str'}, + } + + def __init__(self, *, private_blob: str, cert_password: str=None, **kwargs) -> None: + super(TdeCertificate, self).__init__(**kwargs) + self.private_blob = private_blob + self.cert_password = cert_password diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py index 5512e9c68b84..ca19b385ece2 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py @@ -32,6 +32,7 @@ from .transparent_data_encryption_activities_operations import TransparentDataEncryptionActivitiesOperations from .server_usages_operations import ServerUsagesOperations from .database_usages_operations import DatabaseUsagesOperations +from .database_blob_auditing_policies_operations import DatabaseBlobAuditingPoliciesOperations from .database_automatic_tuning_operations import DatabaseAutomaticTuningOperations from .encryption_protectors_operations import EncryptionProtectorsOperations from .failover_groups_operations import FailoverGroupsOperations @@ -43,10 +44,6 @@ from .sync_members_operations import SyncMembersOperations from .subscription_usages_operations import SubscriptionUsagesOperations from .virtual_network_rules_operations import VirtualNetworkRulesOperations -from .extended_database_blob_auditing_policies_operations import ExtendedDatabaseBlobAuditingPoliciesOperations -from .extended_server_blob_auditing_policies_operations import ExtendedServerBlobAuditingPoliciesOperations -from .server_blob_auditing_policies_operations import ServerBlobAuditingPoliciesOperations -from .database_blob_auditing_policies_operations import DatabaseBlobAuditingPoliciesOperations from .database_vulnerability_assessment_rule_baselines_operations import DatabaseVulnerabilityAssessmentRuleBaselinesOperations from .database_vulnerability_assessments_operations import DatabaseVulnerabilityAssessmentsOperations from .job_agents_operations import JobAgentsOperations @@ -63,7 +60,6 @@ from .managed_databases_operations import ManagedDatabasesOperations from .server_automatic_tuning_operations import ServerAutomaticTuningOperations from .server_dns_aliases_operations import ServerDnsAliasesOperations -from .server_security_alert_policies_operations import ServerSecurityAlertPoliciesOperations from .restore_points_operations import RestorePointsOperations from .database_operations import DatabaseOperations from .elastic_pool_operations import ElasticPoolOperations @@ -71,6 +67,8 @@ from .database_vulnerability_assessment_scans_operations import DatabaseVulnerabilityAssessmentScansOperations from .instance_failover_groups_operations import InstanceFailoverGroupsOperations from .backup_short_term_retention_policies_operations import BackupShortTermRetentionPoliciesOperations +from .tde_certificates_operations import TdeCertificatesOperations +from .managed_instance_tde_certificates_operations import ManagedInstanceTdeCertificatesOperations __all__ = [ 'RecoverableDatabasesOperations', @@ -96,6 +94,7 @@ 'TransparentDataEncryptionActivitiesOperations', 'ServerUsagesOperations', 'DatabaseUsagesOperations', + 'DatabaseBlobAuditingPoliciesOperations', 'DatabaseAutomaticTuningOperations', 'EncryptionProtectorsOperations', 'FailoverGroupsOperations', @@ -107,10 +106,6 @@ 'SyncMembersOperations', 'SubscriptionUsagesOperations', 'VirtualNetworkRulesOperations', - 'ExtendedDatabaseBlobAuditingPoliciesOperations', - 'ExtendedServerBlobAuditingPoliciesOperations', - 'ServerBlobAuditingPoliciesOperations', - 'DatabaseBlobAuditingPoliciesOperations', 'DatabaseVulnerabilityAssessmentRuleBaselinesOperations', 'DatabaseVulnerabilityAssessmentsOperations', 'JobAgentsOperations', @@ -127,7 +122,6 @@ 'ManagedDatabasesOperations', 'ServerAutomaticTuningOperations', 'ServerDnsAliasesOperations', - 'ServerSecurityAlertPoliciesOperations', 'RestorePointsOperations', 'DatabaseOperations', 'ElasticPoolOperations', @@ -135,4 +129,6 @@ 'DatabaseVulnerabilityAssessmentScansOperations', 'InstanceFailoverGroupsOperations', 'BackupShortTermRetentionPoliciesOperations', + 'TdeCertificatesOperations', + 'ManagedInstanceTdeCertificatesOperations', ] diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/backup_short_term_retention_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/backup_short_term_retention_policies_operations.py index ce01d24f68c7..e50f15c2a997 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/backup_short_term_retention_policies_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/backup_short_term_retention_policies_operations.py @@ -331,79 +331,3 @@ def get_long_running_output(response): else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}'} - - def list_by_database( - self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): - """Gets a database's short term retention policy. - - :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 database_name: The name of the database. - :type database_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 BackupShortTermRetentionPolicy - :rtype: - ~azure.mgmt.sql.models.BackupShortTermRetentionPolicyPaged[~azure.mgmt.sql.models.BackupShortTermRetentionPolicy] - :raises: :class:`CloudError` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_database.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'), - 'databaseName': self._serialize.url("database_name", database_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['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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, 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.BackupShortTermRetentionPolicyPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.BackupShortTermRetentionPolicyPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/database_blob_auditing_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/database_blob_auditing_policies_operations.py index 425ace0b8cc3..fa915bf7c00d 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/database_blob_auditing_policies_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/database_blob_auditing_policies_operations.py @@ -24,7 +24,7 @@ class DatabaseBlobAuditingPoliciesOperations(object): :param serializer: An object model serializer. :param deserializer: An object model deserializer. :ivar blob_auditing_policy_name: The name of the blob auditing policy. Constant value: "default". - :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". + :ivar api_version: The API version to use for the request. Constant value: "2015-05-01-preview". """ models = models @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._serialize = serializer self._deserialize = deserializer self.blob_auditing_policy_name = "default" - self.api_version = "2017-03-01-preview" + self.api_version = "2015-05-01-preview" self.config = config @@ -49,7 +49,8 @@ def get( :type resource_group_name: str :param server_name: The name of the server. :type server_name: str - :param database_name: The name of the database. + :param database_name: The name of the database for which the blob + audit policy is defined. :type database_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the @@ -117,7 +118,8 @@ def create_or_update( :type resource_group_name: str :param server_name: The name of the server. :type server_name: str - :param database_name: The name of the database. + :param database_name: The name of the database for which the blob + auditing policy will be defined. :type database_name: str :param parameters: The database blob auditing policy. :type parameters: ~azure.mgmt.sql.models.DatabaseBlobAuditingPolicy diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/database_vulnerability_assessment_rule_baselines_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/database_vulnerability_assessment_rule_baselines_operations.py index 558ad0135821..16a909e27a1a 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/database_vulnerability_assessment_rule_baselines_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/database_vulnerability_assessment_rule_baselines_operations.py @@ -24,6 +24,7 @@ class DatabaseVulnerabilityAssessmentRuleBaselinesOperations(object): :param serializer: An object model serializer. :param deserializer: An object model deserializer. :ivar vulnerability_assessment_name: The name of the vulnerability assessment. Constant value: "default". + :ivar baseline_name: The name of the vulnerability assessment rule baseline. Constant value: "default". :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". """ @@ -35,12 +36,13 @@ def __init__(self, client, config, serializer, deserializer): self._serialize = serializer self._deserialize = deserializer self.vulnerability_assessment_name = "default" + self.baseline_name = "default" self.api_version = "2017-03-01-preview" self.config = config def get( - self, resource_group_name, server_name, database_name, rule_id, baseline_name, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, server_name, database_name, rule_id, custom_headers=None, raw=False, **operation_config): """Gets a database's vulnerability assessment rule baseline. :param resource_group_name: The name of the resource group that @@ -54,12 +56,6 @@ def get( :type database_name: str :param rule_id: The vulnerability assessment rule ID. :type rule_id: str - :param baseline_name: The name of the vulnerability assessment rule - baseline (default implies a baseline on a database level rule and - master for server level rule). Possible values include: 'master', - 'default' - :type baseline_name: str or - ~azure.mgmt.sql.models.VulnerabilityAssessmentPolicyBaselineName :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -80,7 +76,7 @@ def get( 'databaseName': self._serialize.url("database_name", database_name, 'str'), 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_name, 'str'), 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), - 'baselineName': self._serialize.url("baseline_name", baseline_name, 'VulnerabilityAssessmentPolicyBaselineName'), + 'baselineName': self._serialize.url("self.baseline_name", self.baseline_name, 'str'), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -121,7 +117,7 @@ def get( get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}'} def create_or_update( - self, resource_group_name, server_name, database_name, rule_id, baseline_name, baseline_results, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, server_name, database_name, rule_id, baseline_results, custom_headers=None, raw=False, **operation_config): """Creates or updates a database's vulnerability assessment rule baseline. :param resource_group_name: The name of the resource group that @@ -135,12 +131,6 @@ def create_or_update( :type database_name: str :param rule_id: The vulnerability assessment rule ID. :type rule_id: str - :param baseline_name: The name of the vulnerability assessment rule - baseline (default implies a baseline on a database level rule and - master for server level rule). Possible values include: 'master', - 'default' - :type baseline_name: str or - ~azure.mgmt.sql.models.VulnerabilityAssessmentPolicyBaselineName :param baseline_results: The rule baseline result :type baseline_results: list[~azure.mgmt.sql.models.DatabaseVulnerabilityAssessmentRuleBaselineItem] @@ -166,7 +156,7 @@ def create_or_update( 'databaseName': self._serialize.url("database_name", database_name, 'str'), 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_name, 'str'), 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), - 'baselineName': self._serialize.url("baseline_name", baseline_name, 'VulnerabilityAssessmentPolicyBaselineName'), + 'baselineName': self._serialize.url("self.baseline_name", self.baseline_name, 'str'), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -211,7 +201,7 @@ def create_or_update( create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}'} def delete( - self, resource_group_name, server_name, database_name, rule_id, baseline_name, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, server_name, database_name, rule_id, custom_headers=None, raw=False, **operation_config): """Removes the database's vulnerability assessment rule baseline. :param resource_group_name: The name of the resource group that @@ -225,12 +215,6 @@ def delete( :type database_name: str :param rule_id: The vulnerability assessment rule ID. :type rule_id: str - :param baseline_name: The name of the vulnerability assessment rule - baseline (default implies a baseline on a database level rule and - master for server level rule). Possible values include: 'master', - 'default' - :type baseline_name: str or - ~azure.mgmt.sql.models.VulnerabilityAssessmentPolicyBaselineName :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -248,7 +232,7 @@ def delete( 'databaseName': self._serialize.url("database_name", database_name, 'str'), 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_name, 'str'), 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), - 'baselineName': self._serialize.url("baseline_name", baseline_name, 'VulnerabilityAssessmentPolicyBaselineName'), + 'baselineName': self._serialize.url("self.baseline_name", self.baseline_name, 'str'), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/extended_database_blob_auditing_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/extended_database_blob_auditing_policies_operations.py deleted file mode 100644 index 73ff8454c8b5..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/extended_database_blob_auditing_policies_operations.py +++ /dev/null @@ -1,187 +0,0 @@ -# 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 .. import models - - -class ExtendedDatabaseBlobAuditingPoliciesOperations(object): - """ExtendedDatabaseBlobAuditingPoliciesOperations 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 blob_auditing_policy_name: The name of the blob auditing policy. Constant value: "default". - :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.blob_auditing_policy_name = "default" - self.api_version = "2017-03-01-preview" - - self.config = config - - def get( - self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): - """Gets an extended database's blob auditing policy. - - :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 database_name: The name of the database. - :type database_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: ExtendedDatabaseBlobAuditingPolicy or ClientRawResponse if - raw=true - :rtype: ~azure.mgmt.sql.models.ExtendedDatabaseBlobAuditingPolicy 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'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'blobAuditingPolicyName': self._serialize.url("self.blob_auditing_policy_name", self.blob_auditing_policy_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['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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, 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('ExtendedDatabaseBlobAuditingPolicy', 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}/databases/{databaseName}/extendedAuditingSettings/{blobAuditingPolicyName}'} - - def create_or_update( - self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates an extended database's blob auditing policy. - - :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 database_name: The name of the database. - :type database_name: str - :param parameters: The extended database blob auditing policy. - :type parameters: - ~azure.mgmt.sql.models.ExtendedDatabaseBlobAuditingPolicy - :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: ExtendedDatabaseBlobAuditingPolicy or ClientRawResponse if - raw=true - :rtype: ~azure.mgmt.sql.models.ExtendedDatabaseBlobAuditingPolicy or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # 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'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'blobAuditingPolicyName': self._serialize.url("self.blob_auditing_policy_name", self.blob_auditing_policy_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['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, 'ExtendedDatabaseBlobAuditingPolicy') - - # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) - - if response.status_code not in [200, 201]: - 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('ExtendedDatabaseBlobAuditingPolicy', response) - if response.status_code == 201: - deserialized = self._deserialize('ExtendedDatabaseBlobAuditingPolicy', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extendedAuditingSettings/{blobAuditingPolicyName}'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/extended_server_blob_auditing_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/extended_server_blob_auditing_policies_operations.py deleted file mode 100644 index 02830132aa3f..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/extended_server_blob_auditing_policies_operations.py +++ /dev/null @@ -1,213 +0,0 @@ -# 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 ExtendedServerBlobAuditingPoliciesOperations(object): - """ExtendedServerBlobAuditingPoliciesOperations 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 blob_auditing_policy_name: The name of the blob auditing policy. Constant value: "default". - :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.blob_auditing_policy_name = "default" - self.api_version = "2017-03-01-preview" - - self.config = config - - def get( - self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): - """Gets an extended server's blob auditing policy. - - :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: ExtendedServerBlobAuditingPolicy or ClientRawResponse if - raw=true - :rtype: ~azure.mgmt.sql.models.ExtendedServerBlobAuditingPolicy 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'), - 'blobAuditingPolicyName': self._serialize.url("self.blob_auditing_policy_name", self.blob_auditing_policy_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['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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, 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('ExtendedServerBlobAuditingPolicy', 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}/extendedAuditingSettings/{blobAuditingPolicyName}'} - - - def _create_or_update_initial( - 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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serverName': self._serialize.url("server_name", server_name, 'str'), - 'blobAuditingPolicyName': self._serialize.url("self.blob_auditing_policy_name", self.blob_auditing_policy_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['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, 'ExtendedServerBlobAuditingPolicy') - - # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, 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('ExtendedServerBlobAuditingPolicy', 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, parameters, custom_headers=None, raw=False, polling=True, **operation_config): - """Creates or updates an extended server's blob auditing policy. - - :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 parameters: Properties of extended blob auditing policy - :type parameters: - ~azure.mgmt.sql.models.ExtendedServerBlobAuditingPolicy - :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 - ExtendedServerBlobAuditingPolicy or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ExtendedServerBlobAuditingPolicy] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.sql.models.ExtendedServerBlobAuditingPolicy]] - :raises: :class:`CloudError` - """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - server_name=server_name, - parameters=parameters, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - deserialized = self._deserialize('ExtendedServerBlobAuditingPolicy', 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}/extendedAuditingSettings/{blobAuditingPolicyName}'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/managed_instance_tde_certificates_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/managed_instance_tde_certificates_operations.py new file mode 100644 index 000000000000..25858d6548f3 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/managed_instance_tde_certificates_operations.py @@ -0,0 +1,134 @@ +# 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 ManagedInstanceTdeCertificatesOperations(object): + """ManagedInstanceTdeCertificatesOperations 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: "2017-10-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-10-01-preview" + + self.config = config + + + def _create_initial( + self, resource_group_name, managed_instance_name, private_blob, cert_password=None, custom_headers=None, raw=False, **operation_config): + parameters = models.TdeCertificate(private_blob=private_blob, cert_password=cert_password) + + # Construct URL + url = self.create.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_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['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, 'TdeCertificate') + + # Construct and send request + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, 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 create( + self, resource_group_name, managed_instance_name, private_blob, cert_password=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates a TDE certificate for a given 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 managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param private_blob: The base64 encoded certificate private blob. + :type private_blob: str + :param cert_password: The certificate password. + :type cert_password: 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._create_initial( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + private_blob=private_blob, + cert_password=cert_password, + 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) + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/tdeCertificates'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/server_blob_auditing_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/server_blob_auditing_policies_operations.py deleted file mode 100644 index ae38710656f9..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/server_blob_auditing_policies_operations.py +++ /dev/null @@ -1,211 +0,0 @@ -# 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 ServerBlobAuditingPoliciesOperations(object): - """ServerBlobAuditingPoliciesOperations 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 blob_auditing_policy_name: The name of the blob auditing policy. Constant value: "default". - :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.blob_auditing_policy_name = "default" - self.api_version = "2017-03-01-preview" - - self.config = config - - def get( - self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): - """Gets a server's blob auditing policy. - - :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: ServerBlobAuditingPolicy or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.sql.models.ServerBlobAuditingPolicy 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'), - 'blobAuditingPolicyName': self._serialize.url("self.blob_auditing_policy_name", self.blob_auditing_policy_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['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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, 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('ServerBlobAuditingPolicy', 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}/auditingSettings/{blobAuditingPolicyName}'} - - - def _create_or_update_initial( - 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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serverName': self._serialize.url("server_name", server_name, 'str'), - 'blobAuditingPolicyName': self._serialize.url("self.blob_auditing_policy_name", self.blob_auditing_policy_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['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, 'ServerBlobAuditingPolicy') - - # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, 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('ServerBlobAuditingPolicy', 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, parameters, custom_headers=None, raw=False, polling=True, **operation_config): - """Creates or updates a server's blob auditing policy. - - :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 parameters: Properties of blob auditing policy - :type parameters: ~azure.mgmt.sql.models.ServerBlobAuditingPolicy - :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 - ServerBlobAuditingPolicy or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ServerBlobAuditingPolicy] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.sql.models.ServerBlobAuditingPolicy]] - :raises: :class:`CloudError` - """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - server_name=server_name, - parameters=parameters, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - deserialized = self._deserialize('ServerBlobAuditingPolicy', 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}/auditingSettings/{blobAuditingPolicyName}'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/server_security_alert_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/server_security_alert_policies_operations.py deleted file mode 100644 index ddbd335574b4..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/server_security_alert_policies_operations.py +++ /dev/null @@ -1,211 +0,0 @@ -# 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 ServerSecurityAlertPoliciesOperations(object): - """ServerSecurityAlertPoliciesOperations 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 security_alert_policy_name: The name of the security alert policy. Constant value: "Default". - :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.security_alert_policy_name = "Default" - self.api_version = "2017-03-01-preview" - - self.config = config - - def get( - self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): - """Get a server's security alert policy. - - :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: ServerSecurityAlertPolicy or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.sql.models.ServerSecurityAlertPolicy 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'), - 'securityAlertPolicyName': self._serialize.url("self.security_alert_policy_name", self.security_alert_policy_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['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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, 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('ServerSecurityAlertPolicy', 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}/securityAlertPolicies/{securityAlertPolicyName}'} - - - def _create_or_update_initial( - 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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serverName': self._serialize.url("server_name", server_name, 'str'), - 'securityAlertPolicyName': self._serialize.url("self.security_alert_policy_name", self.security_alert_policy_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['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, 'ServerSecurityAlertPolicy') - - # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, 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('ServerSecurityAlertPolicy', 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, 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 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 parameters: The server security alert policy. - :type parameters: ~azure.mgmt.sql.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 - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns - ServerSecurityAlertPolicy or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ServerSecurityAlertPolicy] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.sql.models.ServerSecurityAlertPolicy]] - :raises: :class:`CloudError` - """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - server_name=server_name, - parameters=parameters, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - deserialized = self._deserialize('ServerSecurityAlertPolicy', 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}/securityAlertPolicies/{securityAlertPolicyName}'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/tde_certificates_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/tde_certificates_operations.py new file mode 100644 index 000000000000..3224daf071e6 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/tde_certificates_operations.py @@ -0,0 +1,134 @@ +# 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 TdeCertificatesOperations(object): + """TdeCertificatesOperations 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: "2017-10-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-10-01-preview" + + self.config = config + + + def _create_initial( + self, resource_group_name, server_name, private_blob, cert_password=None, custom_headers=None, raw=False, **operation_config): + parameters = models.TdeCertificate(private_blob=private_blob, cert_password=cert_password) + + # Construct URL + url = self.create.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') + + # Construct headers + header_parameters = {} + 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, 'TdeCertificate') + + # Construct and send request + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, 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 create( + self, resource_group_name, server_name, private_blob, cert_password=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates a TDE certificate for a given 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 private_blob: The base64 encoded certificate private blob. + :type private_blob: str + :param cert_password: The certificate password. + :type cert_password: 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._create_initial( + resource_group_name=resource_group_name, + server_name=server_name, + private_blob=private_blob, + cert_password=cert_password, + 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) + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/tdeCertificates'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py index 404b7b7bc740..defe2f7f99eb 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py +++ b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py @@ -36,6 +36,7 @@ from .operations.transparent_data_encryption_activities_operations import TransparentDataEncryptionActivitiesOperations from .operations.server_usages_operations import ServerUsagesOperations from .operations.database_usages_operations import DatabaseUsagesOperations +from .operations.database_blob_auditing_policies_operations import DatabaseBlobAuditingPoliciesOperations from .operations.database_automatic_tuning_operations import DatabaseAutomaticTuningOperations from .operations.encryption_protectors_operations import EncryptionProtectorsOperations from .operations.failover_groups_operations import FailoverGroupsOperations @@ -47,10 +48,6 @@ from .operations.sync_members_operations import SyncMembersOperations from .operations.subscription_usages_operations import SubscriptionUsagesOperations from .operations.virtual_network_rules_operations import VirtualNetworkRulesOperations -from .operations.extended_database_blob_auditing_policies_operations import ExtendedDatabaseBlobAuditingPoliciesOperations -from .operations.extended_server_blob_auditing_policies_operations import ExtendedServerBlobAuditingPoliciesOperations -from .operations.server_blob_auditing_policies_operations import ServerBlobAuditingPoliciesOperations -from .operations.database_blob_auditing_policies_operations import DatabaseBlobAuditingPoliciesOperations from .operations.database_vulnerability_assessment_rule_baselines_operations import DatabaseVulnerabilityAssessmentRuleBaselinesOperations from .operations.database_vulnerability_assessments_operations import DatabaseVulnerabilityAssessmentsOperations from .operations.job_agents_operations import JobAgentsOperations @@ -67,7 +64,6 @@ from .operations.managed_databases_operations import ManagedDatabasesOperations from .operations.server_automatic_tuning_operations import ServerAutomaticTuningOperations from .operations.server_dns_aliases_operations import ServerDnsAliasesOperations -from .operations.server_security_alert_policies_operations import ServerSecurityAlertPoliciesOperations from .operations.restore_points_operations import RestorePointsOperations from .operations.database_operations import DatabaseOperations from .operations.elastic_pool_operations import ElasticPoolOperations @@ -75,6 +71,8 @@ from .operations.database_vulnerability_assessment_scans_operations import DatabaseVulnerabilityAssessmentScansOperations from .operations.instance_failover_groups_operations import InstanceFailoverGroupsOperations from .operations.backup_short_term_retention_policies_operations import BackupShortTermRetentionPoliciesOperations +from .operations.tde_certificates_operations import TdeCertificatesOperations +from .operations.managed_instance_tde_certificates_operations import ManagedInstanceTdeCertificatesOperations from . import models @@ -163,6 +161,8 @@ class SqlManagementClient(SDKClient): :vartype server_usages: azure.mgmt.sql.operations.ServerUsagesOperations :ivar database_usages: DatabaseUsages operations :vartype database_usages: azure.mgmt.sql.operations.DatabaseUsagesOperations + :ivar database_blob_auditing_policies: DatabaseBlobAuditingPolicies operations + :vartype database_blob_auditing_policies: azure.mgmt.sql.operations.DatabaseBlobAuditingPoliciesOperations :ivar database_automatic_tuning: DatabaseAutomaticTuning operations :vartype database_automatic_tuning: azure.mgmt.sql.operations.DatabaseAutomaticTuningOperations :ivar encryption_protectors: EncryptionProtectors operations @@ -185,14 +185,6 @@ class SqlManagementClient(SDKClient): :vartype subscription_usages: azure.mgmt.sql.operations.SubscriptionUsagesOperations :ivar virtual_network_rules: VirtualNetworkRules operations :vartype virtual_network_rules: azure.mgmt.sql.operations.VirtualNetworkRulesOperations - :ivar extended_database_blob_auditing_policies: ExtendedDatabaseBlobAuditingPolicies operations - :vartype extended_database_blob_auditing_policies: azure.mgmt.sql.operations.ExtendedDatabaseBlobAuditingPoliciesOperations - :ivar extended_server_blob_auditing_policies: ExtendedServerBlobAuditingPolicies operations - :vartype extended_server_blob_auditing_policies: azure.mgmt.sql.operations.ExtendedServerBlobAuditingPoliciesOperations - :ivar server_blob_auditing_policies: ServerBlobAuditingPolicies operations - :vartype server_blob_auditing_policies: azure.mgmt.sql.operations.ServerBlobAuditingPoliciesOperations - :ivar database_blob_auditing_policies: DatabaseBlobAuditingPolicies operations - :vartype database_blob_auditing_policies: azure.mgmt.sql.operations.DatabaseBlobAuditingPoliciesOperations :ivar database_vulnerability_assessment_rule_baselines: DatabaseVulnerabilityAssessmentRuleBaselines operations :vartype database_vulnerability_assessment_rule_baselines: azure.mgmt.sql.operations.DatabaseVulnerabilityAssessmentRuleBaselinesOperations :ivar database_vulnerability_assessments: DatabaseVulnerabilityAssessments operations @@ -225,8 +217,6 @@ class SqlManagementClient(SDKClient): :vartype server_automatic_tuning: azure.mgmt.sql.operations.ServerAutomaticTuningOperations :ivar server_dns_aliases: ServerDnsAliases operations :vartype server_dns_aliases: azure.mgmt.sql.operations.ServerDnsAliasesOperations - :ivar server_security_alert_policies: ServerSecurityAlertPolicies operations - :vartype server_security_alert_policies: azure.mgmt.sql.operations.ServerSecurityAlertPoliciesOperations :ivar restore_points: RestorePoints operations :vartype restore_points: azure.mgmt.sql.operations.RestorePointsOperations :ivar database_operations: DatabaseOperations operations @@ -241,6 +231,10 @@ class SqlManagementClient(SDKClient): :vartype instance_failover_groups: azure.mgmt.sql.operations.InstanceFailoverGroupsOperations :ivar backup_short_term_retention_policies: BackupShortTermRetentionPolicies operations :vartype backup_short_term_retention_policies: azure.mgmt.sql.operations.BackupShortTermRetentionPoliciesOperations + :ivar tde_certificates: TdeCertificates operations + :vartype tde_certificates: azure.mgmt.sql.operations.TdeCertificatesOperations + :ivar managed_instance_tde_certificates: ManagedInstanceTdeCertificates operations + :vartype managed_instance_tde_certificates: azure.mgmt.sql.operations.ManagedInstanceTdeCertificatesOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -307,6 +301,8 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.database_usages = DatabaseUsagesOperations( self._client, self.config, self._serialize, self._deserialize) + self.database_blob_auditing_policies = DatabaseBlobAuditingPoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) self.database_automatic_tuning = DatabaseAutomaticTuningOperations( self._client, self.config, self._serialize, self._deserialize) self.encryption_protectors = EncryptionProtectorsOperations( @@ -329,14 +325,6 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.virtual_network_rules = VirtualNetworkRulesOperations( self._client, self.config, self._serialize, self._deserialize) - self.extended_database_blob_auditing_policies = ExtendedDatabaseBlobAuditingPoliciesOperations( - self._client, self.config, self._serialize, self._deserialize) - self.extended_server_blob_auditing_policies = ExtendedServerBlobAuditingPoliciesOperations( - self._client, self.config, self._serialize, self._deserialize) - self.server_blob_auditing_policies = ServerBlobAuditingPoliciesOperations( - self._client, self.config, self._serialize, self._deserialize) - self.database_blob_auditing_policies = DatabaseBlobAuditingPoliciesOperations( - self._client, self.config, self._serialize, self._deserialize) self.database_vulnerability_assessment_rule_baselines = DatabaseVulnerabilityAssessmentRuleBaselinesOperations( self._client, self.config, self._serialize, self._deserialize) self.database_vulnerability_assessments = DatabaseVulnerabilityAssessmentsOperations( @@ -369,8 +357,6 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.server_dns_aliases = ServerDnsAliasesOperations( self._client, self.config, self._serialize, self._deserialize) - self.server_security_alert_policies = ServerSecurityAlertPoliciesOperations( - self._client, self.config, self._serialize, self._deserialize) self.restore_points = RestorePointsOperations( self._client, self.config, self._serialize, self._deserialize) self.database_operations = DatabaseOperations( @@ -385,3 +371,7 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.backup_short_term_retention_policies = BackupShortTermRetentionPoliciesOperations( self._client, self.config, self._serialize, self._deserialize) + self.tde_certificates = TdeCertificatesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.managed_instance_tde_certificates = ManagedInstanceTdeCertificatesOperations( + self._client, self.config, self._serialize, self._deserialize) From ba1216800717a53dd015bd20aeb84dadf2940943 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 18 Jul 2018 13:26:31 -0700 Subject: [PATCH 07/19] Generated from 7ddb78c4a14cb8b09c405b2ae17b49ff26c23bf5 (#2892) Swagger of sensitivity labels APIs Adding swagger containing APIs of sensitivity labels, as long as usage examples of these APIs. --- .../azure/mgmt/sql/models/__init__.py | 33 +- ...ackup_short_term_retention_policy_paged.py | 27 ++ .../models/database_blob_auditing_policy.py | 62 ++- .../database_blob_auditing_policy_py3.py | 62 ++- .../extended_database_blob_auditing_policy.py | 146 +++++++ ...ended_database_blob_auditing_policy_py3.py | 146 +++++++ .../extended_server_blob_auditing_policy.py | 146 +++++++ ...xtended_server_blob_auditing_policy_py3.py | 146 +++++++ .../mgmt/sql/models/sensitivity_label.py | 50 +++ .../sql/models/sensitivity_label_paged.py | 27 ++ .../mgmt/sql/models/sensitivity_label_py3.py | 50 +++ .../sql/models/server_blob_auditing_policy.py | 141 +++++++ .../models/server_blob_auditing_policy_py3.py | 141 +++++++ .../models/server_security_alert_policy.py | 82 ++++ .../server_security_alert_policy_py3.py | 82 ++++ .../sql/models/sql_management_client_enums.py | 24 +- .../azure/mgmt/sql/operations/__init__.py | 14 +- ...hort_term_retention_policies_operations.py | 76 ++++ ...abase_blob_auditing_policies_operations.py | 10 +- ...ty_assessment_rule_baselines_operations.py | 32 +- ...abase_blob_auditing_policies_operations.py | 187 +++++++++ ...erver_blob_auditing_policies_operations.py | 213 +++++++++++ .../sensitivity_labels_operations.py | 360 ++++++++++++++++++ ...erver_blob_auditing_policies_operations.py | 211 ++++++++++ ...rver_security_alert_policies_operations.py | 211 ++++++++++ .../azure/mgmt/sql/sql_management_client.py | 35 +- 26 files changed, 2678 insertions(+), 36 deletions(-) create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/backup_short_term_retention_policy_paged.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy_py3.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy_py3.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label_paged.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label_py3.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy_py3.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy_py3.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/extended_database_blob_auditing_policies_operations.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/extended_server_blob_auditing_policies_operations.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/sensitivity_labels_operations.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/server_blob_auditing_policies_operations.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/server_security_alert_policies_operations.py diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py index a1dcb657e770..921235f71ce5 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py @@ -48,7 +48,6 @@ from .transparent_data_encryption_activity_py3 import TransparentDataEncryptionActivity from .server_usage_py3 import ServerUsage from .database_usage_py3 import DatabaseUsage - from .database_blob_auditing_policy_py3 import DatabaseBlobAuditingPolicy from .automatic_tuning_options_py3 import AutomaticTuningOptions from .database_automatic_tuning_py3 import DatabaseAutomaticTuning from .encryption_protector_py3 import EncryptionProtector @@ -81,6 +80,10 @@ from .sync_member_py3 import SyncMember from .subscription_usage_py3 import SubscriptionUsage from .virtual_network_rule_py3 import VirtualNetworkRule + from .extended_database_blob_auditing_policy_py3 import ExtendedDatabaseBlobAuditingPolicy + from .extended_server_blob_auditing_policy_py3 import ExtendedServerBlobAuditingPolicy + from .server_blob_auditing_policy_py3 import ServerBlobAuditingPolicy + from .database_blob_auditing_policy_py3 import DatabaseBlobAuditingPolicy from .database_vulnerability_assessment_rule_baseline_item_py3 import DatabaseVulnerabilityAssessmentRuleBaselineItem from .database_vulnerability_assessment_rule_baseline_py3 import DatabaseVulnerabilityAssessmentRuleBaseline from .vulnerability_assessment_recurring_scans_properties_py3 import VulnerabilityAssessmentRecurringScansProperties @@ -104,10 +107,12 @@ from .complete_database_restore_definition_py3 import CompleteDatabaseRestoreDefinition from .managed_database_py3 import ManagedDatabase from .managed_database_update_py3 import ManagedDatabaseUpdate + from .sensitivity_label_py3 import SensitivityLabel from .automatic_tuning_server_options_py3 import AutomaticTuningServerOptions from .server_automatic_tuning_py3 import ServerAutomaticTuning from .server_dns_alias_py3 import ServerDnsAlias from .server_dns_alias_acquisition_py3 import ServerDnsAliasAcquisition + from .server_security_alert_policy_py3 import ServerSecurityAlertPolicy from .restore_point_py3 import RestorePoint from .create_database_restore_point_definition_py3 import CreateDatabaseRestorePointDefinition from .database_operation_py3 import DatabaseOperation @@ -184,7 +189,6 @@ from .transparent_data_encryption_activity import TransparentDataEncryptionActivity from .server_usage import ServerUsage from .database_usage import DatabaseUsage - from .database_blob_auditing_policy import DatabaseBlobAuditingPolicy from .automatic_tuning_options import AutomaticTuningOptions from .database_automatic_tuning import DatabaseAutomaticTuning from .encryption_protector import EncryptionProtector @@ -217,6 +221,10 @@ from .sync_member import SyncMember from .subscription_usage import SubscriptionUsage from .virtual_network_rule import VirtualNetworkRule + from .extended_database_blob_auditing_policy import ExtendedDatabaseBlobAuditingPolicy + from .extended_server_blob_auditing_policy import ExtendedServerBlobAuditingPolicy + from .server_blob_auditing_policy import ServerBlobAuditingPolicy + from .database_blob_auditing_policy import DatabaseBlobAuditingPolicy from .database_vulnerability_assessment_rule_baseline_item import DatabaseVulnerabilityAssessmentRuleBaselineItem from .database_vulnerability_assessment_rule_baseline import DatabaseVulnerabilityAssessmentRuleBaseline from .vulnerability_assessment_recurring_scans_properties import VulnerabilityAssessmentRecurringScansProperties @@ -240,10 +248,12 @@ from .complete_database_restore_definition import CompleteDatabaseRestoreDefinition from .managed_database import ManagedDatabase from .managed_database_update import ManagedDatabaseUpdate + from .sensitivity_label import SensitivityLabel from .automatic_tuning_server_options import AutomaticTuningServerOptions from .server_automatic_tuning import ServerAutomaticTuning from .server_dns_alias import ServerDnsAlias from .server_dns_alias_acquisition import ServerDnsAliasAcquisition + from .server_security_alert_policy import ServerSecurityAlertPolicy from .restore_point import RestorePoint from .create_database_restore_point_definition import CreateDatabaseRestorePointDefinition from .database_operation import DatabaseOperation @@ -326,12 +336,14 @@ from .job_version_paged import JobVersionPaged from .long_term_retention_backup_paged import LongTermRetentionBackupPaged from .managed_database_paged import ManagedDatabasePaged +from .sensitivity_label_paged import SensitivityLabelPaged from .server_dns_alias_paged import ServerDnsAliasPaged from .restore_point_paged import RestorePointPaged from .database_operation_paged import DatabaseOperationPaged from .elastic_pool_operation_paged import ElasticPoolOperationPaged from .vulnerability_assessment_scan_record_paged import VulnerabilityAssessmentScanRecordPaged from .instance_failover_group_paged import InstanceFailoverGroupPaged +from .backup_short_term_retention_policy_paged import BackupShortTermRetentionPolicyPaged from .sql_management_client_enums import ( CheckNameAvailabilityReason, ServerConnectionType, @@ -357,7 +369,6 @@ RecommendedIndexType, TransparentDataEncryptionStatus, TransparentDataEncryptionActivityStatus, - BlobAuditingPolicyState, AutomaticTuningMode, AutomaticTuningOptionModeDesired, AutomaticTuningOptionModeActual, @@ -376,6 +387,7 @@ SyncDirection, SyncMemberState, VirtualNetworkRuleState, + BlobAuditingPolicyState, JobAgentState, JobExecutionLifecycle, ProvisioningState, @@ -407,6 +419,8 @@ VulnerabilityAssessmentScanState, InstanceFailoverGroupReplicationRole, LongTermRetentionDatabaseState, + VulnerabilityAssessmentPolicyBaselineName, + SensitivityLabelSource, CapabilityGroup, ) @@ -449,7 +463,6 @@ 'TransparentDataEncryptionActivity', 'ServerUsage', 'DatabaseUsage', - 'DatabaseBlobAuditingPolicy', 'AutomaticTuningOptions', 'DatabaseAutomaticTuning', 'EncryptionProtector', @@ -482,6 +495,10 @@ 'SyncMember', 'SubscriptionUsage', 'VirtualNetworkRule', + 'ExtendedDatabaseBlobAuditingPolicy', + 'ExtendedServerBlobAuditingPolicy', + 'ServerBlobAuditingPolicy', + 'DatabaseBlobAuditingPolicy', 'DatabaseVulnerabilityAssessmentRuleBaselineItem', 'DatabaseVulnerabilityAssessmentRuleBaseline', 'VulnerabilityAssessmentRecurringScansProperties', @@ -505,10 +522,12 @@ 'CompleteDatabaseRestoreDefinition', 'ManagedDatabase', 'ManagedDatabaseUpdate', + 'SensitivityLabel', 'AutomaticTuningServerOptions', 'ServerAutomaticTuning', 'ServerDnsAlias', 'ServerDnsAliasAcquisition', + 'ServerSecurityAlertPolicy', 'RestorePoint', 'CreateDatabaseRestorePointDefinition', 'DatabaseOperation', @@ -591,12 +610,14 @@ 'JobVersionPaged', 'LongTermRetentionBackupPaged', 'ManagedDatabasePaged', + 'SensitivityLabelPaged', 'ServerDnsAliasPaged', 'RestorePointPaged', 'DatabaseOperationPaged', 'ElasticPoolOperationPaged', 'VulnerabilityAssessmentScanRecordPaged', 'InstanceFailoverGroupPaged', + 'BackupShortTermRetentionPolicyPaged', 'CheckNameAvailabilityReason', 'ServerConnectionType', 'SecurityAlertPolicyState', @@ -621,7 +642,6 @@ 'RecommendedIndexType', 'TransparentDataEncryptionStatus', 'TransparentDataEncryptionActivityStatus', - 'BlobAuditingPolicyState', 'AutomaticTuningMode', 'AutomaticTuningOptionModeDesired', 'AutomaticTuningOptionModeActual', @@ -640,6 +660,7 @@ 'SyncDirection', 'SyncMemberState', 'VirtualNetworkRuleState', + 'BlobAuditingPolicyState', 'JobAgentState', 'JobExecutionLifecycle', 'ProvisioningState', @@ -671,5 +692,7 @@ 'VulnerabilityAssessmentScanState', 'InstanceFailoverGroupReplicationRole', 'LongTermRetentionDatabaseState', + 'VulnerabilityAssessmentPolicyBaselineName', + 'SensitivityLabelSource', 'CapabilityGroup', ] diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/backup_short_term_retention_policy_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/backup_short_term_retention_policy_paged.py new file mode 100644 index 000000000000..16d31e341795 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/backup_short_term_retention_policy_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 BackupShortTermRetentionPolicyPaged(Paged): + """ + A paging container for iterating over a list of :class:`BackupShortTermRetentionPolicy ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[BackupShortTermRetentionPolicy]'} + } + + def __init__(self, *args, **kwargs): + + super(BackupShortTermRetentionPolicyPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy.py b/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy.py index 407713325e7d..963b7674ac16 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy.py @@ -43,14 +43,72 @@ class DatabaseBlobAuditingPolicy(ProxyResource): :param retention_days: Specifies the number of days to keep in the audit logs. :type retention_days: int - :param audit_actions_and_groups: Specifies the Actions and Actions-Groups + :param audit_actions_and_groups: Specifies the Actions-Groups and Actions to audit. + The recommended set of action groups to use is the following combination - + this will audit all the queries and stored procedures executed against the + database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when + enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific + groups that cover your auditing needs. Using unnecessary groups could lead + to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures + executed against the database, and should not be used in combination with + other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action + Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note + that Actions cannot be specified for Server auditing policy). The + supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + ON BY + Note that in the above format can refer to an object like a + table, view, or stored procedure, or an entire database or schema. For the + latter cases, the forms DATABASE:: and SCHEMA:: are + used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit + Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) :type audit_actions_and_groups: list[str] :param storage_account_subscription_id: Specifies the blob storage subscription Id. :type storage_account_subscription_id: str :param is_storage_secondary_key_in_use: Specifies whether - storageAccountAccessKey value is the storage’s secondary key. + storageAccountAccessKey value is the storage's secondary key. :type is_storage_secondary_key_in_use: bool """ diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy_py3.py index bfc95370f0fc..1c58ec560a03 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy_py3.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy_py3.py @@ -43,14 +43,72 @@ class DatabaseBlobAuditingPolicy(ProxyResource): :param retention_days: Specifies the number of days to keep in the audit logs. :type retention_days: int - :param audit_actions_and_groups: Specifies the Actions and Actions-Groups + :param audit_actions_and_groups: Specifies the Actions-Groups and Actions to audit. + The recommended set of action groups to use is the following combination - + this will audit all the queries and stored procedures executed against the + database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when + enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific + groups that cover your auditing needs. Using unnecessary groups could lead + to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures + executed against the database, and should not be used in combination with + other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action + Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note + that Actions cannot be specified for Server auditing policy). The + supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + ON BY + Note that in the above format can refer to an object like a + table, view, or stored procedure, or an entire database or schema. For the + latter cases, the forms DATABASE:: and SCHEMA:: are + used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit + Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) :type audit_actions_and_groups: list[str] :param storage_account_subscription_id: Specifies the blob storage subscription Id. :type storage_account_subscription_id: str :param is_storage_secondary_key_in_use: Specifies whether - storageAccountAccessKey value is the storage’s secondary key. + storageAccountAccessKey value is the storage's secondary key. :type is_storage_secondary_key_in_use: bool """ diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy.py b/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy.py new file mode 100644 index 000000000000..cdfb75e47f2a --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy.py @@ -0,0 +1,146 @@ +# 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 ExtendedDatabaseBlobAuditingPolicy(ProxyResource): + """An extended database blob auditing 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 predicate_expression: Specifies condition of where clause when + creating an audit. + :type predicate_expression: str + :param state: Required. Specifies the state of the policy. If state is + Enabled, storageEndpoint and storageAccountAccessKey are required. + Possible values include: 'Enabled', 'Disabled' + :type state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState + :param storage_endpoint: Specifies the blob storage endpoint (e.g. + https://MyAccount.blob.core.windows.net). If state is Enabled, + storageEndpoint is required. + :type storage_endpoint: str + :param storage_account_access_key: Specifies the identifier key of the + auditing storage account. If state is Enabled, storageAccountAccessKey is + required. + :type storage_account_access_key: str + :param retention_days: Specifies the number of days to keep in the audit + logs. + :type retention_days: int + :param audit_actions_and_groups: Specifies the Actions-Groups and Actions + to audit. + The recommended set of action groups to use is the following combination - + this will audit all the queries and stored procedures executed against the + database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when + enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific + groups that cover your auditing needs. Using unnecessary groups could lead + to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures + executed against the database, and should not be used in combination with + other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action + Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note + that Actions cannot be specified for Server auditing policy). The + supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + ON BY + Note that in the above format can refer to an object like a + table, view, or stored procedure, or an entire database or schema. For the + latter cases, the forms DATABASE:: and SCHEMA:: are + used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit + Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) + :type audit_actions_and_groups: list[str] + :param storage_account_subscription_id: Specifies the blob storage + subscription Id. + :type storage_account_subscription_id: str + :param is_storage_secondary_key_in_use: Specifies whether + storageAccountAccessKey value is the storage's secondary key. + :type is_storage_secondary_key_in_use: bool + """ + + _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'}, + 'predicate_expression': {'key': 'properties.predicateExpression', 'type': 'str'}, + 'state': {'key': 'properties.state', 'type': 'BlobAuditingPolicyState'}, + 'storage_endpoint': {'key': 'properties.storageEndpoint', 'type': 'str'}, + 'storage_account_access_key': {'key': 'properties.storageAccountAccessKey', 'type': 'str'}, + 'retention_days': {'key': 'properties.retentionDays', 'type': 'int'}, + 'audit_actions_and_groups': {'key': 'properties.auditActionsAndGroups', 'type': '[str]'}, + 'storage_account_subscription_id': {'key': 'properties.storageAccountSubscriptionId', 'type': 'str'}, + 'is_storage_secondary_key_in_use': {'key': 'properties.isStorageSecondaryKeyInUse', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(ExtendedDatabaseBlobAuditingPolicy, self).__init__(**kwargs) + self.predicate_expression = kwargs.get('predicate_expression', None) + self.state = kwargs.get('state', 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.audit_actions_and_groups = kwargs.get('audit_actions_and_groups', None) + self.storage_account_subscription_id = kwargs.get('storage_account_subscription_id', None) + self.is_storage_secondary_key_in_use = kwargs.get('is_storage_secondary_key_in_use', None) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy_py3.py new file mode 100644 index 000000000000..ee5ce27523e1 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy_py3.py @@ -0,0 +1,146 @@ +# 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 ExtendedDatabaseBlobAuditingPolicy(ProxyResource): + """An extended database blob auditing 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 predicate_expression: Specifies condition of where clause when + creating an audit. + :type predicate_expression: str + :param state: Required. Specifies the state of the policy. If state is + Enabled, storageEndpoint and storageAccountAccessKey are required. + Possible values include: 'Enabled', 'Disabled' + :type state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState + :param storage_endpoint: Specifies the blob storage endpoint (e.g. + https://MyAccount.blob.core.windows.net). If state is Enabled, + storageEndpoint is required. + :type storage_endpoint: str + :param storage_account_access_key: Specifies the identifier key of the + auditing storage account. If state is Enabled, storageAccountAccessKey is + required. + :type storage_account_access_key: str + :param retention_days: Specifies the number of days to keep in the audit + logs. + :type retention_days: int + :param audit_actions_and_groups: Specifies the Actions-Groups and Actions + to audit. + The recommended set of action groups to use is the following combination - + this will audit all the queries and stored procedures executed against the + database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when + enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific + groups that cover your auditing needs. Using unnecessary groups could lead + to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures + executed against the database, and should not be used in combination with + other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action + Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note + that Actions cannot be specified for Server auditing policy). The + supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + ON BY + Note that in the above format can refer to an object like a + table, view, or stored procedure, or an entire database or schema. For the + latter cases, the forms DATABASE:: and SCHEMA:: are + used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit + Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) + :type audit_actions_and_groups: list[str] + :param storage_account_subscription_id: Specifies the blob storage + subscription Id. + :type storage_account_subscription_id: str + :param is_storage_secondary_key_in_use: Specifies whether + storageAccountAccessKey value is the storage's secondary key. + :type is_storage_secondary_key_in_use: bool + """ + + _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'}, + 'predicate_expression': {'key': 'properties.predicateExpression', 'type': 'str'}, + 'state': {'key': 'properties.state', 'type': 'BlobAuditingPolicyState'}, + 'storage_endpoint': {'key': 'properties.storageEndpoint', 'type': 'str'}, + 'storage_account_access_key': {'key': 'properties.storageAccountAccessKey', 'type': 'str'}, + 'retention_days': {'key': 'properties.retentionDays', 'type': 'int'}, + 'audit_actions_and_groups': {'key': 'properties.auditActionsAndGroups', 'type': '[str]'}, + 'storage_account_subscription_id': {'key': 'properties.storageAccountSubscriptionId', 'type': 'str'}, + 'is_storage_secondary_key_in_use': {'key': 'properties.isStorageSecondaryKeyInUse', 'type': 'bool'}, + } + + def __init__(self, *, state, predicate_expression: str=None, storage_endpoint: str=None, storage_account_access_key: str=None, retention_days: int=None, audit_actions_and_groups=None, storage_account_subscription_id: str=None, is_storage_secondary_key_in_use: bool=None, **kwargs) -> None: + super(ExtendedDatabaseBlobAuditingPolicy, self).__init__(**kwargs) + self.predicate_expression = predicate_expression + self.state = state + self.storage_endpoint = storage_endpoint + self.storage_account_access_key = storage_account_access_key + self.retention_days = retention_days + self.audit_actions_and_groups = audit_actions_and_groups + self.storage_account_subscription_id = storage_account_subscription_id + self.is_storage_secondary_key_in_use = is_storage_secondary_key_in_use diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy.py b/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy.py new file mode 100644 index 000000000000..a11e18ac68b1 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy.py @@ -0,0 +1,146 @@ +# 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 ExtendedServerBlobAuditingPolicy(ProxyResource): + """An extended server blob auditing 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 predicate_expression: Specifies condition of where clause when + creating an audit. + :type predicate_expression: str + :param state: Required. Specifies the state of the policy. If state is + Enabled, storageEndpoint and storageAccountAccessKey are required. + Possible values include: 'Enabled', 'Disabled' + :type state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState + :param storage_endpoint: Specifies the blob storage endpoint (e.g. + https://MyAccount.blob.core.windows.net). If state is Enabled, + storageEndpoint is required. + :type storage_endpoint: str + :param storage_account_access_key: Specifies the identifier key of the + auditing storage account. If state is Enabled, storageAccountAccessKey is + required. + :type storage_account_access_key: str + :param retention_days: Specifies the number of days to keep in the audit + logs. + :type retention_days: int + :param audit_actions_and_groups: Specifies the Actions-Groups and Actions + to audit. + The recommended set of action groups to use is the following combination - + this will audit all the queries and stored procedures executed against the + database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when + enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific + groups that cover your auditing needs. Using unnecessary groups could lead + to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures + executed against the database, and should not be used in combination with + other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action + Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note + that Actions cannot be specified for Server auditing policy). The + supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + ON BY + Note that in the above format can refer to an object like a + table, view, or stored procedure, or an entire database or schema. For the + latter cases, the forms DATABASE:: and SCHEMA:: are + used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit + Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) + :type audit_actions_and_groups: list[str] + :param storage_account_subscription_id: Specifies the blob storage + subscription Id. + :type storage_account_subscription_id: str + :param is_storage_secondary_key_in_use: Specifies whether + storageAccountAccessKey value is the storage's secondary key. + :type is_storage_secondary_key_in_use: bool + """ + + _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'}, + 'predicate_expression': {'key': 'properties.predicateExpression', 'type': 'str'}, + 'state': {'key': 'properties.state', 'type': 'BlobAuditingPolicyState'}, + 'storage_endpoint': {'key': 'properties.storageEndpoint', 'type': 'str'}, + 'storage_account_access_key': {'key': 'properties.storageAccountAccessKey', 'type': 'str'}, + 'retention_days': {'key': 'properties.retentionDays', 'type': 'int'}, + 'audit_actions_and_groups': {'key': 'properties.auditActionsAndGroups', 'type': '[str]'}, + 'storage_account_subscription_id': {'key': 'properties.storageAccountSubscriptionId', 'type': 'str'}, + 'is_storage_secondary_key_in_use': {'key': 'properties.isStorageSecondaryKeyInUse', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(ExtendedServerBlobAuditingPolicy, self).__init__(**kwargs) + self.predicate_expression = kwargs.get('predicate_expression', None) + self.state = kwargs.get('state', 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.audit_actions_and_groups = kwargs.get('audit_actions_and_groups', None) + self.storage_account_subscription_id = kwargs.get('storage_account_subscription_id', None) + self.is_storage_secondary_key_in_use = kwargs.get('is_storage_secondary_key_in_use', None) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy_py3.py new file mode 100644 index 000000000000..ac522801a8dd --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy_py3.py @@ -0,0 +1,146 @@ +# 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 ExtendedServerBlobAuditingPolicy(ProxyResource): + """An extended server blob auditing 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 predicate_expression: Specifies condition of where clause when + creating an audit. + :type predicate_expression: str + :param state: Required. Specifies the state of the policy. If state is + Enabled, storageEndpoint and storageAccountAccessKey are required. + Possible values include: 'Enabled', 'Disabled' + :type state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState + :param storage_endpoint: Specifies the blob storage endpoint (e.g. + https://MyAccount.blob.core.windows.net). If state is Enabled, + storageEndpoint is required. + :type storage_endpoint: str + :param storage_account_access_key: Specifies the identifier key of the + auditing storage account. If state is Enabled, storageAccountAccessKey is + required. + :type storage_account_access_key: str + :param retention_days: Specifies the number of days to keep in the audit + logs. + :type retention_days: int + :param audit_actions_and_groups: Specifies the Actions-Groups and Actions + to audit. + The recommended set of action groups to use is the following combination - + this will audit all the queries and stored procedures executed against the + database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when + enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific + groups that cover your auditing needs. Using unnecessary groups could lead + to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures + executed against the database, and should not be used in combination with + other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action + Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note + that Actions cannot be specified for Server auditing policy). The + supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + ON BY + Note that in the above format can refer to an object like a + table, view, or stored procedure, or an entire database or schema. For the + latter cases, the forms DATABASE:: and SCHEMA:: are + used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit + Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) + :type audit_actions_and_groups: list[str] + :param storage_account_subscription_id: Specifies the blob storage + subscription Id. + :type storage_account_subscription_id: str + :param is_storage_secondary_key_in_use: Specifies whether + storageAccountAccessKey value is the storage's secondary key. + :type is_storage_secondary_key_in_use: bool + """ + + _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'}, + 'predicate_expression': {'key': 'properties.predicateExpression', 'type': 'str'}, + 'state': {'key': 'properties.state', 'type': 'BlobAuditingPolicyState'}, + 'storage_endpoint': {'key': 'properties.storageEndpoint', 'type': 'str'}, + 'storage_account_access_key': {'key': 'properties.storageAccountAccessKey', 'type': 'str'}, + 'retention_days': {'key': 'properties.retentionDays', 'type': 'int'}, + 'audit_actions_and_groups': {'key': 'properties.auditActionsAndGroups', 'type': '[str]'}, + 'storage_account_subscription_id': {'key': 'properties.storageAccountSubscriptionId', 'type': 'str'}, + 'is_storage_secondary_key_in_use': {'key': 'properties.isStorageSecondaryKeyInUse', 'type': 'bool'}, + } + + def __init__(self, *, state, predicate_expression: str=None, storage_endpoint: str=None, storage_account_access_key: str=None, retention_days: int=None, audit_actions_and_groups=None, storage_account_subscription_id: str=None, is_storage_secondary_key_in_use: bool=None, **kwargs) -> None: + super(ExtendedServerBlobAuditingPolicy, self).__init__(**kwargs) + self.predicate_expression = predicate_expression + self.state = state + self.storage_endpoint = storage_endpoint + self.storage_account_access_key = storage_account_access_key + self.retention_days = retention_days + self.audit_actions_and_groups = audit_actions_and_groups + self.storage_account_subscription_id = storage_account_subscription_id + self.is_storage_secondary_key_in_use = is_storage_secondary_key_in_use diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label.py b/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label.py new file mode 100644 index 000000000000..27d34d57c142 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .proxy_resource import ProxyResource + + +class SensitivityLabel(ProxyResource): + """A sensitivity label. + + 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 label_name: The label name. + :type label_name: str + :param information_type: The information type. + :type information_type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'label_name': {'key': 'properties.labelName', 'type': 'str'}, + 'information_type': {'key': 'properties.informationType', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SensitivityLabel, self).__init__(**kwargs) + self.label_name = kwargs.get('label_name', None) + self.information_type = kwargs.get('information_type', None) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label_paged.py new file mode 100644 index 000000000000..438bfd86f9be --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label_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 SensitivityLabelPaged(Paged): + """ + A paging container for iterating over a list of :class:`SensitivityLabel ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[SensitivityLabel]'} + } + + def __init__(self, *args, **kwargs): + + super(SensitivityLabelPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label_py3.py new file mode 100644 index 000000000000..adbb7a203e1a --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label_py3.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .proxy_resource_py3 import ProxyResource + + +class SensitivityLabel(ProxyResource): + """A sensitivity label. + + 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 label_name: The label name. + :type label_name: str + :param information_type: The information type. + :type information_type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'label_name': {'key': 'properties.labelName', 'type': 'str'}, + 'information_type': {'key': 'properties.informationType', 'type': 'str'}, + } + + def __init__(self, *, label_name: str=None, information_type: str=None, **kwargs) -> None: + super(SensitivityLabel, self).__init__(**kwargs) + self.label_name = label_name + self.information_type = information_type diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy.py new file mode 100644 index 000000000000..0232582a4237 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy.py @@ -0,0 +1,141 @@ +# 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 ServerBlobAuditingPolicy(ProxyResource): + """A server blob auditing 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. If state is + Enabled, storageEndpoint and storageAccountAccessKey are required. + Possible values include: 'Enabled', 'Disabled' + :type state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState + :param storage_endpoint: Specifies the blob storage endpoint (e.g. + https://MyAccount.blob.core.windows.net). If state is Enabled, + storageEndpoint is required. + :type storage_endpoint: str + :param storage_account_access_key: Specifies the identifier key of the + auditing storage account. If state is Enabled, storageAccountAccessKey is + required. + :type storage_account_access_key: str + :param retention_days: Specifies the number of days to keep in the audit + logs. + :type retention_days: int + :param audit_actions_and_groups: Specifies the Actions-Groups and Actions + to audit. + The recommended set of action groups to use is the following combination - + this will audit all the queries and stored procedures executed against the + database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when + enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific + groups that cover your auditing needs. Using unnecessary groups could lead + to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures + executed against the database, and should not be used in combination with + other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action + Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note + that Actions cannot be specified for Server auditing policy). The + supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + ON BY + Note that in the above format can refer to an object like a + table, view, or stored procedure, or an entire database or schema. For the + latter cases, the forms DATABASE:: and SCHEMA:: are + used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit + Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) + :type audit_actions_and_groups: list[str] + :param storage_account_subscription_id: Specifies the blob storage + subscription Id. + :type storage_account_subscription_id: str + :param is_storage_secondary_key_in_use: Specifies whether + storageAccountAccessKey value is the storage's secondary key. + :type is_storage_secondary_key_in_use: bool + """ + + _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': 'BlobAuditingPolicyState'}, + 'storage_endpoint': {'key': 'properties.storageEndpoint', 'type': 'str'}, + 'storage_account_access_key': {'key': 'properties.storageAccountAccessKey', 'type': 'str'}, + 'retention_days': {'key': 'properties.retentionDays', 'type': 'int'}, + 'audit_actions_and_groups': {'key': 'properties.auditActionsAndGroups', 'type': '[str]'}, + 'storage_account_subscription_id': {'key': 'properties.storageAccountSubscriptionId', 'type': 'str'}, + 'is_storage_secondary_key_in_use': {'key': 'properties.isStorageSecondaryKeyInUse', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(ServerBlobAuditingPolicy, self).__init__(**kwargs) + self.state = kwargs.get('state', 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.audit_actions_and_groups = kwargs.get('audit_actions_and_groups', None) + self.storage_account_subscription_id = kwargs.get('storage_account_subscription_id', None) + self.is_storage_secondary_key_in_use = kwargs.get('is_storage_secondary_key_in_use', None) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy_py3.py new file mode 100644 index 000000000000..51dcc8c41d4c --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy_py3.py @@ -0,0 +1,141 @@ +# 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 ServerBlobAuditingPolicy(ProxyResource): + """A server blob auditing 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. If state is + Enabled, storageEndpoint and storageAccountAccessKey are required. + Possible values include: 'Enabled', 'Disabled' + :type state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState + :param storage_endpoint: Specifies the blob storage endpoint (e.g. + https://MyAccount.blob.core.windows.net). If state is Enabled, + storageEndpoint is required. + :type storage_endpoint: str + :param storage_account_access_key: Specifies the identifier key of the + auditing storage account. If state is Enabled, storageAccountAccessKey is + required. + :type storage_account_access_key: str + :param retention_days: Specifies the number of days to keep in the audit + logs. + :type retention_days: int + :param audit_actions_and_groups: Specifies the Actions-Groups and Actions + to audit. + The recommended set of action groups to use is the following combination - + this will audit all the queries and stored procedures executed against the + database, as well as successful and failed logins: + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + This above combination is also the set that is configured by default when + enabling auditing from the Azure portal. + The supported action groups to audit are (note: choose only specific + groups that cover your auditing needs. Using unnecessary groups could lead + to very large quantities of audit records): + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + These are groups that cover all sql statements and stored procedures + executed against the database, and should not be used in combination with + other groups as this will result in duplicate audit logs. + For more information, see [Database-Level Audit Action + Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + For Database auditing policy, specific Actions can also be specified (note + that Actions cannot be specified for Server auditing policy). The + supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + The general form for defining an action to be audited is: + ON BY + Note that in the above format can refer to an object like a + table, view, or stored procedure, or an entire database or schema. For the + latter cases, the forms DATABASE:: and SCHEMA:: are + used, respectively. + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + For more information, see [Database-Level Audit + Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) + :type audit_actions_and_groups: list[str] + :param storage_account_subscription_id: Specifies the blob storage + subscription Id. + :type storage_account_subscription_id: str + :param is_storage_secondary_key_in_use: Specifies whether + storageAccountAccessKey value is the storage's secondary key. + :type is_storage_secondary_key_in_use: bool + """ + + _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': 'BlobAuditingPolicyState'}, + 'storage_endpoint': {'key': 'properties.storageEndpoint', 'type': 'str'}, + 'storage_account_access_key': {'key': 'properties.storageAccountAccessKey', 'type': 'str'}, + 'retention_days': {'key': 'properties.retentionDays', 'type': 'int'}, + 'audit_actions_and_groups': {'key': 'properties.auditActionsAndGroups', 'type': '[str]'}, + 'storage_account_subscription_id': {'key': 'properties.storageAccountSubscriptionId', 'type': 'str'}, + 'is_storage_secondary_key_in_use': {'key': 'properties.isStorageSecondaryKeyInUse', 'type': 'bool'}, + } + + def __init__(self, *, state, storage_endpoint: str=None, storage_account_access_key: str=None, retention_days: int=None, audit_actions_and_groups=None, storage_account_subscription_id: str=None, is_storage_secondary_key_in_use: bool=None, **kwargs) -> None: + super(ServerBlobAuditingPolicy, self).__init__(**kwargs) + self.state = state + self.storage_endpoint = storage_endpoint + self.storage_account_access_key = storage_account_access_key + self.retention_days = retention_days + self.audit_actions_and_groups = audit_actions_and_groups + self.storage_account_subscription_id = storage_account_subscription_id + self.is_storage_secondary_key_in_use = is_storage_secondary_key_in_use diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy.py new file mode 100644 index 000000000000..4e5d69dbcd27 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy.py @@ -0,0 +1,82 @@ +# 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: 'New', 'Enabled', 'Disabled' + :type state: str or ~azure.mgmt.sql.models.SecurityAlertPolicyState + :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': 'SecurityAlertPolicyState'}, + '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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy_py3.py new file mode 100644 index 000000000000..2a65b5d19078 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy_py3.py @@ -0,0 +1,82 @@ +# 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: 'New', 'Enabled', 'Disabled' + :type state: str or ~azure.mgmt.sql.models.SecurityAlertPolicyState + :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': 'SecurityAlertPolicyState'}, + '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 diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py b/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py index e4a76e0f84e5..325c2d06c5da 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py @@ -264,12 +264,6 @@ class TransparentDataEncryptionActivityStatus(str, Enum): decrypting = "Decrypting" -class BlobAuditingPolicyState(str, Enum): - - enabled = "Enabled" - disabled = "Disabled" - - class AutomaticTuningMode(str, Enum): inherit = "Inherit" @@ -411,6 +405,12 @@ class VirtualNetworkRuleState(str, Enum): unknown = "Unknown" +class BlobAuditingPolicyState(str, Enum): + + enabled = "Enabled" + disabled = "Disabled" + + class JobAgentState(str, Enum): creating = "Creating" @@ -657,6 +657,18 @@ class LongTermRetentionDatabaseState(str, Enum): deleted = "Deleted" +class VulnerabilityAssessmentPolicyBaselineName(str, Enum): + + master = "master" + default = "default" + + +class SensitivityLabelSource(str, Enum): + + current = "current" + recommended = "recommended" + + class CapabilityGroup(str, Enum): supported_editions = "supportedEditions" diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py index ca19b385ece2..538af4811eb3 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py @@ -32,7 +32,6 @@ from .transparent_data_encryption_activities_operations import TransparentDataEncryptionActivitiesOperations from .server_usages_operations import ServerUsagesOperations from .database_usages_operations import DatabaseUsagesOperations -from .database_blob_auditing_policies_operations import DatabaseBlobAuditingPoliciesOperations from .database_automatic_tuning_operations import DatabaseAutomaticTuningOperations from .encryption_protectors_operations import EncryptionProtectorsOperations from .failover_groups_operations import FailoverGroupsOperations @@ -44,6 +43,10 @@ from .sync_members_operations import SyncMembersOperations from .subscription_usages_operations import SubscriptionUsagesOperations from .virtual_network_rules_operations import VirtualNetworkRulesOperations +from .extended_database_blob_auditing_policies_operations import ExtendedDatabaseBlobAuditingPoliciesOperations +from .extended_server_blob_auditing_policies_operations import ExtendedServerBlobAuditingPoliciesOperations +from .server_blob_auditing_policies_operations import ServerBlobAuditingPoliciesOperations +from .database_blob_auditing_policies_operations import DatabaseBlobAuditingPoliciesOperations from .database_vulnerability_assessment_rule_baselines_operations import DatabaseVulnerabilityAssessmentRuleBaselinesOperations from .database_vulnerability_assessments_operations import DatabaseVulnerabilityAssessmentsOperations from .job_agents_operations import JobAgentsOperations @@ -58,8 +61,10 @@ from .long_term_retention_backups_operations import LongTermRetentionBackupsOperations from .backup_long_term_retention_policies_operations import BackupLongTermRetentionPoliciesOperations from .managed_databases_operations import ManagedDatabasesOperations +from .sensitivity_labels_operations import SensitivityLabelsOperations from .server_automatic_tuning_operations import ServerAutomaticTuningOperations from .server_dns_aliases_operations import ServerDnsAliasesOperations +from .server_security_alert_policies_operations import ServerSecurityAlertPoliciesOperations from .restore_points_operations import RestorePointsOperations from .database_operations import DatabaseOperations from .elastic_pool_operations import ElasticPoolOperations @@ -94,7 +99,6 @@ 'TransparentDataEncryptionActivitiesOperations', 'ServerUsagesOperations', 'DatabaseUsagesOperations', - 'DatabaseBlobAuditingPoliciesOperations', 'DatabaseAutomaticTuningOperations', 'EncryptionProtectorsOperations', 'FailoverGroupsOperations', @@ -106,6 +110,10 @@ 'SyncMembersOperations', 'SubscriptionUsagesOperations', 'VirtualNetworkRulesOperations', + 'ExtendedDatabaseBlobAuditingPoliciesOperations', + 'ExtendedServerBlobAuditingPoliciesOperations', + 'ServerBlobAuditingPoliciesOperations', + 'DatabaseBlobAuditingPoliciesOperations', 'DatabaseVulnerabilityAssessmentRuleBaselinesOperations', 'DatabaseVulnerabilityAssessmentsOperations', 'JobAgentsOperations', @@ -120,8 +128,10 @@ 'LongTermRetentionBackupsOperations', 'BackupLongTermRetentionPoliciesOperations', 'ManagedDatabasesOperations', + 'SensitivityLabelsOperations', 'ServerAutomaticTuningOperations', 'ServerDnsAliasesOperations', + 'ServerSecurityAlertPoliciesOperations', 'RestorePointsOperations', 'DatabaseOperations', 'ElasticPoolOperations', diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/backup_short_term_retention_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/backup_short_term_retention_policies_operations.py index e50f15c2a997..ce01d24f68c7 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/backup_short_term_retention_policies_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/backup_short_term_retention_policies_operations.py @@ -331,3 +331,79 @@ def get_long_running_output(response): else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}'} + + def list_by_database( + self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets a database's short term retention policy. + + :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 database_name: The name of the database. + :type database_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 BackupShortTermRetentionPolicy + :rtype: + ~azure.mgmt.sql.models.BackupShortTermRetentionPolicyPaged[~azure.mgmt.sql.models.BackupShortTermRetentionPolicy] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_database.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'), + 'databaseName': self._serialize.url("database_name", database_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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, 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.BackupShortTermRetentionPolicyPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.BackupShortTermRetentionPolicyPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/database_blob_auditing_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/database_blob_auditing_policies_operations.py index fa915bf7c00d..425ace0b8cc3 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/database_blob_auditing_policies_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/database_blob_auditing_policies_operations.py @@ -24,7 +24,7 @@ class DatabaseBlobAuditingPoliciesOperations(object): :param serializer: An object model serializer. :param deserializer: An object model deserializer. :ivar blob_auditing_policy_name: The name of the blob auditing policy. Constant value: "default". - :ivar api_version: The API version to use for the request. Constant value: "2015-05-01-preview". + :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". """ models = models @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._serialize = serializer self._deserialize = deserializer self.blob_auditing_policy_name = "default" - self.api_version = "2015-05-01-preview" + self.api_version = "2017-03-01-preview" self.config = config @@ -49,8 +49,7 @@ def get( :type resource_group_name: str :param server_name: The name of the server. :type server_name: str - :param database_name: The name of the database for which the blob - audit policy is defined. + :param database_name: The name of the database. :type database_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the @@ -118,8 +117,7 @@ def create_or_update( :type resource_group_name: str :param server_name: The name of the server. :type server_name: str - :param database_name: The name of the database for which the blob - auditing policy will be defined. + :param database_name: The name of the database. :type database_name: str :param parameters: The database blob auditing policy. :type parameters: ~azure.mgmt.sql.models.DatabaseBlobAuditingPolicy diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/database_vulnerability_assessment_rule_baselines_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/database_vulnerability_assessment_rule_baselines_operations.py index 16a909e27a1a..558ad0135821 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/database_vulnerability_assessment_rule_baselines_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/database_vulnerability_assessment_rule_baselines_operations.py @@ -24,7 +24,6 @@ class DatabaseVulnerabilityAssessmentRuleBaselinesOperations(object): :param serializer: An object model serializer. :param deserializer: An object model deserializer. :ivar vulnerability_assessment_name: The name of the vulnerability assessment. Constant value: "default". - :ivar baseline_name: The name of the vulnerability assessment rule baseline. Constant value: "default". :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". """ @@ -36,13 +35,12 @@ def __init__(self, client, config, serializer, deserializer): self._serialize = serializer self._deserialize = deserializer self.vulnerability_assessment_name = "default" - self.baseline_name = "default" self.api_version = "2017-03-01-preview" self.config = config def get( - self, resource_group_name, server_name, database_name, rule_id, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, server_name, database_name, rule_id, baseline_name, custom_headers=None, raw=False, **operation_config): """Gets a database's vulnerability assessment rule baseline. :param resource_group_name: The name of the resource group that @@ -56,6 +54,12 @@ def get( :type database_name: str :param rule_id: The vulnerability assessment rule ID. :type rule_id: str + :param baseline_name: The name of the vulnerability assessment rule + baseline (default implies a baseline on a database level rule and + master for server level rule). Possible values include: 'master', + 'default' + :type baseline_name: str or + ~azure.mgmt.sql.models.VulnerabilityAssessmentPolicyBaselineName :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -76,7 +80,7 @@ def get( 'databaseName': self._serialize.url("database_name", database_name, 'str'), 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_name, 'str'), 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), - 'baselineName': self._serialize.url("self.baseline_name", self.baseline_name, 'str'), + 'baselineName': self._serialize.url("baseline_name", baseline_name, 'VulnerabilityAssessmentPolicyBaselineName'), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -117,7 +121,7 @@ def get( get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}'} def create_or_update( - self, resource_group_name, server_name, database_name, rule_id, baseline_results, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, server_name, database_name, rule_id, baseline_name, baseline_results, custom_headers=None, raw=False, **operation_config): """Creates or updates a database's vulnerability assessment rule baseline. :param resource_group_name: The name of the resource group that @@ -131,6 +135,12 @@ def create_or_update( :type database_name: str :param rule_id: The vulnerability assessment rule ID. :type rule_id: str + :param baseline_name: The name of the vulnerability assessment rule + baseline (default implies a baseline on a database level rule and + master for server level rule). Possible values include: 'master', + 'default' + :type baseline_name: str or + ~azure.mgmt.sql.models.VulnerabilityAssessmentPolicyBaselineName :param baseline_results: The rule baseline result :type baseline_results: list[~azure.mgmt.sql.models.DatabaseVulnerabilityAssessmentRuleBaselineItem] @@ -156,7 +166,7 @@ def create_or_update( 'databaseName': self._serialize.url("database_name", database_name, 'str'), 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_name, 'str'), 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), - 'baselineName': self._serialize.url("self.baseline_name", self.baseline_name, 'str'), + 'baselineName': self._serialize.url("baseline_name", baseline_name, 'VulnerabilityAssessmentPolicyBaselineName'), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -201,7 +211,7 @@ def create_or_update( create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}'} def delete( - self, resource_group_name, server_name, database_name, rule_id, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, server_name, database_name, rule_id, baseline_name, custom_headers=None, raw=False, **operation_config): """Removes the database's vulnerability assessment rule baseline. :param resource_group_name: The name of the resource group that @@ -215,6 +225,12 @@ def delete( :type database_name: str :param rule_id: The vulnerability assessment rule ID. :type rule_id: str + :param baseline_name: The name of the vulnerability assessment rule + baseline (default implies a baseline on a database level rule and + master for server level rule). Possible values include: 'master', + 'default' + :type baseline_name: str or + ~azure.mgmt.sql.models.VulnerabilityAssessmentPolicyBaselineName :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -232,7 +248,7 @@ def delete( 'databaseName': self._serialize.url("database_name", database_name, 'str'), 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_name, 'str'), 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), - 'baselineName': self._serialize.url("self.baseline_name", self.baseline_name, 'str'), + 'baselineName': self._serialize.url("baseline_name", baseline_name, 'VulnerabilityAssessmentPolicyBaselineName'), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/extended_database_blob_auditing_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/extended_database_blob_auditing_policies_operations.py new file mode 100644 index 000000000000..73ff8454c8b5 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/extended_database_blob_auditing_policies_operations.py @@ -0,0 +1,187 @@ +# 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 .. import models + + +class ExtendedDatabaseBlobAuditingPoliciesOperations(object): + """ExtendedDatabaseBlobAuditingPoliciesOperations 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 blob_auditing_policy_name: The name of the blob auditing policy. Constant value: "default". + :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.blob_auditing_policy_name = "default" + self.api_version = "2017-03-01-preview" + + self.config = config + + def get( + self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets an extended database's blob auditing policy. + + :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 database_name: The name of the database. + :type database_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: ExtendedDatabaseBlobAuditingPolicy or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.sql.models.ExtendedDatabaseBlobAuditingPolicy 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'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'blobAuditingPolicyName': self._serialize.url("self.blob_auditing_policy_name", self.blob_auditing_policy_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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, 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('ExtendedDatabaseBlobAuditingPolicy', 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}/databases/{databaseName}/extendedAuditingSettings/{blobAuditingPolicyName}'} + + def create_or_update( + self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates an extended database's blob auditing policy. + + :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 database_name: The name of the database. + :type database_name: str + :param parameters: The extended database blob auditing policy. + :type parameters: + ~azure.mgmt.sql.models.ExtendedDatabaseBlobAuditingPolicy + :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: ExtendedDatabaseBlobAuditingPolicy or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.sql.models.ExtendedDatabaseBlobAuditingPolicy or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # 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'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'blobAuditingPolicyName': self._serialize.url("self.blob_auditing_policy_name", self.blob_auditing_policy_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['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, 'ExtendedDatabaseBlobAuditingPolicy') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + 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('ExtendedDatabaseBlobAuditingPolicy', response) + if response.status_code == 201: + deserialized = self._deserialize('ExtendedDatabaseBlobAuditingPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extendedAuditingSettings/{blobAuditingPolicyName}'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/extended_server_blob_auditing_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/extended_server_blob_auditing_policies_operations.py new file mode 100644 index 000000000000..02830132aa3f --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/extended_server_blob_auditing_policies_operations.py @@ -0,0 +1,213 @@ +# 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 ExtendedServerBlobAuditingPoliciesOperations(object): + """ExtendedServerBlobAuditingPoliciesOperations 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 blob_auditing_policy_name: The name of the blob auditing policy. Constant value: "default". + :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.blob_auditing_policy_name = "default" + self.api_version = "2017-03-01-preview" + + self.config = config + + def get( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + """Gets an extended server's blob auditing policy. + + :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: ExtendedServerBlobAuditingPolicy or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.sql.models.ExtendedServerBlobAuditingPolicy 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'), + 'blobAuditingPolicyName': self._serialize.url("self.blob_auditing_policy_name", self.blob_auditing_policy_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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, 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('ExtendedServerBlobAuditingPolicy', 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}/extendedAuditingSettings/{blobAuditingPolicyName}'} + + + def _create_or_update_initial( + 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 = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'blobAuditingPolicyName': self._serialize.url("self.blob_auditing_policy_name", self.blob_auditing_policy_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['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, 'ExtendedServerBlobAuditingPolicy') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, 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('ExtendedServerBlobAuditingPolicy', 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, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates or updates an extended server's blob auditing policy. + + :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 parameters: Properties of extended blob auditing policy + :type parameters: + ~azure.mgmt.sql.models.ExtendedServerBlobAuditingPolicy + :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 + ExtendedServerBlobAuditingPolicy or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ExtendedServerBlobAuditingPolicy] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.sql.models.ExtendedServerBlobAuditingPolicy]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ExtendedServerBlobAuditingPolicy', 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}/extendedAuditingSettings/{blobAuditingPolicyName}'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/sensitivity_labels_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/sensitivity_labels_operations.py new file mode 100644 index 000000000000..656ef40de187 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/sensitivity_labels_operations.py @@ -0,0 +1,360 @@ +# 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 .. import models + + +class SensitivityLabelsOperations(object): + """SensitivityLabelsOperations 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: "2017-03-01-preview". + :ivar sensitivity_label_source: The source of the sensitivity label. Constant value: "current". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-03-01-preview" + self.sensitivity_label_source = "current" + + self.config = config + + def list_by_database( + self, resource_group_name, server_name, database_name, filter=None, custom_headers=None, raw=False, **operation_config): + """Gets the sensitivity labels of a given database. + + :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 database_name: The name of the database. + :type database_name: str + :param filter: An OData filter expression that filters elements in the + collection. + :type filter: 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 SensitivityLabel + :rtype: + ~azure.mgmt.sql.models.SensitivityLabelPaged[~azure.mgmt.sql.models.SensitivityLabel] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_database.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'), + 'databaseName': self._serialize.url("database_name", database_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 = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + 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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, 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.SensitivityLabelPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.SensitivityLabelPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sensitivityLabels'} + + def get( + self, resource_group_name, server_name, database_name, schema_name, table_name, column_name, sensitivity_label_source, custom_headers=None, raw=False, **operation_config): + """Gets the sensitivity label of a given column. + + :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 database_name: The name of the database. + :type database_name: str + :param schema_name: The name of the schema. + :type schema_name: str + :param table_name: The name of the table. + :type table_name: str + :param column_name: The name of the column. + :type column_name: str + :param sensitivity_label_source: The source of the sensitivity label. + Possible values include: 'current', 'recommended' + :type sensitivity_label_source: str or + ~azure.mgmt.sql.models.SensitivityLabelSource + :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: SensitivityLabel or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.SensitivityLabel 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'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + 'columnName': self._serialize.url("column_name", column_name, 'str'), + 'sensitivityLabelSource': self._serialize.url("sensitivity_label_source", sensitivity_label_source, 'SensitivityLabelSource'), + '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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, 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('SensitivityLabel', 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}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}'} + + def create_or_update( + self, resource_group_name, server_name, database_name, schema_name, table_name, column_name, label_name=None, information_type=None, custom_headers=None, raw=False, **operation_config): + """Creates or updates the sensitivity label of a given column. + + :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 database_name: The name of the database. + :type database_name: str + :param schema_name: The name of the schema. + :type schema_name: str + :param table_name: The name of the table. + :type table_name: str + :param column_name: The name of the column. + :type column_name: str + :param label_name: The label name. + :type label_name: str + :param information_type: The information type. + :type information_type: 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: SensitivityLabel or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.SensitivityLabel or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + parameters = models.SensitivityLabel(label_name=label_name, information_type=information_type) + + # 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'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + 'columnName': self._serialize.url("column_name", column_name, 'str'), + 'sensitivityLabelSource': self._serialize.url("self.sensitivity_label_source", self.sensitivity_label_source, '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['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, 'SensitivityLabel') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + 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('SensitivityLabel', response) + if response.status_code == 201: + deserialized = self._deserialize('SensitivityLabel', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}'} + + def delete( + self, resource_group_name, server_name, database_name, schema_name, table_name, column_name, custom_headers=None, raw=False, **operation_config): + """Deletes the sensitivity label of a given column. + + :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 database_name: The name of the database. + :type database_name: str + :param schema_name: The name of the schema. + :type schema_name: str + :param table_name: The name of the table. + :type table_name: str + :param column_name: The name of the column. + :type column_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: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # 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'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + 'columnName': self._serialize.url("column_name", column_name, 'str'), + 'sensitivityLabelSource': self._serialize.url("self.sensitivity_label_source", self.sensitivity_label_source, '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['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 and send request + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, 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 + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/server_blob_auditing_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/server_blob_auditing_policies_operations.py new file mode 100644 index 000000000000..ae38710656f9 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/server_blob_auditing_policies_operations.py @@ -0,0 +1,211 @@ +# 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 ServerBlobAuditingPoliciesOperations(object): + """ServerBlobAuditingPoliciesOperations 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 blob_auditing_policy_name: The name of the blob auditing policy. Constant value: "default". + :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.blob_auditing_policy_name = "default" + self.api_version = "2017-03-01-preview" + + self.config = config + + def get( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + """Gets a server's blob auditing policy. + + :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: ServerBlobAuditingPolicy or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.ServerBlobAuditingPolicy 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'), + 'blobAuditingPolicyName': self._serialize.url("self.blob_auditing_policy_name", self.blob_auditing_policy_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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, 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('ServerBlobAuditingPolicy', 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}/auditingSettings/{blobAuditingPolicyName}'} + + + def _create_or_update_initial( + 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 = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'blobAuditingPolicyName': self._serialize.url("self.blob_auditing_policy_name", self.blob_auditing_policy_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['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, 'ServerBlobAuditingPolicy') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, 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('ServerBlobAuditingPolicy', 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, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates or updates a server's blob auditing policy. + + :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 parameters: Properties of blob auditing policy + :type parameters: ~azure.mgmt.sql.models.ServerBlobAuditingPolicy + :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 + ServerBlobAuditingPolicy or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ServerBlobAuditingPolicy] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.sql.models.ServerBlobAuditingPolicy]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ServerBlobAuditingPolicy', 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}/auditingSettings/{blobAuditingPolicyName}'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/server_security_alert_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/server_security_alert_policies_operations.py new file mode 100644 index 000000000000..ddbd335574b4 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/server_security_alert_policies_operations.py @@ -0,0 +1,211 @@ +# 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 ServerSecurityAlertPoliciesOperations(object): + """ServerSecurityAlertPoliciesOperations 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 security_alert_policy_name: The name of the security alert policy. Constant value: "Default". + :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.security_alert_policy_name = "Default" + self.api_version = "2017-03-01-preview" + + self.config = config + + def get( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + """Get a server's security alert policy. + + :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: ServerSecurityAlertPolicy or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.ServerSecurityAlertPolicy 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'), + 'securityAlertPolicyName': self._serialize.url("self.security_alert_policy_name", self.security_alert_policy_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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, 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('ServerSecurityAlertPolicy', 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}/securityAlertPolicies/{securityAlertPolicyName}'} + + + def _create_or_update_initial( + 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 = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'securityAlertPolicyName': self._serialize.url("self.security_alert_policy_name", self.security_alert_policy_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['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, 'ServerSecurityAlertPolicy') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, 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('ServerSecurityAlertPolicy', 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, 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 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 parameters: The server security alert policy. + :type parameters: ~azure.mgmt.sql.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 + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + ServerSecurityAlertPolicy or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ServerSecurityAlertPolicy] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.sql.models.ServerSecurityAlertPolicy]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ServerSecurityAlertPolicy', 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}/securityAlertPolicies/{securityAlertPolicyName}'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py index defe2f7f99eb..b1ff7e733b52 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py +++ b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py @@ -36,7 +36,6 @@ from .operations.transparent_data_encryption_activities_operations import TransparentDataEncryptionActivitiesOperations from .operations.server_usages_operations import ServerUsagesOperations from .operations.database_usages_operations import DatabaseUsagesOperations -from .operations.database_blob_auditing_policies_operations import DatabaseBlobAuditingPoliciesOperations from .operations.database_automatic_tuning_operations import DatabaseAutomaticTuningOperations from .operations.encryption_protectors_operations import EncryptionProtectorsOperations from .operations.failover_groups_operations import FailoverGroupsOperations @@ -48,6 +47,10 @@ from .operations.sync_members_operations import SyncMembersOperations from .operations.subscription_usages_operations import SubscriptionUsagesOperations from .operations.virtual_network_rules_operations import VirtualNetworkRulesOperations +from .operations.extended_database_blob_auditing_policies_operations import ExtendedDatabaseBlobAuditingPoliciesOperations +from .operations.extended_server_blob_auditing_policies_operations import ExtendedServerBlobAuditingPoliciesOperations +from .operations.server_blob_auditing_policies_operations import ServerBlobAuditingPoliciesOperations +from .operations.database_blob_auditing_policies_operations import DatabaseBlobAuditingPoliciesOperations from .operations.database_vulnerability_assessment_rule_baselines_operations import DatabaseVulnerabilityAssessmentRuleBaselinesOperations from .operations.database_vulnerability_assessments_operations import DatabaseVulnerabilityAssessmentsOperations from .operations.job_agents_operations import JobAgentsOperations @@ -62,8 +65,10 @@ from .operations.long_term_retention_backups_operations import LongTermRetentionBackupsOperations from .operations.backup_long_term_retention_policies_operations import BackupLongTermRetentionPoliciesOperations from .operations.managed_databases_operations import ManagedDatabasesOperations +from .operations.sensitivity_labels_operations import SensitivityLabelsOperations from .operations.server_automatic_tuning_operations import ServerAutomaticTuningOperations from .operations.server_dns_aliases_operations import ServerDnsAliasesOperations +from .operations.server_security_alert_policies_operations import ServerSecurityAlertPoliciesOperations from .operations.restore_points_operations import RestorePointsOperations from .operations.database_operations import DatabaseOperations from .operations.elastic_pool_operations import ElasticPoolOperations @@ -161,8 +166,6 @@ class SqlManagementClient(SDKClient): :vartype server_usages: azure.mgmt.sql.operations.ServerUsagesOperations :ivar database_usages: DatabaseUsages operations :vartype database_usages: azure.mgmt.sql.operations.DatabaseUsagesOperations - :ivar database_blob_auditing_policies: DatabaseBlobAuditingPolicies operations - :vartype database_blob_auditing_policies: azure.mgmt.sql.operations.DatabaseBlobAuditingPoliciesOperations :ivar database_automatic_tuning: DatabaseAutomaticTuning operations :vartype database_automatic_tuning: azure.mgmt.sql.operations.DatabaseAutomaticTuningOperations :ivar encryption_protectors: EncryptionProtectors operations @@ -185,6 +188,14 @@ class SqlManagementClient(SDKClient): :vartype subscription_usages: azure.mgmt.sql.operations.SubscriptionUsagesOperations :ivar virtual_network_rules: VirtualNetworkRules operations :vartype virtual_network_rules: azure.mgmt.sql.operations.VirtualNetworkRulesOperations + :ivar extended_database_blob_auditing_policies: ExtendedDatabaseBlobAuditingPolicies operations + :vartype extended_database_blob_auditing_policies: azure.mgmt.sql.operations.ExtendedDatabaseBlobAuditingPoliciesOperations + :ivar extended_server_blob_auditing_policies: ExtendedServerBlobAuditingPolicies operations + :vartype extended_server_blob_auditing_policies: azure.mgmt.sql.operations.ExtendedServerBlobAuditingPoliciesOperations + :ivar server_blob_auditing_policies: ServerBlobAuditingPolicies operations + :vartype server_blob_auditing_policies: azure.mgmt.sql.operations.ServerBlobAuditingPoliciesOperations + :ivar database_blob_auditing_policies: DatabaseBlobAuditingPolicies operations + :vartype database_blob_auditing_policies: azure.mgmt.sql.operations.DatabaseBlobAuditingPoliciesOperations :ivar database_vulnerability_assessment_rule_baselines: DatabaseVulnerabilityAssessmentRuleBaselines operations :vartype database_vulnerability_assessment_rule_baselines: azure.mgmt.sql.operations.DatabaseVulnerabilityAssessmentRuleBaselinesOperations :ivar database_vulnerability_assessments: DatabaseVulnerabilityAssessments operations @@ -213,10 +224,14 @@ class SqlManagementClient(SDKClient): :vartype backup_long_term_retention_policies: azure.mgmt.sql.operations.BackupLongTermRetentionPoliciesOperations :ivar managed_databases: ManagedDatabases operations :vartype managed_databases: azure.mgmt.sql.operations.ManagedDatabasesOperations + :ivar sensitivity_labels: SensitivityLabels operations + :vartype sensitivity_labels: azure.mgmt.sql.operations.SensitivityLabelsOperations :ivar server_automatic_tuning: ServerAutomaticTuning operations :vartype server_automatic_tuning: azure.mgmt.sql.operations.ServerAutomaticTuningOperations :ivar server_dns_aliases: ServerDnsAliases operations :vartype server_dns_aliases: azure.mgmt.sql.operations.ServerDnsAliasesOperations + :ivar server_security_alert_policies: ServerSecurityAlertPolicies operations + :vartype server_security_alert_policies: azure.mgmt.sql.operations.ServerSecurityAlertPoliciesOperations :ivar restore_points: RestorePoints operations :vartype restore_points: azure.mgmt.sql.operations.RestorePointsOperations :ivar database_operations: DatabaseOperations operations @@ -301,8 +316,6 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.database_usages = DatabaseUsagesOperations( self._client, self.config, self._serialize, self._deserialize) - self.database_blob_auditing_policies = DatabaseBlobAuditingPoliciesOperations( - self._client, self.config, self._serialize, self._deserialize) self.database_automatic_tuning = DatabaseAutomaticTuningOperations( self._client, self.config, self._serialize, self._deserialize) self.encryption_protectors = EncryptionProtectorsOperations( @@ -325,6 +338,14 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.virtual_network_rules = VirtualNetworkRulesOperations( self._client, self.config, self._serialize, self._deserialize) + self.extended_database_blob_auditing_policies = ExtendedDatabaseBlobAuditingPoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.extended_server_blob_auditing_policies = ExtendedServerBlobAuditingPoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.server_blob_auditing_policies = ServerBlobAuditingPoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.database_blob_auditing_policies = DatabaseBlobAuditingPoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) self.database_vulnerability_assessment_rule_baselines = DatabaseVulnerabilityAssessmentRuleBaselinesOperations( self._client, self.config, self._serialize, self._deserialize) self.database_vulnerability_assessments = DatabaseVulnerabilityAssessmentsOperations( @@ -353,10 +374,14 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.managed_databases = ManagedDatabasesOperations( self._client, self.config, self._serialize, self._deserialize) + self.sensitivity_labels = SensitivityLabelsOperations( + self._client, self.config, self._serialize, self._deserialize) self.server_automatic_tuning = ServerAutomaticTuningOperations( self._client, self.config, self._serialize, self._deserialize) self.server_dns_aliases = ServerDnsAliasesOperations( self._client, self.config, self._serialize, self._deserialize) + self.server_security_alert_policies = ServerSecurityAlertPoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) self.restore_points = RestorePointsOperations( self._client, self.config, self._serialize, self._deserialize) self.database_operations = DatabaseOperations( From 9a3f5fd6d3d2178b3f2b591ce50b65cfce3b6c26 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 27 Jul 2018 13:43:48 -0700 Subject: [PATCH 08/19] [AutoPR sql/resource-manager] [DO NOT MERGE] Add DatabaseVulnerabilityAssessments swagger (#2831) * Generated from 6444d2002961b584bdaf3c93623a498ca3066cde Clean non required params in version 10-2017 clean databaseVulnerabilityAssessmentScans * Generated from 135edfbe1c84314a9e283bc0f095e673dadbf6e0 fix error in execute scan example --- .../models/database_vulnerability_assessment.py | 14 ++++++++++---- .../database_vulnerability_assessment_py3.py | 16 +++++++++++----- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/database_vulnerability_assessment.py b/azure-mgmt-sql/azure/mgmt/sql/models/database_vulnerability_assessment.py index a7e5921902ad..6879532a1f9f 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/database_vulnerability_assessment.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/database_vulnerability_assessment.py @@ -30,10 +30,15 @@ class DatabaseVulnerabilityAssessment(ProxyResource): hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). :type storage_container_path: str - :param storage_container_sas_key: Required. A shared access signature (SAS - Key) that has write access to the blob container specified in - 'storageContainerPath' parameter. + :param storage_container_sas_key: A shared access signature (SAS Key) that + has write access to the blob container specified in 'storageContainerPath' + parameter. If 'storageAccountAccessKey' isn't specified, + StorageContainerSasKey is required. :type storage_container_sas_key: str + :param storage_account_access_key: Specifies the identifier key of the + auditing storage account. If 'StorageContainerSasKey' isn't specified, + storageAccountAccessKey is required. + :type storage_account_access_key: str :param recurring_scans: The recurring scans settings :type recurring_scans: ~azure.mgmt.sql.models.VulnerabilityAssessmentRecurringScansProperties @@ -44,7 +49,6 @@ class DatabaseVulnerabilityAssessment(ProxyResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'storage_container_path': {'required': True}, - 'storage_container_sas_key': {'required': True}, } _attribute_map = { @@ -53,6 +57,7 @@ class DatabaseVulnerabilityAssessment(ProxyResource): 'type': {'key': 'type', 'type': 'str'}, 'storage_container_path': {'key': 'properties.storageContainerPath', 'type': 'str'}, 'storage_container_sas_key': {'key': 'properties.storageContainerSasKey', 'type': 'str'}, + 'storage_account_access_key': {'key': 'properties.storageAccountAccessKey', 'type': 'str'}, 'recurring_scans': {'key': 'properties.recurringScans', 'type': 'VulnerabilityAssessmentRecurringScansProperties'}, } @@ -60,4 +65,5 @@ def __init__(self, **kwargs): super(DatabaseVulnerabilityAssessment, self).__init__(**kwargs) self.storage_container_path = kwargs.get('storage_container_path', None) self.storage_container_sas_key = kwargs.get('storage_container_sas_key', None) + self.storage_account_access_key = kwargs.get('storage_account_access_key', None) self.recurring_scans = kwargs.get('recurring_scans', None) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/database_vulnerability_assessment_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/database_vulnerability_assessment_py3.py index 2dff8336ef3f..957e4efd4fb5 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/database_vulnerability_assessment_py3.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/database_vulnerability_assessment_py3.py @@ -30,10 +30,15 @@ class DatabaseVulnerabilityAssessment(ProxyResource): hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). :type storage_container_path: str - :param storage_container_sas_key: Required. A shared access signature (SAS - Key) that has write access to the blob container specified in - 'storageContainerPath' parameter. + :param storage_container_sas_key: A shared access signature (SAS Key) that + has write access to the blob container specified in 'storageContainerPath' + parameter. If 'storageAccountAccessKey' isn't specified, + StorageContainerSasKey is required. :type storage_container_sas_key: str + :param storage_account_access_key: Specifies the identifier key of the + auditing storage account. If 'StorageContainerSasKey' isn't specified, + storageAccountAccessKey is required. + :type storage_account_access_key: str :param recurring_scans: The recurring scans settings :type recurring_scans: ~azure.mgmt.sql.models.VulnerabilityAssessmentRecurringScansProperties @@ -44,7 +49,6 @@ class DatabaseVulnerabilityAssessment(ProxyResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'storage_container_path': {'required': True}, - 'storage_container_sas_key': {'required': True}, } _attribute_map = { @@ -53,11 +57,13 @@ class DatabaseVulnerabilityAssessment(ProxyResource): 'type': {'key': 'type', 'type': 'str'}, 'storage_container_path': {'key': 'properties.storageContainerPath', 'type': 'str'}, 'storage_container_sas_key': {'key': 'properties.storageContainerSasKey', 'type': 'str'}, + 'storage_account_access_key': {'key': 'properties.storageAccountAccessKey', 'type': 'str'}, 'recurring_scans': {'key': 'properties.recurringScans', 'type': 'VulnerabilityAssessmentRecurringScansProperties'}, } - def __init__(self, *, storage_container_path: str, storage_container_sas_key: str, recurring_scans=None, **kwargs) -> None: + def __init__(self, *, storage_container_path: str, storage_container_sas_key: str=None, storage_account_access_key: str=None, recurring_scans=None, **kwargs) -> None: super(DatabaseVulnerabilityAssessment, self).__init__(**kwargs) self.storage_container_path = storage_container_path self.storage_container_sas_key = storage_container_sas_key + self.storage_account_access_key = storage_account_access_key self.recurring_scans = recurring_scans From 39fcd4382efda186b9fcfaf7fbdb648e3557b630 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 6 Aug 2018 11:04:00 -0700 Subject: [PATCH 09/19] Generated from 359416b0d2b799768c78568f0ecc5acab439c956 (#3077) fix SQL VA command copy paste typo Fix storageAccountAccessKey description. --- .../database_vulnerability_assessment.py | 4 +- .../database_vulnerability_assessment_py3.py | 4 +- ...long_term_retention_policies_operations.py | 18 ++-- ...hort_term_retention_policies_operations.py | 25 +++-- .../sql/operations/capabilities_operations.py | 6 +- .../data_masking_policies_operations.py | 12 +-- .../data_masking_rules_operations.py | 13 ++- .../database_automatic_tuning_operations.py | 12 +-- ...abase_blob_auditing_policies_operations.py | 12 +-- .../sql/operations/database_operations.py | 12 +-- ...se_threat_detection_policies_operations.py | 12 +-- .../operations/database_usages_operations.py | 7 +- ...ty_assessment_rule_baselines_operations.py | 17 ++-- ...lnerability_assessment_scans_operations.py | 24 +++-- ...se_vulnerability_assessments_operations.py | 17 ++-- .../sql/operations/databases_operations.py | 91 +++++++++---------- .../elastic_pool_activities_operations.py | 7 +- ...tic_pool_database_activities_operations.py | 7 +- .../sql/operations/elastic_pool_operations.py | 12 +-- .../operations/elastic_pools_operations.py | 44 ++++----- .../encryption_protectors_operations.py | 19 ++-- ...abase_blob_auditing_policies_operations.py | 12 +-- ...erver_blob_auditing_policies_operations.py | 12 +-- .../operations/failover_groups_operations.py | 42 ++++----- .../operations/firewall_rules_operations.py | 24 +++-- .../geo_backup_policies_operations.py | 19 ++-- .../instance_failover_groups_operations.py | 36 ++++---- .../sql/operations/job_agents_operations.py | 30 +++--- .../operations/job_credentials_operations.py | 24 +++-- .../operations/job_executions_operations.py | 37 ++++---- .../job_step_executions_operations.py | 13 ++- .../sql/operations/job_steps_operations.py | 37 ++++---- .../job_target_executions_operations.py | 20 ++-- .../job_target_groups_operations.py | 24 +++-- .../sql/operations/job_versions_operations.py | 13 ++- .../mgmt/sql/operations/jobs_operations.py | 24 +++-- .../long_term_retention_backups_operations.py | 32 +++---- .../managed_databases_operations.py | 35 ++++--- ...ed_instance_tde_certificates_operations.py | 5 +- .../managed_instances_operations.py | 37 ++++---- .../azure/mgmt/sql/operations/operations.py | 7 +- .../recommended_elastic_pools_operations.py | 20 ++-- .../recoverable_databases_operations.py | 13 ++- .../replication_links_operations.py | 28 +++--- ...restorable_dropped_databases_operations.py | 13 ++- .../operations/restore_points_operations.py | 24 +++-- .../sensitivity_labels_operations.py | 24 +++-- .../server_automatic_tuning_operations.py | 12 +-- ...rver_azure_ad_administrators_operations.py | 25 +++-- ...erver_blob_auditing_policies_operations.py | 12 +-- .../server_communication_links_operations.py | 24 +++-- .../server_connection_policies_operations.py | 12 +-- .../server_dns_aliases_operations.py | 29 +++--- .../sql/operations/server_keys_operations.py | 24 +++-- ...rver_security_alert_policies_operations.py | 12 +-- .../operations/server_usages_operations.py | 7 +- .../mgmt/sql/operations/servers_operations.py | 43 ++++----- .../service_objectives_operations.py | 13 ++- .../service_tier_advisors_operations.py | 13 ++- .../subscription_usages_operations.py | 13 ++- .../sql/operations/sync_agents_operations.py | 37 ++++---- .../sql/operations/sync_groups_operations.py | 66 ++++++-------- .../sql/operations/sync_members_operations.py | 42 ++++----- .../operations/tde_certificates_operations.py | 5 +- ...t_data_encryption_activities_operations.py | 7 +- ...transparent_data_encryptions_operations.py | 12 +-- .../virtual_network_rules_operations.py | 24 +++-- 67 files changed, 652 insertions(+), 760 deletions(-) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/database_vulnerability_assessment.py b/azure-mgmt-sql/azure/mgmt/sql/models/database_vulnerability_assessment.py index 6879532a1f9f..760e7166aef1 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/database_vulnerability_assessment.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/database_vulnerability_assessment.py @@ -36,8 +36,8 @@ class DatabaseVulnerabilityAssessment(ProxyResource): StorageContainerSasKey is required. :type storage_container_sas_key: str :param storage_account_access_key: Specifies the identifier key of the - auditing storage account. If 'StorageContainerSasKey' isn't specified, - storageAccountAccessKey is required. + vulnerability assessment storage account. If 'StorageContainerSasKey' + isn't specified, storageAccountAccessKey is required. :type storage_account_access_key: str :param recurring_scans: The recurring scans settings :type recurring_scans: diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/database_vulnerability_assessment_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/database_vulnerability_assessment_py3.py index 957e4efd4fb5..56fd72657b22 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/database_vulnerability_assessment_py3.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/database_vulnerability_assessment_py3.py @@ -36,8 +36,8 @@ class DatabaseVulnerabilityAssessment(ProxyResource): StorageContainerSasKey is required. :type storage_container_sas_key: str :param storage_account_access_key: Specifies the identifier key of the - auditing storage account. If 'StorageContainerSasKey' isn't specified, - storageAccountAccessKey is required. + vulnerability assessment storage account. If 'StorageContainerSasKey' + isn't specified, storageAccountAccessKey is required. :type storage_account_access_key: str :param recurring_scans: The recurring scans settings :type recurring_scans: diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/backup_long_term_retention_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/backup_long_term_retention_policies_operations.py index 986ea3cc4a62..c42ba1ab812b 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/backup_long_term_retention_policies_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/backup_long_term_retention_policies_operations.py @@ -81,7 +81,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: @@ -90,8 +90,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) @@ -130,6 +130,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()) @@ -142,9 +143,8 @@ def _create_or_update_initial( body_content = self._serialize.body(parameters, 'BackupLongTermRetentionPolicy') # 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) @@ -257,7 +257,7 @@ def list_by_database( # 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: @@ -266,8 +266,8 @@ def list_by_database( 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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/backup_short_term_retention_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/backup_short_term_retention_policies_operations.py index ce01d24f68c7..c7957810c281 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/backup_short_term_retention_policies_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/backup_short_term_retention_policies_operations.py @@ -81,7 +81,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: @@ -90,8 +90,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) @@ -132,6 +132,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()) @@ -144,9 +145,8 @@ def _create_or_update_initial( body_content = self._serialize.body(parameters, 'BackupShortTermRetentionPolicy') # 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) @@ -243,6 +243,7 @@ def _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()) @@ -255,9 +256,8 @@ def _update_initial( body_content = self._serialize.body(parameters, 'BackupShortTermRetentionPolicy') # Construct and send request - request = self._client.patch(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.patch(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) @@ -377,7 +377,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: @@ -386,9 +386,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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/capabilities_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/capabilities_operations.py index db0d68d14e73..a873a3a87f92 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/capabilities_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/capabilities_operations.py @@ -75,7 +75,7 @@ def list_by_location( # 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: @@ -84,8 +84,8 @@ def list_by_location( 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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/data_masking_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/data_masking_policies_operations.py index 384b2f6a6b4f..2d1099c8be0d 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/data_masking_policies_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/data_masking_policies_operations.py @@ -89,6 +89,7 @@ def create_or_update( # 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()) @@ -101,9 +102,8 @@ def create_or_update( body_content = self._serialize.body(parameters, 'DataMaskingPolicy') # 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]: exp = CloudError(response) @@ -161,7 +161,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: @@ -170,8 +170,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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/data_masking_rules_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/data_masking_rules_operations.py index 4e3020d9656c..c5fd4c63ab46 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/data_masking_rules_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/data_masking_rules_operations.py @@ -84,6 +84,7 @@ def create_or_update( # 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()) @@ -96,9 +97,8 @@ def create_or_update( body_content = self._serialize.body(parameters, 'DataMaskingRule') # 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, 201]: exp = CloudError(response) @@ -165,7 +165,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: @@ -174,9 +174,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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/database_automatic_tuning_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/database_automatic_tuning_operations.py index ba3eb4dede13..7a94b97b9546 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/database_automatic_tuning_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/database_automatic_tuning_operations.py @@ -75,7 +75,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: @@ -84,8 +84,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) @@ -150,6 +150,7 @@ def update( # 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()) @@ -162,9 +163,8 @@ def update( body_content = self._serialize.body(parameters, 'DatabaseAutomaticTuning') # Construct and send request - request = self._client.patch(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.patch(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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/database_blob_auditing_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/database_blob_auditing_policies_operations.py index 425ace0b8cc3..a0c09cfd8f09 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/database_blob_auditing_policies_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/database_blob_auditing_policies_operations.py @@ -78,7 +78,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: @@ -87,8 +87,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) @@ -148,6 +148,7 @@ def create_or_update( # 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()) @@ -160,9 +161,8 @@ def create_or_update( body_content = self._serialize.body(parameters, 'DatabaseBlobAuditingPolicy') # 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, 201]: exp = CloudError(response) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/database_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/database_operations.py index c46a648198b9..8d482411f199 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/database_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/database_operations.py @@ -77,7 +77,6 @@ def cancel( # Construct headers header_parameters = {} - 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: @@ -86,8 +85,8 @@ def cancel( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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]: exp = CloudError(response) @@ -144,7 +143,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: @@ -153,9 +152,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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/database_threat_detection_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/database_threat_detection_policies_operations.py index 79d0ec20f134..38501854c428 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/database_threat_detection_policies_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/database_threat_detection_policies_operations.py @@ -79,7 +79,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: @@ -88,8 +88,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) @@ -150,6 +150,7 @@ def create_or_update( # 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()) @@ -162,9 +163,8 @@ def create_or_update( body_content = self._serialize.body(parameters, 'DatabaseSecurityAlertPolicy') # 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, 201]: exp = CloudError(response) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/database_usages_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/database_usages_operations.py index 3291bc0d88c5..543a8ba6f509 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/database_usages_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/database_usages_operations.py @@ -82,7 +82,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: @@ -91,9 +91,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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/database_vulnerability_assessment_rule_baselines_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/database_vulnerability_assessment_rule_baselines_operations.py index 558ad0135821..9dba003a5ff2 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/database_vulnerability_assessment_rule_baselines_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/database_vulnerability_assessment_rule_baselines_operations.py @@ -91,7 +91,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: @@ -100,8 +100,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) @@ -177,6 +177,7 @@ def create_or_update( # 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()) @@ -189,9 +190,8 @@ def create_or_update( body_content = self._serialize.body(parameters, 'DatabaseVulnerabilityAssessmentRuleBaseline') # 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]: exp = CloudError(response) @@ -259,7 +259,6 @@ def delete( # Construct headers header_parameters = {} - 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: @@ -268,8 +267,8 @@ def delete( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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]: exp = CloudError(response) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/database_vulnerability_assessment_scans_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/database_vulnerability_assessment_scans_operations.py index e1d379ff4529..624bf67fca16 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/database_vulnerability_assessment_scans_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/database_vulnerability_assessment_scans_operations.py @@ -85,7 +85,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: @@ -94,8 +94,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) @@ -135,7 +135,6 @@ def _initiate_scan_initial( # Construct headers header_parameters = {} - 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: @@ -144,8 +143,8 @@ def _initiate_scan_initial( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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) @@ -253,7 +252,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: @@ -262,9 +261,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) @@ -329,7 +327,7 @@ def export( # 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: @@ -338,8 +336,8 @@ def export( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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, 201]: exp = CloudError(response) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/database_vulnerability_assessments_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/database_vulnerability_assessments_operations.py index 5f923f69d777..da9db7d9402e 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/database_vulnerability_assessments_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/database_vulnerability_assessments_operations.py @@ -80,7 +80,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: @@ -89,8 +89,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) @@ -153,6 +153,7 @@ def create_or_update( # 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()) @@ -165,9 +166,8 @@ def create_or_update( body_content = self._serialize.body(parameters, 'DatabaseVulnerabilityAssessment') # 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, 201]: exp = CloudError(response) @@ -227,7 +227,6 @@ def delete( # Construct headers header_parameters = {} - 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: @@ -236,8 +235,8 @@ def delete( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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]: exp = CloudError(response) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/databases_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/databases_operations.py index 61c746a203fc..3b4e01e8a397 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/databases_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/databases_operations.py @@ -59,6 +59,7 @@ def _import_method_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()) @@ -71,9 +72,8 @@ def _import_method_initial( body_content = self._serialize.body(parameters, 'ImportRequest') # 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, 202]: exp = CloudError(response) @@ -166,6 +166,7 @@ def _create_import_operation_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()) @@ -178,9 +179,8 @@ def _create_import_operation_initial( body_content = self._serialize.body(parameters, 'ImportExtensionRequest') # 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 [201, 202]: exp = CloudError(response) @@ -276,6 +276,7 @@ def _export_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()) @@ -288,9 +289,8 @@ def _export_initial( body_content = self._serialize.body(parameters, 'ExportRequest') # 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, 202]: exp = CloudError(response) @@ -414,7 +414,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: @@ -423,9 +423,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) @@ -492,7 +491,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: @@ -501,9 +500,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) @@ -544,7 +542,6 @@ def _upgrade_data_warehouse_initial( # Construct headers header_parameters = {} - 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: @@ -553,8 +550,8 @@ def _upgrade_data_warehouse_initial( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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) @@ -655,7 +652,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: @@ -664,9 +661,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) @@ -726,7 +722,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: @@ -735,8 +731,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) @@ -776,6 +772,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()) @@ -788,9 +785,8 @@ def _create_or_update_initial( body_content = self._serialize.body(parameters, 'Database') # 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, 201, 202]: exp = CloudError(response) @@ -886,7 +882,6 @@ def _delete_initial( # Construct headers header_parameters = {} - 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: @@ -895,8 +890,8 @@ def _delete_initial( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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) @@ -974,6 +969,7 @@ def _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()) @@ -986,9 +982,8 @@ def _update_initial( body_content = self._serialize.body(parameters, 'DatabaseUpdate') # Construct and send request - request = self._client.patch(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.patch(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) @@ -1108,7 +1103,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: @@ -1117,9 +1112,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) @@ -1160,7 +1154,7 @@ def _pause_initial( # 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: @@ -1169,8 +1163,8 @@ def _pause_initial( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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) @@ -1261,7 +1255,7 @@ def _resume_initial( # 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: @@ -1270,8 +1264,8 @@ def _resume_initial( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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) @@ -1396,9 +1390,8 @@ def rename( body_content = self._serialize.body(parameters, 'ResourceMoveDefinition') # 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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pool_activities_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pool_activities_operations.py index b2e826ad1551..a2d2dc49c203 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pool_activities_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pool_activities_operations.py @@ -83,7 +83,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: @@ -92,9 +92,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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pool_database_activities_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pool_database_activities_operations.py index 244394a4223f..5ed1492b9615 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pool_database_activities_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pool_database_activities_operations.py @@ -82,7 +82,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: @@ -91,9 +91,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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pool_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pool_operations.py index 38c35a868650..eb71face0db1 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pool_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pool_operations.py @@ -77,7 +77,6 @@ def cancel( # Construct headers header_parameters = {} - 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: @@ -86,8 +85,8 @@ def cancel( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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]: exp = CloudError(response) @@ -144,7 +143,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: @@ -153,9 +152,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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pools_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pools_operations.py index 4fb8d9592740..e7fba924b0c6 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pools_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pools_operations.py @@ -88,7 +88,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: @@ -97,9 +97,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) @@ -166,7 +165,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: @@ -175,9 +174,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) @@ -245,7 +243,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: @@ -254,9 +252,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) @@ -316,7 +313,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: @@ -325,8 +322,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) @@ -366,6 +363,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()) @@ -378,9 +376,8 @@ def _create_or_update_initial( body_content = self._serialize.body(parameters, 'ElasticPool') # 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, 201, 202]: exp = CloudError(response) @@ -476,7 +473,6 @@ def _delete_initial( # Construct headers header_parameters = {} - 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: @@ -485,8 +481,8 @@ def _delete_initial( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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) @@ -564,6 +560,7 @@ def _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()) @@ -576,9 +573,8 @@ def _update_initial( body_content = self._serialize.body(parameters, 'ElasticPoolUpdate') # Construct and send request - request = self._client.patch(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.patch(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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/encryption_protectors_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/encryption_protectors_operations.py index 2097599d903d..d19233971f4c 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/encryption_protectors_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/encryption_protectors_operations.py @@ -83,7 +83,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: @@ -92,9 +92,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) @@ -150,7 +149,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: @@ -159,8 +158,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) @@ -198,6 +197,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()) @@ -210,9 +210,8 @@ def _create_or_update_initial( body_content = self._serialize.body(parameters, 'EncryptionProtector') # 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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/extended_database_blob_auditing_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/extended_database_blob_auditing_policies_operations.py index 73ff8454c8b5..38bdfb2a0875 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/extended_database_blob_auditing_policies_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/extended_database_blob_auditing_policies_operations.py @@ -79,7 +79,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: @@ -88,8 +88,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) @@ -151,6 +151,7 @@ def create_or_update( # 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()) @@ -163,9 +164,8 @@ def create_or_update( body_content = self._serialize.body(parameters, 'ExtendedDatabaseBlobAuditingPolicy') # 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, 201]: exp = CloudError(response) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/extended_server_blob_auditing_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/extended_server_blob_auditing_policies_operations.py index 02830132aa3f..64524eb42a17 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/extended_server_blob_auditing_policies_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/extended_server_blob_auditing_policies_operations.py @@ -78,7 +78,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: @@ -87,8 +87,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) @@ -126,6 +126,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()) @@ -138,9 +139,8 @@ def _create_or_update_initial( body_content = self._serialize.body(parameters, 'ExtendedServerBlobAuditingPolicy') # 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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/failover_groups_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/failover_groups_operations.py index a0a879610fbc..fb779255c2a8 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/failover_groups_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/failover_groups_operations.py @@ -78,7 +78,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: @@ -87,8 +87,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) @@ -126,6 +126,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()) @@ -138,9 +139,8 @@ def _create_or_update_initial( body_content = self._serialize.body(parameters, 'FailoverGroup') # 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, 201, 202]: exp = CloudError(response) @@ -235,7 +235,6 @@ def _delete_initial( # Construct headers header_parameters = {} - 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: @@ -244,8 +243,8 @@ def _delete_initial( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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) @@ -322,6 +321,7 @@ def _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()) @@ -334,9 +334,8 @@ def _update_initial( body_content = self._serialize.body(parameters, 'FailoverGroupUpdate') # Construct and send request - request = self._client.patch(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.patch(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) @@ -453,7 +452,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: @@ -462,9 +461,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) @@ -503,7 +501,7 @@ def _failover_initial( # 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: @@ -512,8 +510,8 @@ def _failover_initial( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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) @@ -603,7 +601,7 @@ def _force_failover_allow_data_loss_initial( # 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: @@ -612,8 +610,8 @@ def _force_failover_allow_data_loss_initial( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/firewall_rules_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/firewall_rules_operations.py index 5827a0c4fa76..7f62a3fa0811 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/firewall_rules_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/firewall_rules_operations.py @@ -85,6 +85,7 @@ def create_or_update( # 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()) @@ -97,9 +98,8 @@ def create_or_update( body_content = self._serialize.body(parameters, 'FirewallRule') # 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, 201]: exp = CloudError(response) @@ -157,7 +157,6 @@ def delete( # Construct headers header_parameters = {} - 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: @@ -166,8 +165,8 @@ def delete( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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, 204]: exp = CloudError(response) @@ -217,7 +216,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: @@ -226,8 +225,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) @@ -288,7 +287,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: @@ -297,9 +296,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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/geo_backup_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/geo_backup_policies_operations.py index d73dbf426b17..bd81aeca5fa6 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/geo_backup_policies_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/geo_backup_policies_operations.py @@ -83,6 +83,7 @@ def create_or_update( # 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()) @@ -95,9 +96,8 @@ def create_or_update( body_content = self._serialize.body(parameters, 'GeoBackupPolicy') # 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, 201]: exp = CloudError(response) @@ -157,7 +157,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: @@ -166,8 +166,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) @@ -231,7 +231,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: @@ -240,9 +240,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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/instance_failover_groups_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/instance_failover_groups_operations.py index 8e9e2c566109..795d169692ab 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/instance_failover_groups_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/instance_failover_groups_operations.py @@ -78,7 +78,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: @@ -87,8 +87,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) @@ -126,6 +126,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()) @@ -138,9 +139,8 @@ def _create_or_update_initial( body_content = self._serialize.body(parameters, 'InstanceFailoverGroup') # 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, 201, 202]: exp = CloudError(response) @@ -235,7 +235,6 @@ def _delete_initial( # Construct headers header_parameters = {} - 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: @@ -244,8 +243,8 @@ def _delete_initial( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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) @@ -346,7 +345,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: @@ -355,9 +354,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) @@ -396,7 +394,7 @@ def _failover_initial( # 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: @@ -405,8 +403,8 @@ def _failover_initial( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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) @@ -497,7 +495,7 @@ def _force_failover_allow_data_loss_initial( # 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: @@ -506,8 +504,8 @@ def _force_failover_allow_data_loss_initial( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/job_agents_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/job_agents_operations.py index 774fa59314ce..eaeb4480cab8 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/job_agents_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/job_agents_operations.py @@ -81,7 +81,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: @@ -90,9 +90,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) @@ -150,7 +149,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: @@ -159,8 +158,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) @@ -198,6 +197,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()) @@ -210,9 +210,8 @@ def _create_or_update_initial( body_content = self._serialize.body(parameters, 'JobAgent') # 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, 201, 202]: exp = CloudError(response) @@ -307,7 +306,6 @@ def _delete_initial( # Construct headers header_parameters = {} - 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: @@ -316,8 +314,8 @@ def _delete_initial( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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) @@ -395,6 +393,7 @@ def _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()) @@ -407,9 +406,8 @@ def _update_initial( body_content = self._serialize.body(parameters, 'JobAgentUpdate') # Construct and send request - request = self._client.patch(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.patch(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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/job_credentials_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/job_credentials_operations.py index c4bf415fe5e4..309d5212b81e 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/job_credentials_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/job_credentials_operations.py @@ -82,7 +82,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: @@ -91,9 +91,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) @@ -154,7 +153,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: @@ -163,8 +162,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) @@ -230,6 +229,7 @@ def create_or_update( # 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()) @@ -242,9 +242,8 @@ def create_or_update( body_content = self._serialize.body(parameters, 'JobCredential') # 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, 201]: exp = CloudError(response) @@ -305,7 +304,6 @@ def delete( # Construct headers header_parameters = {} - 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: @@ -314,8 +312,8 @@ def delete( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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, 204]: exp = CloudError(response) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/job_executions_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/job_executions_operations.py index 3a9c7cd1c597..e883a1b6187f 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/job_executions_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/job_executions_operations.py @@ -117,7 +117,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: @@ -126,9 +126,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) @@ -191,7 +190,6 @@ def cancel( # Construct headers header_parameters = {} - 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: @@ -200,8 +198,8 @@ def cancel( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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]: exp = CloudError(response) @@ -233,7 +231,7 @@ def _create_initial( # 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: @@ -242,8 +240,8 @@ def _create_initial( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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) @@ -397,7 +395,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: @@ -406,9 +404,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) @@ -472,7 +469,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: @@ -481,8 +478,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) @@ -522,7 +519,7 @@ def _create_or_update_initial( # 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: @@ -531,8 +528,8 @@ def _create_or_update_initial( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.put(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 201, 202]: exp = CloudError(response) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/job_step_executions_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/job_step_executions_operations.py index 3a2c37310f40..92c6442fc7e5 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/job_step_executions_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/job_step_executions_operations.py @@ -121,7 +121,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: @@ -130,9 +130,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) @@ -199,7 +198,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: @@ -208,8 +207,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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/job_steps_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/job_steps_operations.py index 0cd2ba4bc13d..a37bfc3f4474 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/job_steps_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/job_steps_operations.py @@ -88,7 +88,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: @@ -97,9 +97,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) @@ -166,7 +165,7 @@ def get_by_version( # 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: @@ -175,8 +174,8 @@ def get_by_version( 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) @@ -243,7 +242,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: @@ -252,9 +251,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) @@ -318,7 +316,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: @@ -327,8 +325,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) @@ -394,6 +392,7 @@ def create_or_update( # 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()) @@ -406,9 +405,8 @@ def create_or_update( body_content = self._serialize.body(parameters, 'JobStep') # 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, 201]: exp = CloudError(response) @@ -472,7 +470,6 @@ def delete( # Construct headers header_parameters = {} - 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: @@ -481,8 +478,8 @@ def delete( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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, 204]: exp = CloudError(response) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/job_target_executions_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/job_target_executions_operations.py index 3224d6ec2d87..6c664709c063 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/job_target_executions_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/job_target_executions_operations.py @@ -121,7 +121,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: @@ -130,9 +130,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) @@ -239,7 +238,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: @@ -248,9 +247,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) @@ -320,7 +318,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: @@ -329,8 +327,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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/job_target_groups_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/job_target_groups_operations.py index 0bf98a502cb8..6a8bf6eed349 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/job_target_groups_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/job_target_groups_operations.py @@ -82,7 +82,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: @@ -91,9 +91,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) @@ -154,7 +153,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: @@ -163,8 +162,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) @@ -228,6 +227,7 @@ def create_or_update( # 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()) @@ -240,9 +240,8 @@ def create_or_update( body_content = self._serialize.body(parameters, 'JobTargetGroup') # 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, 201]: exp = CloudError(response) @@ -303,7 +302,6 @@ def delete( # Construct headers header_parameters = {} - 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: @@ -312,8 +310,8 @@ def delete( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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, 204]: exp = CloudError(response) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/job_versions_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/job_versions_operations.py index ec9e2ff23061..d03635534ff4 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/job_versions_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/job_versions_operations.py @@ -85,7 +85,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: @@ -94,9 +94,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) @@ -160,7 +159,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: @@ -169,8 +168,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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/jobs_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/jobs_operations.py index 042336e20941..2545fc1514e5 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/jobs_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/jobs_operations.py @@ -81,7 +81,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: @@ -90,9 +90,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) @@ -153,7 +152,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: @@ -162,8 +161,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) @@ -229,6 +228,7 @@ def create_or_update( # 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()) @@ -241,9 +241,8 @@ def create_or_update( body_content = self._serialize.body(parameters, 'Job') # 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, 201]: exp = CloudError(response) @@ -304,7 +303,6 @@ def delete( # Construct headers header_parameters = {} - 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: @@ -313,8 +311,8 @@ def delete( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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, 204]: exp = CloudError(response) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/long_term_retention_backups_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/long_term_retention_backups_operations.py index 3857d750063c..53882edcb02e 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/long_term_retention_backups_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/long_term_retention_backups_operations.py @@ -78,7 +78,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: @@ -87,8 +87,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) @@ -127,7 +127,6 @@ def _delete_initial( # Construct headers header_parameters = {} - 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: @@ -136,8 +135,8 @@ def _delete_initial( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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]: exp = CloudError(response) @@ -250,7 +249,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: @@ -259,9 +258,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) @@ -330,7 +328,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: @@ -339,9 +337,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) @@ -413,7 +410,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: @@ -422,9 +419,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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/managed_databases_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/managed_databases_operations.py index d4d2bb29f2b5..8761e7adbc83 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/managed_databases_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/managed_databases_operations.py @@ -71,9 +71,8 @@ def _complete_restore_initial( body_content = self._serialize.body(parameters, 'CompleteDatabaseRestoreDefinition') # 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, 202]: exp = CloudError(response) @@ -172,7 +171,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: @@ -181,9 +180,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) @@ -241,7 +239,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: @@ -250,8 +248,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) @@ -289,6 +287,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()) @@ -301,9 +300,8 @@ def _create_or_update_initial( body_content = self._serialize.body(parameters, 'ManagedDatabase') # 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, 201, 202]: exp = CloudError(response) @@ -397,7 +395,6 @@ def _delete_initial( # Construct headers header_parameters = {} - 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: @@ -406,8 +403,8 @@ def _delete_initial( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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) @@ -483,6 +480,7 @@ def _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()) @@ -495,9 +493,8 @@ def _update_initial( body_content = self._serialize.body(parameters, 'ManagedDatabaseUpdate') # Construct and send request - request = self._client.patch(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.patch(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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/managed_instance_tde_certificates_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/managed_instance_tde_certificates_operations.py index 25858d6548f3..be4ee1969fdd 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/managed_instance_tde_certificates_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/managed_instance_tde_certificates_operations.py @@ -71,9 +71,8 @@ def _create_initial( body_content = self._serialize.body(parameters, 'TdeCertificate') # 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, 202]: exp = CloudError(response) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/managed_instances_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/managed_instances_operations.py index 1bd0b6a0d60c..1fee247c7c96 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/managed_instances_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/managed_instances_operations.py @@ -73,7 +73,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: @@ -82,9 +82,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) @@ -143,7 +142,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: @@ -152,9 +151,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) @@ -209,7 +207,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: @@ -218,8 +216,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) @@ -256,6 +254,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()) @@ -268,9 +267,8 @@ def _create_or_update_initial( body_content = self._serialize.body(parameters, 'ManagedInstance') # 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, 201, 202]: exp = CloudError(response) @@ -360,7 +358,6 @@ def _delete_initial( # Construct headers header_parameters = {} - 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: @@ -369,8 +366,8 @@ def _delete_initial( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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) @@ -442,6 +439,7 @@ def _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()) @@ -454,9 +452,8 @@ def _update_initial( body_content = self._serialize.body(parameters, 'ManagedInstanceUpdate') # Construct and send request - request = self._client.patch(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.patch(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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/operations.py index 869264933111..5f8f397a39b9 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/operations.py @@ -67,7 +67,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: @@ -76,9 +76,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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/recommended_elastic_pools_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/recommended_elastic_pools_operations.py index 4a776d820a8f..c6d80bad021c 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/recommended_elastic_pools_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/recommended_elastic_pools_operations.py @@ -76,7 +76,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: @@ -85,8 +85,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) @@ -147,7 +147,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: @@ -156,9 +156,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) @@ -224,7 +223,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: @@ -233,9 +232,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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/recoverable_databases_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/recoverable_databases_operations.py index 299ee095bd0e..87b5873c5619 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/recoverable_databases_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/recoverable_databases_operations.py @@ -76,7 +76,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: @@ -85,8 +85,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) @@ -147,7 +147,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: @@ -156,9 +156,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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/replication_links_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/replication_links_operations.py index 4627fe4bccbc..d3d3cee87622 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/replication_links_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/replication_links_operations.py @@ -80,7 +80,6 @@ def delete( # Construct headers header_parameters = {} - 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: @@ -89,8 +88,8 @@ def delete( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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, 204]: exp = CloudError(response) @@ -143,7 +142,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: @@ -152,8 +151,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) @@ -192,7 +191,6 @@ def _failover_initial( # Construct headers header_parameters = {} - 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: @@ -201,8 +199,8 @@ def _failover_initial( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [202, 204]: exp = CloudError(response) @@ -284,7 +282,6 @@ def _failover_allow_data_loss_initial( # Construct headers header_parameters = {} - 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: @@ -293,8 +290,8 @@ def _failover_allow_data_loss_initial( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [202, 204]: exp = CloudError(response) @@ -401,7 +398,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: @@ -410,9 +407,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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/restorable_dropped_databases_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/restorable_dropped_databases_operations.py index ec5a1ed9c7fa..0dfb4989691a 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/restorable_dropped_databases_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/restorable_dropped_databases_operations.py @@ -76,7 +76,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: @@ -85,8 +85,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) @@ -147,7 +147,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: @@ -156,9 +156,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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/restore_points_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/restore_points_operations.py index 4c0ded271cf1..e5b49d9d1ed3 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/restore_points_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/restore_points_operations.py @@ -84,7 +84,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: @@ -93,9 +93,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) @@ -136,6 +135,7 @@ def _create_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()) @@ -148,9 +148,8 @@ def _create_initial( body_content = self._serialize.body(parameters, 'CreateDatabaseRestorePointDefinition') # 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, 201, 202]: exp = CloudError(response) @@ -266,7 +265,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: @@ -275,8 +274,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) @@ -335,7 +334,6 @@ def delete( # Construct headers header_parameters = {} - 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: @@ -344,8 +342,8 @@ def delete( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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]: exp = CloudError(response) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/sensitivity_labels_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/sensitivity_labels_operations.py index 656ef40de187..c4de1618af9e 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/sensitivity_labels_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/sensitivity_labels_operations.py @@ -89,7 +89,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: @@ -98,9 +98,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) @@ -172,7 +171,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: @@ -181,8 +180,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) @@ -255,6 +254,7 @@ def create_or_update( # 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()) @@ -267,9 +267,8 @@ def create_or_update( body_content = self._serialize.body(parameters, 'SensitivityLabel') # 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, 201]: exp = CloudError(response) @@ -337,7 +336,6 @@ def delete( # Construct headers header_parameters = {} - 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: @@ -346,8 +344,8 @@ def delete( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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]: exp = CloudError(response) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/server_automatic_tuning_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/server_automatic_tuning_operations.py index 2ce94e0e4058..675d886377c6 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/server_automatic_tuning_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/server_automatic_tuning_operations.py @@ -72,7 +72,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: @@ -81,8 +81,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) @@ -145,6 +145,7 @@ def update( # 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()) @@ -157,9 +158,8 @@ def update( body_content = self._serialize.body(parameters, 'ServerAutomaticTuning') # Construct and send request - request = self._client.patch(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.patch(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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/server_azure_ad_administrators_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/server_azure_ad_administrators_operations.py index 465231415dde..c7a66d57ea08 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/server_azure_ad_administrators_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/server_azure_ad_administrators_operations.py @@ -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()) @@ -72,9 +73,8 @@ def _create_or_update_initial( body_content = self._serialize.body(properties, 'ServerAzureADAdministrator') # 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, 201, 202]: exp = CloudError(response) @@ -170,7 +170,7 @@ def _delete_initial( # 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: @@ -179,8 +179,8 @@ def _delete_initial( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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) @@ -288,7 +288,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: @@ -297,8 +297,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) @@ -359,7 +359,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: @@ -368,9 +368,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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/server_blob_auditing_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/server_blob_auditing_policies_operations.py index ae38710656f9..ac7c8ef280ac 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/server_blob_auditing_policies_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/server_blob_auditing_policies_operations.py @@ -77,7 +77,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: @@ -86,8 +86,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) @@ -125,6 +125,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()) @@ -137,9 +138,8 @@ def _create_or_update_initial( body_content = self._serialize.body(parameters, 'ServerBlobAuditingPolicy') # 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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/server_communication_links_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/server_communication_links_operations.py index 5d9935bb7b88..2844c4068ea4 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/server_communication_links_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/server_communication_links_operations.py @@ -77,7 +77,6 @@ def delete( # Construct headers header_parameters = {} - 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: @@ -86,8 +85,8 @@ def delete( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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]: exp = CloudError(response) @@ -138,7 +137,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: @@ -147,8 +146,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) @@ -188,6 +187,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()) @@ -200,9 +200,8 @@ def _create_or_update_initial( body_content = self._serialize.body(parameters, 'ServerCommunicationLink') # 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 [201, 202]: exp = CloudError(response) @@ -318,7 +317,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: @@ -327,9 +326,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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/server_connection_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/server_connection_policies_operations.py index e352e147a10b..c1d5c68e7f7f 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/server_connection_policies_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/server_connection_policies_operations.py @@ -81,6 +81,7 @@ def create_or_update( # 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()) @@ -93,9 +94,8 @@ def create_or_update( body_content = self._serialize.body(parameters, 'ServerConnectionPolicy') # 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, 201]: exp = CloudError(response) @@ -152,7 +152,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: @@ -161,8 +161,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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/server_dns_aliases_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/server_dns_aliases_operations.py index 5b7d511666a6..a4f79dfce854 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/server_dns_aliases_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/server_dns_aliases_operations.py @@ -78,7 +78,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: @@ -87,8 +87,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) @@ -126,7 +126,7 @@ def _create_or_update_initial( # 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: @@ -135,8 +135,8 @@ def _create_or_update_initial( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.put(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 201, 202]: exp = CloudError(response) @@ -228,7 +228,6 @@ def _delete_initial( # Construct headers header_parameters = {} - 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: @@ -237,8 +236,8 @@ def _delete_initial( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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) @@ -339,7 +338,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: @@ -348,9 +347,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) @@ -403,9 +401,8 @@ def _acquire_initial( body_content = self._serialize.body(parameters, 'ServerDnsAliasAcquisition') # 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, 202]: exp = CloudError(response) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/server_keys_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/server_keys_operations.py index 322f982c5a71..e52b751d7eb8 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/server_keys_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/server_keys_operations.py @@ -81,7 +81,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: @@ -90,9 +90,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) @@ -150,7 +149,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: @@ -159,8 +158,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) @@ -198,6 +197,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()) @@ -210,9 +210,8 @@ def _create_or_update_initial( body_content = self._serialize.body(parameters, 'ServerKey') # 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, 201, 202]: exp = CloudError(response) @@ -311,7 +310,6 @@ def _delete_initial( # Construct headers header_parameters = {} - 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: @@ -320,8 +318,8 @@ def _delete_initial( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/server_security_alert_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/server_security_alert_policies_operations.py index ddbd335574b4..878dff3ed286 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/server_security_alert_policies_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/server_security_alert_policies_operations.py @@ -77,7 +77,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: @@ -86,8 +86,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) @@ -125,6 +125,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()) @@ -137,9 +138,8 @@ def _create_or_update_initial( body_content = self._serialize.body(parameters, 'ServerSecurityAlertPolicy') # 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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/server_usages_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/server_usages_operations.py index 4160b69c1f1d..4d60726ff42f 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/server_usages_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/server_usages_operations.py @@ -79,7 +79,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: @@ -88,9 +88,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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/servers_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/servers_operations.py index 4e8b4510da88..7abad6723542 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/servers_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/servers_operations.py @@ -71,6 +71,7 @@ def check_name_availability( # 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()) @@ -83,9 +84,8 @@ def check_name_availability( body_content = self._serialize.body(parameters, 'CheckNameAvailabilityRequest') # 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) @@ -140,7 +140,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: @@ -149,9 +149,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) @@ -212,7 +211,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: @@ -221,9 +220,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) @@ -280,7 +278,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: @@ -289,8 +287,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) @@ -329,6 +327,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()) @@ -341,9 +340,8 @@ def _create_or_update_initial( body_content = self._serialize.body(parameters, 'Server') # 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, 201, 202]: exp = CloudError(response) @@ -435,7 +433,6 @@ def _delete_initial( # Construct headers header_parameters = {} - 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: @@ -444,8 +441,8 @@ def _delete_initial( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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) @@ -519,6 +516,7 @@ def _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()) @@ -531,9 +529,8 @@ def _update_initial( body_content = self._serialize.body(parameters, 'ServerUpdate') # Construct and send request - request = self._client.patch(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.patch(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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/service_objectives_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/service_objectives_operations.py index 2ff770f2daec..d4f53c7313af 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/service_objectives_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/service_objectives_operations.py @@ -76,7 +76,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: @@ -85,8 +85,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) @@ -147,7 +147,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: @@ -156,9 +156,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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/service_tier_advisors_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/service_tier_advisors_operations.py index d3075cfd97e9..cc9ba091db21 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/service_tier_advisors_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/service_tier_advisors_operations.py @@ -78,7 +78,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: @@ -87,8 +87,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) @@ -152,7 +152,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: @@ -161,9 +161,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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/subscription_usages_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/subscription_usages_operations.py index e4b33959c152..b70973ca790e 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/subscription_usages_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/subscription_usages_operations.py @@ -75,7 +75,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: @@ -84,9 +84,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) @@ -140,7 +139,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: @@ -149,8 +148,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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/sync_agents_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/sync_agents_operations.py index bfbcc0564d79..9ac0651a57d3 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/sync_agents_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/sync_agents_operations.py @@ -78,7 +78,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: @@ -87,8 +87,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) @@ -128,6 +128,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()) @@ -140,9 +141,8 @@ def _create_or_update_initial( body_content = self._serialize.body(parameters, 'SyncAgent') # 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, 201, 202]: exp = CloudError(response) @@ -238,7 +238,6 @@ def _delete_initial( # Construct headers header_parameters = {} - 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: @@ -247,8 +246,8 @@ def _delete_initial( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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) @@ -349,7 +348,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: @@ -358,9 +357,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) @@ -419,7 +417,7 @@ def generate_key( # 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: @@ -428,8 +426,8 @@ def generate_key( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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]: exp = CloudError(response) @@ -494,7 +492,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: @@ -503,9 +501,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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/sync_groups_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/sync_groups_operations.py index 87e80a399f67..484f24f33781 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/sync_groups_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/sync_groups_operations.py @@ -77,7 +77,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: @@ -86,9 +86,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) @@ -128,7 +127,6 @@ def _refresh_hub_schema_initial( # Construct headers header_parameters = {} - 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: @@ -137,8 +135,8 @@ def _refresh_hub_schema_initial( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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) @@ -248,7 +246,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: @@ -257,9 +255,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) @@ -342,7 +339,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: @@ -351,9 +348,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) @@ -414,7 +410,6 @@ def cancel_sync( # Construct headers header_parameters = {} - 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: @@ -423,8 +418,8 @@ def cancel_sync( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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]: exp = CloudError(response) @@ -477,7 +472,6 @@ def trigger_sync( # Construct headers header_parameters = {} - 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: @@ -486,8 +480,8 @@ def trigger_sync( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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]: exp = CloudError(response) @@ -541,7 +535,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: @@ -550,8 +544,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) @@ -590,6 +584,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()) @@ -602,9 +597,8 @@ def _create_or_update_initial( body_content = self._serialize.body(parameters, 'SyncGroup') # 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, 201, 202]: exp = CloudError(response) @@ -703,7 +697,6 @@ def _delete_initial( # Construct headers header_parameters = {} - 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: @@ -712,8 +705,8 @@ def _delete_initial( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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) @@ -794,6 +787,7 @@ def _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()) @@ -806,9 +800,8 @@ def _update_initial( body_content = self._serialize.body(parameters, 'SyncGroup') # Construct and send request - request = self._client.patch(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.patch(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) @@ -931,7 +924,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: @@ -940,9 +933,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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/sync_members_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/sync_members_operations.py index e33d8ac88a7d..4eab11133d05 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/sync_members_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/sync_members_operations.py @@ -85,7 +85,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: @@ -94,8 +94,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) @@ -135,6 +135,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()) @@ -147,9 +148,8 @@ def _create_or_update_initial( body_content = self._serialize.body(parameters, 'SyncMember') # 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, 201, 202]: exp = CloudError(response) @@ -253,7 +253,6 @@ def _delete_initial( # Construct headers header_parameters = {} - 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: @@ -262,8 +261,8 @@ def _delete_initial( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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) @@ -349,6 +348,7 @@ def _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()) @@ -361,9 +361,8 @@ def _update_initial( body_content = self._serialize.body(parameters, 'SyncMember') # Construct and send request - request = self._client.patch(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.patch(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) @@ -493,7 +492,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: @@ -502,9 +501,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) @@ -577,7 +575,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: @@ -586,9 +584,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) @@ -629,7 +626,6 @@ def _refresh_member_schema_initial( # Construct headers header_parameters = {} - 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: @@ -638,8 +634,8 @@ def _refresh_member_schema_initial( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/tde_certificates_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/tde_certificates_operations.py index 3224daf071e6..bc529a38043f 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/tde_certificates_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/tde_certificates_operations.py @@ -71,9 +71,8 @@ def _create_initial( body_content = self._serialize.body(parameters, 'TdeCertificate') # 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, 202]: exp = CloudError(response) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/transparent_data_encryption_activities_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/transparent_data_encryption_activities_operations.py index d27623ba644f..ae930a401246 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/transparent_data_encryption_activities_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/transparent_data_encryption_activities_operations.py @@ -87,7 +87,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: @@ -96,9 +96,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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/transparent_data_encryptions_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/transparent_data_encryptions_operations.py index a672a32bf38e..a0f3c8184f57 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/transparent_data_encryptions_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/transparent_data_encryptions_operations.py @@ -86,6 +86,7 @@ def create_or_update( # 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()) @@ -98,9 +99,8 @@ def create_or_update( body_content = self._serialize.body(parameters, 'TransparentDataEncryption') # 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, 201]: exp = CloudError(response) @@ -161,7 +161,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: @@ -170,8 +170,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) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/virtual_network_rules_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/virtual_network_rules_operations.py index 2af3a57b2448..01bc6f5bdf3e 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/virtual_network_rules_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/virtual_network_rules_operations.py @@ -78,7 +78,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: @@ -87,8 +87,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) @@ -128,6 +128,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()) @@ -140,9 +141,8 @@ def _create_or_update_initial( body_content = self._serialize.body(parameters, 'VirtualNetworkRule') # 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, 201, 202]: exp = CloudError(response) @@ -242,7 +242,6 @@ def _delete_initial( # Construct headers header_parameters = {} - 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: @@ -251,8 +250,8 @@ def _delete_initial( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + 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) @@ -352,7 +351,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: @@ -361,9 +360,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) From 833e961a1ed7ce59b54f8767c847fd0320f3ebfb Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 9 Aug 2018 13:34:08 -0700 Subject: [PATCH 10/19] [AutoPR sql/resource-manager] [DO NOT MERGE] Adding VA support for manged instance (#2872) * Generated from cb4adee8b49beb3221fbdb9f601ac7ea44b5af4a Adding VA support for manged instance * Generated from cb4adee8b49beb3221fbdb9f601ac7ea44b5af4a Adding VA support for manged instance From 8524bd9f4f4a2879c25570505017cf24d21d297d Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 16 Aug 2018 10:23:36 -0700 Subject: [PATCH 11/19] Generated from 05549665a5f0b09fc5e7058ffec2c09d91bf3ab0 (#3127) managed instance data classification REST API for version 2018-06-01-preview --- .../sensitivity_labels_operations.py | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/sensitivity_labels_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/sensitivity_labels_operations.py index c4de1618af9e..a17299fb19d0 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/sensitivity_labels_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/sensitivity_labels_operations.py @@ -119,6 +119,92 @@ def internal_paging(next_link=None, raw=False): return deserialized list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sensitivityLabels'} + def list_by_database_with_source( + self, resource_group_name, server_name, database_name, sensitivity_label_source, filter=None, custom_headers=None, raw=False, **operation_config): + """Gets the sensitivity labels of a given database. + + :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 database_name: The name of the database. + :type database_name: str + :param sensitivity_label_source: Optional source of the sensitivity + label. Valid values are current or recommeneded. In not specified both + returned. Possible values include: 'current', 'recommended' + :type sensitivity_label_source: str or + ~azure.mgmt.sql.models.SensitivityLabelSource + :param filter: An OData filter expression that filters elements in the + collection. + :type filter: 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 SensitivityLabel + :rtype: + ~azure.mgmt.sql.models.SensitivityLabelPaged[~azure.mgmt.sql.models.SensitivityLabel] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_database_with_source.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'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'sensitivityLabelSource': self._serialize.url("sensitivity_label_source", sensitivity_label_source, 'SensitivityLabelSource'), + '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 = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + 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.SensitivityLabelPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.SensitivityLabelPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_database_with_source.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sensitivityLabels/{sensitivityLabelSource}'} + def get( self, resource_group_name, server_name, database_name, schema_name, table_name, column_name, sensitivity_label_source, custom_headers=None, raw=False, **operation_config): """Gets the sensitivity label of a given column. From e429c6696fe69e01ccd019f461f6b5e976041dd5 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 4 Sep 2018 13:18:46 -0700 Subject: [PATCH 12/19] [AutoPR sql/resource-manager] New Cmdlets for Management.Sql to allow customers to add TDE keys and set TDE protector (#3227) * Generated from bdb271f9fc7fa148176e6470e7e5b27cc2450c73 Changes for ManagedInstanceEncryptionProtectors * Generated from 724082f8646ab05191f7eee135fd674fd26d1a94 Changing operation id to ListByInstance as per Jared's recommendation * Generated from f5321fc054067d1d4e8937cfc92452bf4a6a4950 Addressed comments By @anuchandy - Changed comment to created or updated - changed operation if to listByInstance --- .../azure/mgmt/sql/models/__init__.py | 10 + .../managed_instance_encryption_protector.py | 71 ++++ ...ged_instance_encryption_protector_paged.py | 27 ++ ...naged_instance_encryption_protector_py3.py | 71 ++++ .../mgmt/sql/models/managed_instance_key.py | 72 ++++ .../sql/models/managed_instance_key_paged.py | 27 ++ .../sql/models/managed_instance_key_py3.py | 72 ++++ .../azure/mgmt/sql/operations/__init__.py | 4 + ...stance_encryption_protectors_operations.py | 292 +++++++++++++ .../managed_instance_keys_operations.py | 386 ++++++++++++++++++ .../azure/mgmt/sql/sql_management_client.py | 10 + 11 files changed, 1042 insertions(+) create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_encryption_protector.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_encryption_protector_paged.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_encryption_protector_py3.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_key.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_key_paged.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_key_py3.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/managed_instance_encryption_protectors_operations.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/managed_instance_keys_operations.py diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py index 921235f71ce5..f433597e9952 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py @@ -150,6 +150,8 @@ from .instance_failover_group_py3 import InstanceFailoverGroup from .backup_short_term_retention_policy_py3 import BackupShortTermRetentionPolicy from .tde_certificate_py3 import TdeCertificate + from .managed_instance_key_py3 import ManagedInstanceKey + from .managed_instance_encryption_protector_py3 import ManagedInstanceEncryptionProtector except (SyntaxError, ImportError): from .recoverable_database import RecoverableDatabase from .restorable_dropped_database import RestorableDroppedDatabase @@ -291,6 +293,8 @@ from .instance_failover_group import InstanceFailoverGroup from .backup_short_term_retention_policy import BackupShortTermRetentionPolicy from .tde_certificate import TdeCertificate + from .managed_instance_key import ManagedInstanceKey + from .managed_instance_encryption_protector import ManagedInstanceEncryptionProtector from .recoverable_database_paged import RecoverableDatabasePaged from .restorable_dropped_database_paged import RestorableDroppedDatabasePaged from .server_paged import ServerPaged @@ -344,6 +348,8 @@ from .vulnerability_assessment_scan_record_paged import VulnerabilityAssessmentScanRecordPaged from .instance_failover_group_paged import InstanceFailoverGroupPaged from .backup_short_term_retention_policy_paged import BackupShortTermRetentionPolicyPaged +from .managed_instance_key_paged import ManagedInstanceKeyPaged +from .managed_instance_encryption_protector_paged import ManagedInstanceEncryptionProtectorPaged from .sql_management_client_enums import ( CheckNameAvailabilityReason, ServerConnectionType, @@ -565,6 +571,8 @@ 'InstanceFailoverGroup', 'BackupShortTermRetentionPolicy', 'TdeCertificate', + 'ManagedInstanceKey', + 'ManagedInstanceEncryptionProtector', 'RecoverableDatabasePaged', 'RestorableDroppedDatabasePaged', 'ServerPaged', @@ -618,6 +626,8 @@ 'VulnerabilityAssessmentScanRecordPaged', 'InstanceFailoverGroupPaged', 'BackupShortTermRetentionPolicyPaged', + 'ManagedInstanceKeyPaged', + 'ManagedInstanceEncryptionProtectorPaged', 'CheckNameAvailabilityReason', 'ServerConnectionType', 'SecurityAlertPolicyState', diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_encryption_protector.py b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_encryption_protector.py new file mode 100644 index 000000000000..87ffcbf35af7 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_encryption_protector.py @@ -0,0 +1,71 @@ +# 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 ManagedInstanceEncryptionProtector(ProxyResource): + """The managed instance encryption protector. + + 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 + :ivar kind: Kind of encryption protector. This is metadata used for the + Azure portal experience. + :vartype kind: str + :param server_key_name: The name of the managed instance key. + :type server_key_name: str + :param server_key_type: Required. The encryption protector type like + 'ServiceManaged', 'AzureKeyVault'. Possible values include: + 'ServiceManaged', 'AzureKeyVault' + :type server_key_type: str or ~azure.mgmt.sql.models.ServerKeyType + :ivar uri: The URI of the server key. + :vartype uri: str + :ivar thumbprint: Thumbprint of the server key. + :vartype thumbprint: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'readonly': True}, + 'server_key_type': {'required': True}, + 'uri': {'readonly': True}, + 'thumbprint': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'server_key_name': {'key': 'properties.serverKeyName', 'type': 'str'}, + 'server_key_type': {'key': 'properties.serverKeyType', 'type': 'str'}, + 'uri': {'key': 'properties.uri', 'type': 'str'}, + 'thumbprint': {'key': 'properties.thumbprint', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ManagedInstanceEncryptionProtector, self).__init__(**kwargs) + self.kind = None + self.server_key_name = kwargs.get('server_key_name', None) + self.server_key_type = kwargs.get('server_key_type', None) + self.uri = None + self.thumbprint = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_encryption_protector_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_encryption_protector_paged.py new file mode 100644 index 000000000000..39ba69c33e17 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_encryption_protector_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 ManagedInstanceEncryptionProtectorPaged(Paged): + """ + A paging container for iterating over a list of :class:`ManagedInstanceEncryptionProtector ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ManagedInstanceEncryptionProtector]'} + } + + def __init__(self, *args, **kwargs): + + super(ManagedInstanceEncryptionProtectorPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_encryption_protector_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_encryption_protector_py3.py new file mode 100644 index 000000000000..4d45efcf8c5d --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_encryption_protector_py3.py @@ -0,0 +1,71 @@ +# 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 ManagedInstanceEncryptionProtector(ProxyResource): + """The managed instance encryption protector. + + 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 + :ivar kind: Kind of encryption protector. This is metadata used for the + Azure portal experience. + :vartype kind: str + :param server_key_name: The name of the managed instance key. + :type server_key_name: str + :param server_key_type: Required. The encryption protector type like + 'ServiceManaged', 'AzureKeyVault'. Possible values include: + 'ServiceManaged', 'AzureKeyVault' + :type server_key_type: str or ~azure.mgmt.sql.models.ServerKeyType + :ivar uri: The URI of the server key. + :vartype uri: str + :ivar thumbprint: Thumbprint of the server key. + :vartype thumbprint: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'readonly': True}, + 'server_key_type': {'required': True}, + 'uri': {'readonly': True}, + 'thumbprint': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'server_key_name': {'key': 'properties.serverKeyName', 'type': 'str'}, + 'server_key_type': {'key': 'properties.serverKeyType', 'type': 'str'}, + 'uri': {'key': 'properties.uri', 'type': 'str'}, + 'thumbprint': {'key': 'properties.thumbprint', 'type': 'str'}, + } + + def __init__(self, *, server_key_type, server_key_name: str=None, **kwargs) -> None: + super(ManagedInstanceEncryptionProtector, self).__init__(**kwargs) + self.kind = None + self.server_key_name = server_key_name + self.server_key_type = server_key_type + self.uri = None + self.thumbprint = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_key.py b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_key.py new file mode 100644 index 000000000000..5a7ee9724f96 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_key.py @@ -0,0 +1,72 @@ +# 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 ManagedInstanceKey(ProxyResource): + """A managed instance key. + + 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 + :ivar kind: Kind of encryption protector. This is metadata used for the + Azure portal experience. + :vartype kind: str + :param server_key_type: Required. The key type like 'ServiceManaged', + 'AzureKeyVault'. Possible values include: 'ServiceManaged', + 'AzureKeyVault' + :type server_key_type: str or ~azure.mgmt.sql.models.ServerKeyType + :param uri: The URI of the key. If the ServerKeyType is AzureKeyVault, + then the URI is required. + :type uri: str + :ivar thumbprint: Thumbprint of the key. + :vartype thumbprint: str + :ivar creation_date: The key creation date. + :vartype creation_date: datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'readonly': True}, + 'server_key_type': {'required': True}, + 'thumbprint': {'readonly': True}, + 'creation_date': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'server_key_type': {'key': 'properties.serverKeyType', 'type': 'str'}, + 'uri': {'key': 'properties.uri', 'type': 'str'}, + 'thumbprint': {'key': 'properties.thumbprint', 'type': 'str'}, + 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(ManagedInstanceKey, self).__init__(**kwargs) + self.kind = None + self.server_key_type = kwargs.get('server_key_type', None) + self.uri = kwargs.get('uri', None) + self.thumbprint = None + self.creation_date = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_key_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_key_paged.py new file mode 100644 index 000000000000..8c730f73a383 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_key_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 ManagedInstanceKeyPaged(Paged): + """ + A paging container for iterating over a list of :class:`ManagedInstanceKey ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ManagedInstanceKey]'} + } + + def __init__(self, *args, **kwargs): + + super(ManagedInstanceKeyPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_key_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_key_py3.py new file mode 100644 index 000000000000..f00bafa838f2 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_key_py3.py @@ -0,0 +1,72 @@ +# 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 ManagedInstanceKey(ProxyResource): + """A managed instance key. + + 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 + :ivar kind: Kind of encryption protector. This is metadata used for the + Azure portal experience. + :vartype kind: str + :param server_key_type: Required. The key type like 'ServiceManaged', + 'AzureKeyVault'. Possible values include: 'ServiceManaged', + 'AzureKeyVault' + :type server_key_type: str or ~azure.mgmt.sql.models.ServerKeyType + :param uri: The URI of the key. If the ServerKeyType is AzureKeyVault, + then the URI is required. + :type uri: str + :ivar thumbprint: Thumbprint of the key. + :vartype thumbprint: str + :ivar creation_date: The key creation date. + :vartype creation_date: datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'readonly': True}, + 'server_key_type': {'required': True}, + 'thumbprint': {'readonly': True}, + 'creation_date': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'server_key_type': {'key': 'properties.serverKeyType', 'type': 'str'}, + 'uri': {'key': 'properties.uri', 'type': 'str'}, + 'thumbprint': {'key': 'properties.thumbprint', 'type': 'str'}, + 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, + } + + def __init__(self, *, server_key_type, uri: str=None, **kwargs) -> None: + super(ManagedInstanceKey, self).__init__(**kwargs) + self.kind = None + self.server_key_type = server_key_type + self.uri = uri + self.thumbprint = None + self.creation_date = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py index 538af4811eb3..f512225ab333 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py @@ -74,6 +74,8 @@ from .backup_short_term_retention_policies_operations import BackupShortTermRetentionPoliciesOperations from .tde_certificates_operations import TdeCertificatesOperations from .managed_instance_tde_certificates_operations import ManagedInstanceTdeCertificatesOperations +from .managed_instance_keys_operations import ManagedInstanceKeysOperations +from .managed_instance_encryption_protectors_operations import ManagedInstanceEncryptionProtectorsOperations __all__ = [ 'RecoverableDatabasesOperations', @@ -141,4 +143,6 @@ 'BackupShortTermRetentionPoliciesOperations', 'TdeCertificatesOperations', 'ManagedInstanceTdeCertificatesOperations', + 'ManagedInstanceKeysOperations', + 'ManagedInstanceEncryptionProtectorsOperations', ] diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/managed_instance_encryption_protectors_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/managed_instance_encryption_protectors_operations.py new file mode 100644 index 000000000000..61ab8baa5d32 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/managed_instance_encryption_protectors_operations.py @@ -0,0 +1,292 @@ +# 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 ManagedInstanceEncryptionProtectorsOperations(object): + """ManagedInstanceEncryptionProtectorsOperations 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: "2017-10-01-preview". + :ivar encryption_protector_name: The name of the encryption protector to be retrieved. Constant value: "current". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-10-01-preview" + self.encryption_protector_name = "current" + + self.config = config + + def list_by_instance( + self, resource_group_name, managed_instance_name, custom_headers=None, raw=False, **operation_config): + """Gets a list of managed instance encryption protectors. + + :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 managed_instance_name: The name of the managed instance. + :type managed_instance_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 + ManagedInstanceEncryptionProtector + :rtype: + ~azure.mgmt.sql.models.ManagedInstanceEncryptionProtectorPaged[~azure.mgmt.sql.models.ManagedInstanceEncryptionProtector] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_instance.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_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.ManagedInstanceEncryptionProtectorPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ManagedInstanceEncryptionProtectorPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_instance.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/encryptionProtector'} + + def get( + self, resource_group_name, managed_instance_name, custom_headers=None, raw=False, **operation_config): + """Gets a managed instance encryption protector. + + :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 managed_instance_name: The name of the managed instance. + :type managed_instance_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: ManagedInstanceEncryptionProtector or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.sql.models.ManagedInstanceEncryptionProtector 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'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'encryptionProtectorName': self._serialize.url("self.encryption_protector_name", self.encryption_protector_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('ManagedInstanceEncryptionProtector', 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/managedInstances/{managedInstanceName}/encryptionProtector/{encryptionProtectorName}'} + + + def _create_or_update_initial( + self, resource_group_name, managed_instance_name, server_key_type, server_key_name=None, custom_headers=None, raw=False, **operation_config): + parameters = models.ManagedInstanceEncryptionProtector(server_key_name=server_key_name, server_key_type=server_key_type) + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'encryptionProtectorName': self._serialize.url("self.encryption_protector_name", self.encryption_protector_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, 'ManagedInstanceEncryptionProtector') + + # 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('ManagedInstanceEncryptionProtector', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, managed_instance_name, server_key_type, server_key_name=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Updates an existing encryption protector. + + :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 managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param server_key_type: The encryption protector type like + 'ServiceManaged', 'AzureKeyVault'. Possible values include: + 'ServiceManaged', 'AzureKeyVault' + :type server_key_type: str or ~azure.mgmt.sql.models.ServerKeyType + :param server_key_name: The name of the managed instance key. + :type server_key_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 + ManagedInstanceEncryptionProtector or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ManagedInstanceEncryptionProtector] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.sql.models.ManagedInstanceEncryptionProtector]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + server_key_type=server_key_type, + server_key_name=server_key_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ManagedInstanceEncryptionProtector', 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/managedInstances/{managedInstanceName}/encryptionProtector/{encryptionProtectorName}'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/managed_instance_keys_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/managed_instance_keys_operations.py new file mode 100644 index 000000000000..adb5c4bfa0f0 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/managed_instance_keys_operations.py @@ -0,0 +1,386 @@ +# 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 ManagedInstanceKeysOperations(object): + """ManagedInstanceKeysOperations 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: "2017-10-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-10-01-preview" + + self.config = config + + def list_by_instance( + self, resource_group_name, managed_instance_name, filter=None, custom_headers=None, raw=False, **operation_config): + """Gets a list of managed instance keys. + + :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 managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param filter: An OData filter expression that filters elements in the + collection. + :type filter: 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 ManagedInstanceKey + :rtype: + ~azure.mgmt.sql.models.ManagedInstanceKeyPaged[~azure.mgmt.sql.models.ManagedInstanceKey] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_instance.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_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 = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + 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.ManagedInstanceKeyPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ManagedInstanceKeyPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_instance.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/keys'} + + def get( + self, resource_group_name, managed_instance_name, key_name, custom_headers=None, raw=False, **operation_config): + """Gets a managed instance key. + + :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 managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param key_name: The name of the managed instance key to be retrieved. + :type key_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: ManagedInstanceKey or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.ManagedInstanceKey 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'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'keyName': self._serialize.url("key_name", key_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('ManagedInstanceKey', 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/managedInstances/{managedInstanceName}/keys/{keyName}'} + + + def _create_or_update_initial( + self, resource_group_name, managed_instance_name, key_name, server_key_type, uri=None, custom_headers=None, raw=False, **operation_config): + parameters = models.ManagedInstanceKey(server_key_type=server_key_type, uri=uri) + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'keyName': self._serialize.url("key_name", key_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, 'ManagedInstanceKey') + + # 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, 201, 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('ManagedInstanceKey', response) + if response.status_code == 201: + deserialized = self._deserialize('ManagedInstanceKey', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, managed_instance_name, key_name, server_key_type, uri=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates or updates a managed instance key. + + :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 managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param key_name: The name of the managed instance key to be operated + on (updated or created). + :type key_name: str + :param server_key_type: The key type like 'ServiceManaged', + 'AzureKeyVault'. Possible values include: 'ServiceManaged', + 'AzureKeyVault' + :type server_key_type: str or ~azure.mgmt.sql.models.ServerKeyType + :param uri: The URI of the key. If the ServerKeyType is AzureKeyVault, + then the URI is required. + :type uri: 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 ManagedInstanceKey or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ManagedInstanceKey] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.sql.models.ManagedInstanceKey]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + key_name=key_name, + server_key_type=server_key_type, + uri=uri, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ManagedInstanceKey', 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/managedInstances/{managedInstanceName}/keys/{keyName}'} + + + def _delete_initial( + self, resource_group_name, managed_instance_name, key_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'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'keyName': self._serialize.url("key_name", key_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, managed_instance_name, key_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes the managed instance key with the 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 managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param key_name: The name of the managed instance key to be deleted. + :type key_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, + managed_instance_name=managed_instance_name, + key_name=key_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/managedInstances/{managedInstanceName}/keys/{keyName}'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py index b1ff7e733b52..7e9565401e69 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py +++ b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py @@ -78,6 +78,8 @@ from .operations.backup_short_term_retention_policies_operations import BackupShortTermRetentionPoliciesOperations from .operations.tde_certificates_operations import TdeCertificatesOperations from .operations.managed_instance_tde_certificates_operations import ManagedInstanceTdeCertificatesOperations +from .operations.managed_instance_keys_operations import ManagedInstanceKeysOperations +from .operations.managed_instance_encryption_protectors_operations import ManagedInstanceEncryptionProtectorsOperations from . import models @@ -250,6 +252,10 @@ class SqlManagementClient(SDKClient): :vartype tde_certificates: azure.mgmt.sql.operations.TdeCertificatesOperations :ivar managed_instance_tde_certificates: ManagedInstanceTdeCertificates operations :vartype managed_instance_tde_certificates: azure.mgmt.sql.operations.ManagedInstanceTdeCertificatesOperations + :ivar managed_instance_keys: ManagedInstanceKeys operations + :vartype managed_instance_keys: azure.mgmt.sql.operations.ManagedInstanceKeysOperations + :ivar managed_instance_encryption_protectors: ManagedInstanceEncryptionProtectors operations + :vartype managed_instance_encryption_protectors: azure.mgmt.sql.operations.ManagedInstanceEncryptionProtectorsOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -400,3 +406,7 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.managed_instance_tde_certificates = ManagedInstanceTdeCertificatesOperations( self._client, self.config, self._serialize, self._deserialize) + self.managed_instance_keys = ManagedInstanceKeysOperations( + self._client, self.config, self._serialize, self._deserialize) + self.managed_instance_encryption_protectors = ManagedInstanceEncryptionProtectorsOperations( + self._client, self.config, self._serialize, self._deserialize) From 41e6b1cb5c80a83875b9d10560e9e59e18575a17 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 10 Sep 2018 15:37:18 -0700 Subject: [PATCH 13/19] [AutoPR sql/resource-manager] Remove sensitivityLabels from sql readme.md (#3296) * Generated from d49a9a7c5467546766948196e4ea8604951dbd1f Remove sensitivityLabels from sql readme.md There is a temporary issue with publishing the SDK containing this API, so it is removed from readme.md to avoid generating SDK. * Packaging update of azure-mgmt-sql --- azure-mgmt-sql/README.rst | 2 +- .../azure/mgmt/sql/models/__init__.py | 7 - .../mgmt/sql/models/sensitivity_label.py | 50 -- .../sql/models/sensitivity_label_paged.py | 27 -- .../mgmt/sql/models/sensitivity_label_py3.py | 50 -- .../sql/models/sql_management_client_enums.py | 6 - .../azure/mgmt/sql/operations/__init__.py | 2 - .../sensitivity_labels_operations.py | 444 ------------------ .../azure/mgmt/sql/sql_management_client.py | 5 - azure-mgmt-sql/setup.py | 4 +- 10 files changed, 4 insertions(+), 593 deletions(-) delete mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label.py delete mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label_paged.py delete mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label_py3.py delete mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/sensitivity_labels_operations.py diff --git a/azure-mgmt-sql/README.rst b/azure-mgmt-sql/README.rst index be2356da21f0..ba4322ebd16e 100644 --- a/azure-mgmt-sql/README.rst +++ b/azure-mgmt-sql/README.rst @@ -6,7 +6,7 @@ This is the Microsoft Azure SQL Management Client Library. Azure Resource Manager (ARM) is the next generation of management APIs that replace the old Azure Service Management (ASM). -This package has been tested with Python 2.7, 3.4, 3.5 and 3.6. +This package has been tested with Python 2.7, 3.4, 3.5, 3.6 and 3.7. For the older Azure Service Management (ASM) libraries, see `azure-servicemanagement-legacy `__ library. diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py index f433597e9952..418c82c016ae 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py @@ -107,7 +107,6 @@ from .complete_database_restore_definition_py3 import CompleteDatabaseRestoreDefinition from .managed_database_py3 import ManagedDatabase from .managed_database_update_py3 import ManagedDatabaseUpdate - from .sensitivity_label_py3 import SensitivityLabel from .automatic_tuning_server_options_py3 import AutomaticTuningServerOptions from .server_automatic_tuning_py3 import ServerAutomaticTuning from .server_dns_alias_py3 import ServerDnsAlias @@ -250,7 +249,6 @@ from .complete_database_restore_definition import CompleteDatabaseRestoreDefinition from .managed_database import ManagedDatabase from .managed_database_update import ManagedDatabaseUpdate - from .sensitivity_label import SensitivityLabel from .automatic_tuning_server_options import AutomaticTuningServerOptions from .server_automatic_tuning import ServerAutomaticTuning from .server_dns_alias import ServerDnsAlias @@ -340,7 +338,6 @@ from .job_version_paged import JobVersionPaged from .long_term_retention_backup_paged import LongTermRetentionBackupPaged from .managed_database_paged import ManagedDatabasePaged -from .sensitivity_label_paged import SensitivityLabelPaged from .server_dns_alias_paged import ServerDnsAliasPaged from .restore_point_paged import RestorePointPaged from .database_operation_paged import DatabaseOperationPaged @@ -426,7 +423,6 @@ InstanceFailoverGroupReplicationRole, LongTermRetentionDatabaseState, VulnerabilityAssessmentPolicyBaselineName, - SensitivityLabelSource, CapabilityGroup, ) @@ -528,7 +524,6 @@ 'CompleteDatabaseRestoreDefinition', 'ManagedDatabase', 'ManagedDatabaseUpdate', - 'SensitivityLabel', 'AutomaticTuningServerOptions', 'ServerAutomaticTuning', 'ServerDnsAlias', @@ -618,7 +613,6 @@ 'JobVersionPaged', 'LongTermRetentionBackupPaged', 'ManagedDatabasePaged', - 'SensitivityLabelPaged', 'ServerDnsAliasPaged', 'RestorePointPaged', 'DatabaseOperationPaged', @@ -703,6 +697,5 @@ 'InstanceFailoverGroupReplicationRole', 'LongTermRetentionDatabaseState', 'VulnerabilityAssessmentPolicyBaselineName', - 'SensitivityLabelSource', 'CapabilityGroup', ] diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label.py b/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label.py deleted file mode 100644 index 27d34d57c142..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label.py +++ /dev/null @@ -1,50 +0,0 @@ -# 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 SensitivityLabel(ProxyResource): - """A sensitivity label. - - 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 label_name: The label name. - :type label_name: str - :param information_type: The information type. - :type information_type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'label_name': {'key': 'properties.labelName', 'type': 'str'}, - 'information_type': {'key': 'properties.informationType', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(SensitivityLabel, self).__init__(**kwargs) - self.label_name = kwargs.get('label_name', None) - self.information_type = kwargs.get('information_type', None) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label_paged.py deleted file mode 100644 index 438bfd86f9be..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label_paged.py +++ /dev/null @@ -1,27 +0,0 @@ -# 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 SensitivityLabelPaged(Paged): - """ - A paging container for iterating over a list of :class:`SensitivityLabel ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SensitivityLabel]'} - } - - def __init__(self, *args, **kwargs): - - super(SensitivityLabelPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label_py3.py deleted file mode 100644 index adbb7a203e1a..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label_py3.py +++ /dev/null @@ -1,50 +0,0 @@ -# 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 SensitivityLabel(ProxyResource): - """A sensitivity label. - - 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 label_name: The label name. - :type label_name: str - :param information_type: The information type. - :type information_type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'label_name': {'key': 'properties.labelName', 'type': 'str'}, - 'information_type': {'key': 'properties.informationType', 'type': 'str'}, - } - - def __init__(self, *, label_name: str=None, information_type: str=None, **kwargs) -> None: - super(SensitivityLabel, self).__init__(**kwargs) - self.label_name = label_name - self.information_type = information_type diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py b/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py index 325c2d06c5da..90b01d122079 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py @@ -663,12 +663,6 @@ class VulnerabilityAssessmentPolicyBaselineName(str, Enum): default = "default" -class SensitivityLabelSource(str, Enum): - - current = "current" - recommended = "recommended" - - class CapabilityGroup(str, Enum): supported_editions = "supportedEditions" diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py index f512225ab333..cdc84cd45c56 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py @@ -61,7 +61,6 @@ from .long_term_retention_backups_operations import LongTermRetentionBackupsOperations from .backup_long_term_retention_policies_operations import BackupLongTermRetentionPoliciesOperations from .managed_databases_operations import ManagedDatabasesOperations -from .sensitivity_labels_operations import SensitivityLabelsOperations from .server_automatic_tuning_operations import ServerAutomaticTuningOperations from .server_dns_aliases_operations import ServerDnsAliasesOperations from .server_security_alert_policies_operations import ServerSecurityAlertPoliciesOperations @@ -130,7 +129,6 @@ 'LongTermRetentionBackupsOperations', 'BackupLongTermRetentionPoliciesOperations', 'ManagedDatabasesOperations', - 'SensitivityLabelsOperations', 'ServerAutomaticTuningOperations', 'ServerDnsAliasesOperations', 'ServerSecurityAlertPoliciesOperations', diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/sensitivity_labels_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/sensitivity_labels_operations.py deleted file mode 100644 index a17299fb19d0..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/sensitivity_labels_operations.py +++ /dev/null @@ -1,444 +0,0 @@ -# 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 .. import models - - -class SensitivityLabelsOperations(object): - """SensitivityLabelsOperations 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: "2017-03-01-preview". - :ivar sensitivity_label_source: The source of the sensitivity label. Constant value: "current". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2017-03-01-preview" - self.sensitivity_label_source = "current" - - self.config = config - - def list_by_database( - self, resource_group_name, server_name, database_name, filter=None, custom_headers=None, raw=False, **operation_config): - """Gets the sensitivity labels of a given database. - - :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 database_name: The name of the database. - :type database_name: str - :param filter: An OData filter expression that filters elements in the - collection. - :type filter: 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 SensitivityLabel - :rtype: - ~azure.mgmt.sql.models.SensitivityLabelPaged[~azure.mgmt.sql.models.SensitivityLabel] - :raises: :class:`CloudError` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_database.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'), - 'databaseName': self._serialize.url("database_name", database_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 = {} - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - 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.SensitivityLabelPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.SensitivityLabelPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sensitivityLabels'} - - def list_by_database_with_source( - self, resource_group_name, server_name, database_name, sensitivity_label_source, filter=None, custom_headers=None, raw=False, **operation_config): - """Gets the sensitivity labels of a given database. - - :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 database_name: The name of the database. - :type database_name: str - :param sensitivity_label_source: Optional source of the sensitivity - label. Valid values are current or recommeneded. In not specified both - returned. Possible values include: 'current', 'recommended' - :type sensitivity_label_source: str or - ~azure.mgmt.sql.models.SensitivityLabelSource - :param filter: An OData filter expression that filters elements in the - collection. - :type filter: 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 SensitivityLabel - :rtype: - ~azure.mgmt.sql.models.SensitivityLabelPaged[~azure.mgmt.sql.models.SensitivityLabel] - :raises: :class:`CloudError` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_database_with_source.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'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'sensitivityLabelSource': self._serialize.url("sensitivity_label_source", sensitivity_label_source, 'SensitivityLabelSource'), - '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 = {} - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - 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.SensitivityLabelPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.SensitivityLabelPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_by_database_with_source.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sensitivityLabels/{sensitivityLabelSource}'} - - def get( - self, resource_group_name, server_name, database_name, schema_name, table_name, column_name, sensitivity_label_source, custom_headers=None, raw=False, **operation_config): - """Gets the sensitivity label of a given column. - - :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 database_name: The name of the database. - :type database_name: str - :param schema_name: The name of the schema. - :type schema_name: str - :param table_name: The name of the table. - :type table_name: str - :param column_name: The name of the column. - :type column_name: str - :param sensitivity_label_source: The source of the sensitivity label. - Possible values include: 'current', 'recommended' - :type sensitivity_label_source: str or - ~azure.mgmt.sql.models.SensitivityLabelSource - :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: SensitivityLabel or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.sql.models.SensitivityLabel 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'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), - 'tableName': self._serialize.url("table_name", table_name, 'str'), - 'columnName': self._serialize.url("column_name", column_name, 'str'), - 'sensitivityLabelSource': self._serialize.url("sensitivity_label_source", sensitivity_label_source, 'SensitivityLabelSource'), - '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('SensitivityLabel', 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}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}'} - - def create_or_update( - self, resource_group_name, server_name, database_name, schema_name, table_name, column_name, label_name=None, information_type=None, custom_headers=None, raw=False, **operation_config): - """Creates or updates the sensitivity label of a given column. - - :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 database_name: The name of the database. - :type database_name: str - :param schema_name: The name of the schema. - :type schema_name: str - :param table_name: The name of the table. - :type table_name: str - :param column_name: The name of the column. - :type column_name: str - :param label_name: The label name. - :type label_name: str - :param information_type: The information type. - :type information_type: 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: SensitivityLabel or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.sql.models.SensitivityLabel or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - parameters = models.SensitivityLabel(label_name=label_name, information_type=information_type) - - # 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'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), - 'tableName': self._serialize.url("table_name", table_name, 'str'), - 'columnName': self._serialize.url("column_name", column_name, 'str'), - 'sensitivityLabelSource': self._serialize.url("self.sensitivity_label_source", self.sensitivity_label_source, '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, 'SensitivityLabel') - - # 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, 201]: - 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('SensitivityLabel', response) - if response.status_code == 201: - deserialized = self._deserialize('SensitivityLabel', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}'} - - def delete( - self, resource_group_name, server_name, database_name, schema_name, table_name, column_name, custom_headers=None, raw=False, **operation_config): - """Deletes the sensitivity label of a given column. - - :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 database_name: The name of the database. - :type database_name: str - :param schema_name: The name of the schema. - :type schema_name: str - :param table_name: The name of the table. - :type table_name: str - :param column_name: The name of the column. - :type column_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: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # 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'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), - 'tableName': self._serialize.url("table_name", table_name, 'str'), - 'columnName': self._serialize.url("column_name", column_name, 'str'), - 'sensitivityLabelSource': self._serialize.url("self.sensitivity_label_source", self.sensitivity_label_source, '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]: - 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 - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py index 7e9565401e69..d96e32c1ebaa 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py +++ b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py @@ -65,7 +65,6 @@ from .operations.long_term_retention_backups_operations import LongTermRetentionBackupsOperations from .operations.backup_long_term_retention_policies_operations import BackupLongTermRetentionPoliciesOperations from .operations.managed_databases_operations import ManagedDatabasesOperations -from .operations.sensitivity_labels_operations import SensitivityLabelsOperations from .operations.server_automatic_tuning_operations import ServerAutomaticTuningOperations from .operations.server_dns_aliases_operations import ServerDnsAliasesOperations from .operations.server_security_alert_policies_operations import ServerSecurityAlertPoliciesOperations @@ -226,8 +225,6 @@ class SqlManagementClient(SDKClient): :vartype backup_long_term_retention_policies: azure.mgmt.sql.operations.BackupLongTermRetentionPoliciesOperations :ivar managed_databases: ManagedDatabases operations :vartype managed_databases: azure.mgmt.sql.operations.ManagedDatabasesOperations - :ivar sensitivity_labels: SensitivityLabels operations - :vartype sensitivity_labels: azure.mgmt.sql.operations.SensitivityLabelsOperations :ivar server_automatic_tuning: ServerAutomaticTuning operations :vartype server_automatic_tuning: azure.mgmt.sql.operations.ServerAutomaticTuningOperations :ivar server_dns_aliases: ServerDnsAliases operations @@ -380,8 +377,6 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.managed_databases = ManagedDatabasesOperations( self._client, self.config, self._serialize, self._deserialize) - self.sensitivity_labels = SensitivityLabelsOperations( - self._client, self.config, self._serialize, self._deserialize) self.server_automatic_tuning = ServerAutomaticTuningOperations( self._client, self.config, self._serialize, self._deserialize) self.server_dns_aliases = ServerDnsAliasesOperations( diff --git a/azure-mgmt-sql/setup.py b/azure-mgmt-sql/setup.py index c4492c11a4a0..bf699f63001d 100644 --- a/azure-mgmt-sql/setup.py +++ b/azure-mgmt-sql/setup.py @@ -72,12 +72,14 @@ 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', 'License :: OSI Approved :: MIT License', ], zip_safe=False, packages=find_packages(exclude=["tests"]), install_requires=[ - 'msrestazure>=0.4.27,<2.0.0', + 'msrest>=0.5.0', + 'msrestazure>=0.4.32,<2.0.0', 'azure-common~=1.1', ], cmdclass=cmdclass From da75ff69c1e895d6ddfcb9312ac660e322a7b105 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 17 Sep 2018 09:58:06 -0700 Subject: [PATCH 14/19] Generated from ae5e50da51607b6c59745d9d2969c4f6acba0d81 (#3326) Add algorithm types to threat detection disabled alerts description Added Data_Exfiltration and Unsafe_Action as allowed values to disabled alert. --- .../azure/mgmt/sql/models/database_security_alert_policy.py | 3 ++- .../mgmt/sql/models/database_security_alert_policy_py3.py | 3 ++- .../azure/mgmt/sql/models/server_security_alert_policy.py | 2 +- .../azure/mgmt/sql/models/server_security_alert_policy_py3.py | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/database_security_alert_policy.py b/azure-mgmt-sql/azure/mgmt/sql/models/database_security_alert_policy.py index ce511c006b99..c425573a5a91 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/database_security_alert_policy.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/database_security_alert_policy.py @@ -36,7 +36,8 @@ class DatabaseSecurityAlertPolicy(ProxyResource): :type state: str or ~azure.mgmt.sql.models.SecurityAlertPolicyState :param disabled_alerts: Specifies the semicolon-separated list of alerts that are disabled, or empty string to disable no alerts. Possible values: - Sql_Injection; Sql_Injection_Vulnerability; Access_Anomaly; Usage_Anomaly. + Sql_Injection; Sql_Injection_Vulnerability; Access_Anomaly; + Data_Exfiltration; Unsafe_Action. :type disabled_alerts: str :param email_addresses: Specifies the semicolon-separated list of e-mail addresses to which the alert is sent. diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/database_security_alert_policy_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/database_security_alert_policy_py3.py index 8967d6a6e0f1..3d85e01a6635 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/database_security_alert_policy_py3.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/database_security_alert_policy_py3.py @@ -36,7 +36,8 @@ class DatabaseSecurityAlertPolicy(ProxyResource): :type state: str or ~azure.mgmt.sql.models.SecurityAlertPolicyState :param disabled_alerts: Specifies the semicolon-separated list of alerts that are disabled, or empty string to disable no alerts. Possible values: - Sql_Injection; Sql_Injection_Vulnerability; Access_Anomaly; Usage_Anomaly. + Sql_Injection; Sql_Injection_Vulnerability; Access_Anomaly; + Data_Exfiltration; Unsafe_Action. :type disabled_alerts: str :param email_addresses: Specifies the semicolon-separated list of e-mail addresses to which the alert is sent. diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy.py index 4e5d69dbcd27..04e3ddc44869 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy.py @@ -31,7 +31,7 @@ class ServerSecurityAlertPolicy(ProxyResource): :type state: str or ~azure.mgmt.sql.models.SecurityAlertPolicyState :param disabled_alerts: Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, - Access_Anomaly + Access_Anomaly, Data_Exfiltration, Unsafe_Action :type disabled_alerts: list[str] :param email_addresses: Specifies an array of e-mail addresses to which the alert is sent. diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy_py3.py index 2a65b5d19078..5ae9c099f3d5 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy_py3.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy_py3.py @@ -31,7 +31,7 @@ class ServerSecurityAlertPolicy(ProxyResource): :type state: str or ~azure.mgmt.sql.models.SecurityAlertPolicyState :param disabled_alerts: Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, - Access_Anomaly + Access_Anomaly, Data_Exfiltration, Unsafe_Action :type disabled_alerts: list[str] :param email_addresses: Specifies an array of e-mail addresses to which the alert is sent. From e240aa1dd58f49946ee19e95818754f37f03ee7d Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 18 Sep 2018 13:34:07 -0700 Subject: [PATCH 15/19] [AutoPR sql/resource-manager] Swagger Changes to Add DnsZonePartner and Collation into Managed Instance (#3323) * Generated from d2e5203aaa23dc19a85a7242ff35baf7f45a5a54 Merge branch 'master' of https://github.com/ziwa-msft/azure-rest-api-specs * Generated from c4ce7b1e5f908cad7a0e13b6d9f5e2cbc54fce45 Manually removing specific definations for SKU and ResourceIdentity * Generated from 4e408cf25e90c40117abd3e7672f42187936a80d Fix indentations and misspel --- .../azure/mgmt/sql/models/managed_instance.py | 15 +++++++++++++++ .../mgmt/sql/models/managed_instance_py3.py | 17 ++++++++++++++++- .../mgmt/sql/models/managed_instance_update.py | 15 +++++++++++++++ .../sql/models/managed_instance_update_py3.py | 17 ++++++++++++++++- 4 files changed, 62 insertions(+), 2 deletions(-) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance.py b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance.py index 9239f4aa347d..8a3224e3c54f 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance.py @@ -56,6 +56,13 @@ class ManagedInstance(TrackedResource): :type v_cores: int :param storage_size_in_gb: The maximum storage size in GB. :type storage_size_in_gb: int + :ivar collation: Collation of the managed instance. + :vartype collation: str + :ivar dns_zone: The Dns Zone that the managed instance is in. + :vartype dns_zone: str + :param dns_zone_partner: The resource id of another managed instance whose + DNS zone this managed instance will share after creation. + :type dns_zone_partner: str """ _validation = { @@ -65,6 +72,8 @@ class ManagedInstance(TrackedResource): 'location': {'required': True}, 'fully_qualified_domain_name': {'readonly': True}, 'state': {'readonly': True}, + 'collation': {'readonly': True}, + 'dns_zone': {'readonly': True}, } _attribute_map = { @@ -83,6 +92,9 @@ class ManagedInstance(TrackedResource): 'license_type': {'key': 'properties.licenseType', 'type': 'str'}, 'v_cores': {'key': 'properties.vCores', 'type': 'int'}, 'storage_size_in_gb': {'key': 'properties.storageSizeInGB', 'type': 'int'}, + 'collation': {'key': 'properties.collation', 'type': 'str'}, + 'dns_zone': {'key': 'properties.dnsZone', 'type': 'str'}, + 'dns_zone_partner': {'key': 'properties.dnsZonePartner', 'type': 'str'}, } def __init__(self, **kwargs): @@ -97,3 +109,6 @@ def __init__(self, **kwargs): self.license_type = kwargs.get('license_type', None) self.v_cores = kwargs.get('v_cores', None) self.storage_size_in_gb = kwargs.get('storage_size_in_gb', None) + self.collation = None + self.dns_zone = None + self.dns_zone_partner = kwargs.get('dns_zone_partner', None) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_py3.py index 1cf2899bbfee..53f212f4973f 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_py3.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_py3.py @@ -56,6 +56,13 @@ class ManagedInstance(TrackedResource): :type v_cores: int :param storage_size_in_gb: The maximum storage size in GB. :type storage_size_in_gb: int + :ivar collation: Collation of the managed instance. + :vartype collation: str + :ivar dns_zone: The Dns Zone that the managed instance is in. + :vartype dns_zone: str + :param dns_zone_partner: The resource id of another managed instance whose + DNS zone this managed instance will share after creation. + :type dns_zone_partner: str """ _validation = { @@ -65,6 +72,8 @@ class ManagedInstance(TrackedResource): 'location': {'required': True}, 'fully_qualified_domain_name': {'readonly': True}, 'state': {'readonly': True}, + 'collation': {'readonly': True}, + 'dns_zone': {'readonly': True}, } _attribute_map = { @@ -83,9 +92,12 @@ class ManagedInstance(TrackedResource): 'license_type': {'key': 'properties.licenseType', 'type': 'str'}, 'v_cores': {'key': 'properties.vCores', 'type': 'int'}, 'storage_size_in_gb': {'key': 'properties.storageSizeInGB', 'type': 'int'}, + 'collation': {'key': 'properties.collation', 'type': 'str'}, + 'dns_zone': {'key': 'properties.dnsZone', 'type': 'str'}, + 'dns_zone_partner': {'key': 'properties.dnsZonePartner', 'type': 'str'}, } - def __init__(self, *, location: str, tags=None, identity=None, sku=None, administrator_login: str=None, administrator_login_password: str=None, subnet_id: str=None, license_type: str=None, v_cores: int=None, storage_size_in_gb: int=None, **kwargs) -> None: + def __init__(self, *, location: str, tags=None, identity=None, sku=None, administrator_login: str=None, administrator_login_password: str=None, subnet_id: str=None, license_type: str=None, v_cores: int=None, storage_size_in_gb: int=None, dns_zone_partner: str=None, **kwargs) -> None: super(ManagedInstance, self).__init__(location=location, tags=tags, **kwargs) self.identity = identity self.sku = sku @@ -97,3 +109,6 @@ def __init__(self, *, location: str, tags=None, identity=None, sku=None, adminis self.license_type = license_type self.v_cores = v_cores self.storage_size_in_gb = storage_size_in_gb + self.collation = None + self.dns_zone = None + self.dns_zone_partner = dns_zone_partner diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_update.py b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_update.py index 7ea51f29ddff..1a259b1e3530 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_update.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_update.py @@ -41,6 +41,13 @@ class ManagedInstanceUpdate(Model): :type v_cores: int :param storage_size_in_gb: The maximum storage size in GB. :type storage_size_in_gb: int + :ivar collation: Collation of the managed instance. + :vartype collation: str + :ivar dns_zone: The Dns Zone that the managed instance is in. + :vartype dns_zone: str + :param dns_zone_partner: The resource id of another managed instance whose + DNS zone this managed instance will share after creation. + :type dns_zone_partner: str :param tags: Resource tags. :type tags: dict[str, str] """ @@ -48,6 +55,8 @@ class ManagedInstanceUpdate(Model): _validation = { 'fully_qualified_domain_name': {'readonly': True}, 'state': {'readonly': True}, + 'collation': {'readonly': True}, + 'dns_zone': {'readonly': True}, } _attribute_map = { @@ -60,6 +69,9 @@ class ManagedInstanceUpdate(Model): 'license_type': {'key': 'properties.licenseType', 'type': 'str'}, 'v_cores': {'key': 'properties.vCores', 'type': 'int'}, 'storage_size_in_gb': {'key': 'properties.storageSizeInGB', 'type': 'int'}, + 'collation': {'key': 'properties.collation', 'type': 'str'}, + 'dns_zone': {'key': 'properties.dnsZone', 'type': 'str'}, + 'dns_zone_partner': {'key': 'properties.dnsZonePartner', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, } @@ -74,4 +86,7 @@ def __init__(self, **kwargs): self.license_type = kwargs.get('license_type', None) self.v_cores = kwargs.get('v_cores', None) self.storage_size_in_gb = kwargs.get('storage_size_in_gb', None) + self.collation = None + self.dns_zone = None + self.dns_zone_partner = kwargs.get('dns_zone_partner', None) self.tags = kwargs.get('tags', None) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_update_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_update_py3.py index 0adbe5f439f8..205b2d2063f8 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_update_py3.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_update_py3.py @@ -41,6 +41,13 @@ class ManagedInstanceUpdate(Model): :type v_cores: int :param storage_size_in_gb: The maximum storage size in GB. :type storage_size_in_gb: int + :ivar collation: Collation of the managed instance. + :vartype collation: str + :ivar dns_zone: The Dns Zone that the managed instance is in. + :vartype dns_zone: str + :param dns_zone_partner: The resource id of another managed instance whose + DNS zone this managed instance will share after creation. + :type dns_zone_partner: str :param tags: Resource tags. :type tags: dict[str, str] """ @@ -48,6 +55,8 @@ class ManagedInstanceUpdate(Model): _validation = { 'fully_qualified_domain_name': {'readonly': True}, 'state': {'readonly': True}, + 'collation': {'readonly': True}, + 'dns_zone': {'readonly': True}, } _attribute_map = { @@ -60,10 +69,13 @@ class ManagedInstanceUpdate(Model): 'license_type': {'key': 'properties.licenseType', 'type': 'str'}, 'v_cores': {'key': 'properties.vCores', 'type': 'int'}, 'storage_size_in_gb': {'key': 'properties.storageSizeInGB', 'type': 'int'}, + 'collation': {'key': 'properties.collation', 'type': 'str'}, + 'dns_zone': {'key': 'properties.dnsZone', 'type': 'str'}, + 'dns_zone_partner': {'key': 'properties.dnsZonePartner', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, sku=None, administrator_login: str=None, administrator_login_password: str=None, subnet_id: str=None, license_type: str=None, v_cores: int=None, storage_size_in_gb: int=None, tags=None, **kwargs) -> None: + def __init__(self, *, sku=None, administrator_login: str=None, administrator_login_password: str=None, subnet_id: str=None, license_type: str=None, v_cores: int=None, storage_size_in_gb: int=None, dns_zone_partner: str=None, tags=None, **kwargs) -> None: super(ManagedInstanceUpdate, self).__init__(**kwargs) self.sku = sku self.fully_qualified_domain_name = None @@ -74,4 +86,7 @@ def __init__(self, *, sku=None, administrator_login: str=None, administrator_log self.license_type = license_type self.v_cores = v_cores self.storage_size_in_gb = storage_size_in_gb + self.collation = None + self.dns_zone = None + self.dns_zone_partner = dns_zone_partner self.tags = tags From 28f17e750c84c1804f674c43cdba0b46c0f2fb98 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 4 Oct 2018 16:43:16 -0700 Subject: [PATCH 16/19] [AutoPR sql/resource-manager] Adding VA support for manged instance - Update readme.md (#3482) * Generated from 1d3074c3f3f50b396875f414d62eec4195234f83 Update readme.md * Packaging update of azure-mgmt-sql --- azure-mgmt-sql/MANIFEST.in | 1 - azure-mgmt-sql/azure/__init__.py | 2 +- azure-mgmt-sql/azure/mgmt/__init__.py | 2 +- .../azure/mgmt/sql/operations/__init__.py | 6 + ...ty_assessment_rule_baselines_operations.py | 281 ++++++++++++++ ...lnerability_assessment_scans_operations.py | 359 ++++++++++++++++++ ...se_vulnerability_assessments_operations.py | 249 ++++++++++++ .../azure/mgmt/sql/sql_management_client.py | 15 + azure-mgmt-sql/azure_bdist_wheel.py | 54 --- azure-mgmt-sql/setup.cfg | 1 - azure-mgmt-sql/setup.py | 17 +- 11 files changed, 921 insertions(+), 66 deletions(-) create mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/managed_database_vulnerability_assessment_rule_baselines_operations.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/managed_database_vulnerability_assessment_scans_operations.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/managed_database_vulnerability_assessments_operations.py delete mode 100644 azure-mgmt-sql/azure_bdist_wheel.py diff --git a/azure-mgmt-sql/MANIFEST.in b/azure-mgmt-sql/MANIFEST.in index 9ecaeb15de50..bb37a2723dae 100644 --- a/azure-mgmt-sql/MANIFEST.in +++ b/azure-mgmt-sql/MANIFEST.in @@ -1,2 +1 @@ include *.rst -include azure_bdist_wheel.py \ No newline at end of file diff --git a/azure-mgmt-sql/azure/__init__.py b/azure-mgmt-sql/azure/__init__.py index 849489fca33c..0260537a02bb 100644 --- a/azure-mgmt-sql/azure/__init__.py +++ b/azure-mgmt-sql/azure/__init__.py @@ -1 +1 @@ -__import__('pkg_resources').declare_namespace(__name__) +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/azure-mgmt-sql/azure/mgmt/__init__.py b/azure-mgmt-sql/azure/mgmt/__init__.py index 849489fca33c..0260537a02bb 100644 --- a/azure-mgmt-sql/azure/mgmt/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/__init__.py @@ -1 +1 @@ -__import__('pkg_resources').declare_namespace(__name__) +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py index cdc84cd45c56..7f9a32996a5b 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py @@ -69,6 +69,9 @@ from .elastic_pool_operations import ElasticPoolOperations from .capabilities_operations import CapabilitiesOperations from .database_vulnerability_assessment_scans_operations import DatabaseVulnerabilityAssessmentScansOperations +from .managed_database_vulnerability_assessment_rule_baselines_operations import ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations +from .managed_database_vulnerability_assessment_scans_operations import ManagedDatabaseVulnerabilityAssessmentScansOperations +from .managed_database_vulnerability_assessments_operations import ManagedDatabaseVulnerabilityAssessmentsOperations from .instance_failover_groups_operations import InstanceFailoverGroupsOperations from .backup_short_term_retention_policies_operations import BackupShortTermRetentionPoliciesOperations from .tde_certificates_operations import TdeCertificatesOperations @@ -137,6 +140,9 @@ 'ElasticPoolOperations', 'CapabilitiesOperations', 'DatabaseVulnerabilityAssessmentScansOperations', + 'ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations', + 'ManagedDatabaseVulnerabilityAssessmentScansOperations', + 'ManagedDatabaseVulnerabilityAssessmentsOperations', 'InstanceFailoverGroupsOperations', 'BackupShortTermRetentionPoliciesOperations', 'TdeCertificatesOperations', diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/managed_database_vulnerability_assessment_rule_baselines_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/managed_database_vulnerability_assessment_rule_baselines_operations.py new file mode 100644 index 000000000000..bf5121b3707b --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/managed_database_vulnerability_assessment_rule_baselines_operations.py @@ -0,0 +1,281 @@ +# 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 .. import models + + +class ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations(object): + """ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations 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 vulnerability_assessment_name: The name of the vulnerability assessment. Constant value: "default". + :ivar api_version: The API version to use for the request. Constant value: "2017-10-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.vulnerability_assessment_name = "default" + self.api_version = "2017-10-01-preview" + + self.config = config + + def get( + self, resource_group_name, managed_instance_name, database_name, rule_id, baseline_name, custom_headers=None, raw=False, **operation_config): + """Gets a database's vulnerability assessment rule baseline. + + :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 managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the database for which the + vulnerability assessment rule baseline is defined. + :type database_name: str + :param rule_id: The vulnerability assessment rule ID. + :type rule_id: str + :param baseline_name: The name of the vulnerability assessment rule + baseline (default implies a baseline on a database level rule and + master for server level rule). Possible values include: 'master', + 'default' + :type baseline_name: str or + ~azure.mgmt.sql.models.VulnerabilityAssessmentPolicyBaselineName + :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: DatabaseVulnerabilityAssessmentRuleBaseline or + ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.sql.models.DatabaseVulnerabilityAssessmentRuleBaseline 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'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_name, 'str'), + 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), + 'baselineName': self._serialize.url("baseline_name", baseline_name, 'VulnerabilityAssessmentPolicyBaselineName'), + '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('DatabaseVulnerabilityAssessmentRuleBaseline', 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/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}'} + + def create_or_update( + self, resource_group_name, managed_instance_name, database_name, rule_id, baseline_name, baseline_results, custom_headers=None, raw=False, **operation_config): + """Creates or updates a database's vulnerability assessment rule baseline. + + :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 managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the database for which the + vulnerability assessment rule baseline is defined. + :type database_name: str + :param rule_id: The vulnerability assessment rule ID. + :type rule_id: str + :param baseline_name: The name of the vulnerability assessment rule + baseline (default implies a baseline on a database level rule and + master for server level rule). Possible values include: 'master', + 'default' + :type baseline_name: str or + ~azure.mgmt.sql.models.VulnerabilityAssessmentPolicyBaselineName + :param baseline_results: The rule baseline result + :type baseline_results: + list[~azure.mgmt.sql.models.DatabaseVulnerabilityAssessmentRuleBaselineItem] + :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: DatabaseVulnerabilityAssessmentRuleBaseline or + ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.sql.models.DatabaseVulnerabilityAssessmentRuleBaseline or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + parameters = models.DatabaseVulnerabilityAssessmentRuleBaseline(baseline_results=baseline_results) + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_name, 'str'), + 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), + 'baselineName': self._serialize.url("baseline_name", baseline_name, 'VulnerabilityAssessmentPolicyBaselineName'), + '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, 'DatabaseVulnerabilityAssessmentRuleBaseline') + + # 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]: + 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('DatabaseVulnerabilityAssessmentRuleBaseline', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}'} + + def delete( + self, resource_group_name, managed_instance_name, database_name, rule_id, baseline_name, custom_headers=None, raw=False, **operation_config): + """Removes the database's vulnerability assessment rule baseline. + + :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 managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the database for which the + vulnerability assessment rule baseline is defined. + :type database_name: str + :param rule_id: The vulnerability assessment rule ID. + :type rule_id: str + :param baseline_name: The name of the vulnerability assessment rule + baseline (default implies a baseline on a database level rule and + master for server level rule). Possible values include: 'master', + 'default' + :type baseline_name: str or + ~azure.mgmt.sql.models.VulnerabilityAssessmentPolicyBaselineName + :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: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_name, 'str'), + 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), + 'baselineName': self._serialize.url("baseline_name", baseline_name, 'VulnerabilityAssessmentPolicyBaselineName'), + '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]: + 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 + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/managed_database_vulnerability_assessment_scans_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/managed_database_vulnerability_assessment_scans_operations.py new file mode 100644 index 000000000000..d45dc1beb3b7 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/managed_database_vulnerability_assessment_scans_operations.py @@ -0,0 +1,359 @@ +# 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 ManagedDatabaseVulnerabilityAssessmentScansOperations(object): + """ManagedDatabaseVulnerabilityAssessmentScansOperations 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 vulnerability_assessment_name: The name of the vulnerability assessment. Constant value: "default". + :ivar api_version: The API version to use for the request. Constant value: "2017-10-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.vulnerability_assessment_name = "default" + self.api_version = "2017-10-01-preview" + + self.config = config + + def list_by_database( + self, resource_group_name, managed_instance_name, database_name, custom_headers=None, raw=False, **operation_config): + """Lists the vulnerability assessment scans of a database. + + :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 managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the database. + :type database_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 + VulnerabilityAssessmentScanRecord + :rtype: + ~azure.mgmt.sql.models.VulnerabilityAssessmentScanRecordPaged[~azure.mgmt.sql.models.VulnerabilityAssessmentScanRecord] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_database.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_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.VulnerabilityAssessmentScanRecordPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.VulnerabilityAssessmentScanRecordPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans'} + + def get( + self, resource_group_name, managed_instance_name, database_name, scan_id, custom_headers=None, raw=False, **operation_config): + """Gets a vulnerability assessment scan record of a database. + + :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 managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the database. + :type database_name: str + :param scan_id: The vulnerability assessment scan Id of the scan to + retrieve. + :type scan_id: 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: VulnerabilityAssessmentScanRecord or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.sql.models.VulnerabilityAssessmentScanRecord 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'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_name, 'str'), + 'scanId': self._serialize.url("scan_id", scan_id, '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('VulnerabilityAssessmentScanRecord', 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/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}'} + + + def _initiate_scan_initial( + self, resource_group_name, managed_instance_name, database_name, scan_id, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.initiate_scan.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_name, 'str'), + 'scanId': self._serialize.url("scan_id", scan_id, '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.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 initiate_scan( + self, resource_group_name, managed_instance_name, database_name, scan_id, custom_headers=None, raw=False, polling=True, **operation_config): + """Executes a Vulnerability Assessment database scan. + + :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 managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the database. + :type database_name: str + :param scan_id: The vulnerability assessment scan Id of the scan to + retrieve. + :type scan_id: 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._initiate_scan_initial( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + database_name=database_name, + scan_id=scan_id, + 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) + initiate_scan.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan'} + + def export( + self, resource_group_name, managed_instance_name, database_name, scan_id, custom_headers=None, raw=False, **operation_config): + """Convert an existing scan result to a human readable format. If already + exists nothing happens. + + :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 managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the scanned database. + :type database_name: str + :param scan_id: The vulnerability assessment scan Id. + :type scan_id: 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: DatabaseVulnerabilityAssessmentScansExport or + ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.sql.models.DatabaseVulnerabilityAssessmentScansExport or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.export.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_name, 'str'), + 'scanId': self._serialize.url("scan_id", scan_id, '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.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + 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('DatabaseVulnerabilityAssessmentScansExport', response) + if response.status_code == 201: + deserialized = self._deserialize('DatabaseVulnerabilityAssessmentScansExport', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + export.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/export'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/managed_database_vulnerability_assessments_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/managed_database_vulnerability_assessments_operations.py new file mode 100644 index 000000000000..eed38b378fe1 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/managed_database_vulnerability_assessments_operations.py @@ -0,0 +1,249 @@ +# 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 .. import models + + +class ManagedDatabaseVulnerabilityAssessmentsOperations(object): + """ManagedDatabaseVulnerabilityAssessmentsOperations 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 vulnerability_assessment_name: The name of the vulnerability assessment. Constant value: "default". + :ivar api_version: The API version to use for the request. Constant value: "2017-10-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.vulnerability_assessment_name = "default" + self.api_version = "2017-10-01-preview" + + self.config = config + + def get( + self, resource_group_name, managed_instance_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets the database's vulnerability assessment. + + :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 managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the database for which the + vulnerability assessment is defined. + :type database_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: DatabaseVulnerabilityAssessment or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.sql.models.DatabaseVulnerabilityAssessment 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'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_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('DatabaseVulnerabilityAssessment', 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/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}'} + + def create_or_update( + self, resource_group_name, managed_instance_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates the database's vulnerability assessment. + + :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 managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the database for which the + vulnerability assessment is defined. + :type database_name: str + :param parameters: The requested resource. + :type parameters: + ~azure.mgmt.sql.models.DatabaseVulnerabilityAssessment + :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: DatabaseVulnerabilityAssessment or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.sql.models.DatabaseVulnerabilityAssessment or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_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, 'DatabaseVulnerabilityAssessment') + + # 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, 201]: + 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('DatabaseVulnerabilityAssessment', response) + if response.status_code == 201: + deserialized = self._deserialize('DatabaseVulnerabilityAssessment', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}'} + + def delete( + self, resource_group_name, managed_instance_name, database_name, custom_headers=None, raw=False, **operation_config): + """Removes the database's vulnerability assessment. + + :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 managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the database for which the + vulnerability assessment is defined. + :type database_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: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_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]: + 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 + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py index d96e32c1ebaa..2a8798e4b23d 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py +++ b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py @@ -73,6 +73,9 @@ from .operations.elastic_pool_operations import ElasticPoolOperations from .operations.capabilities_operations import CapabilitiesOperations from .operations.database_vulnerability_assessment_scans_operations import DatabaseVulnerabilityAssessmentScansOperations +from .operations.managed_database_vulnerability_assessment_rule_baselines_operations import ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations +from .operations.managed_database_vulnerability_assessment_scans_operations import ManagedDatabaseVulnerabilityAssessmentScansOperations +from .operations.managed_database_vulnerability_assessments_operations import ManagedDatabaseVulnerabilityAssessmentsOperations from .operations.instance_failover_groups_operations import InstanceFailoverGroupsOperations from .operations.backup_short_term_retention_policies_operations import BackupShortTermRetentionPoliciesOperations from .operations.tde_certificates_operations import TdeCertificatesOperations @@ -241,6 +244,12 @@ class SqlManagementClient(SDKClient): :vartype capabilities: azure.mgmt.sql.operations.CapabilitiesOperations :ivar database_vulnerability_assessment_scans: DatabaseVulnerabilityAssessmentScans operations :vartype database_vulnerability_assessment_scans: azure.mgmt.sql.operations.DatabaseVulnerabilityAssessmentScansOperations + :ivar managed_database_vulnerability_assessment_rule_baselines: ManagedDatabaseVulnerabilityAssessmentRuleBaselines operations + :vartype managed_database_vulnerability_assessment_rule_baselines: azure.mgmt.sql.operations.ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations + :ivar managed_database_vulnerability_assessment_scans: ManagedDatabaseVulnerabilityAssessmentScans operations + :vartype managed_database_vulnerability_assessment_scans: azure.mgmt.sql.operations.ManagedDatabaseVulnerabilityAssessmentScansOperations + :ivar managed_database_vulnerability_assessments: ManagedDatabaseVulnerabilityAssessments operations + :vartype managed_database_vulnerability_assessments: azure.mgmt.sql.operations.ManagedDatabaseVulnerabilityAssessmentsOperations :ivar instance_failover_groups: InstanceFailoverGroups operations :vartype instance_failover_groups: azure.mgmt.sql.operations.InstanceFailoverGroupsOperations :ivar backup_short_term_retention_policies: BackupShortTermRetentionPolicies operations @@ -393,6 +402,12 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.database_vulnerability_assessment_scans = DatabaseVulnerabilityAssessmentScansOperations( self._client, self.config, self._serialize, self._deserialize) + self.managed_database_vulnerability_assessment_rule_baselines = ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.managed_database_vulnerability_assessment_scans = ManagedDatabaseVulnerabilityAssessmentScansOperations( + self._client, self.config, self._serialize, self._deserialize) + self.managed_database_vulnerability_assessments = ManagedDatabaseVulnerabilityAssessmentsOperations( + self._client, self.config, self._serialize, self._deserialize) self.instance_failover_groups = InstanceFailoverGroupsOperations( self._client, self.config, self._serialize, self._deserialize) self.backup_short_term_retention_policies = BackupShortTermRetentionPoliciesOperations( diff --git a/azure-mgmt-sql/azure_bdist_wheel.py b/azure-mgmt-sql/azure_bdist_wheel.py deleted file mode 100644 index 8a81d1b61775..000000000000 --- a/azure-mgmt-sql/azure_bdist_wheel.py +++ /dev/null @@ -1,54 +0,0 @@ -#------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -#-------------------------------------------------------------------------- - -from distutils import log as logger -import os.path - -from wheel.bdist_wheel import bdist_wheel -class azure_bdist_wheel(bdist_wheel): - """The purpose of this class is to build wheel a little differently than the sdist, - without requiring to build the wheel from the sdist (i.e. you can build the wheel - directly from source). - """ - - description = "Create an Azure wheel distribution" - - user_options = bdist_wheel.user_options + \ - [('azure-namespace-package=', None, - "Name of the deepest nspkg used")] - - def initialize_options(self): - bdist_wheel.initialize_options(self) - self.azure_namespace_package = None - - def finalize_options(self): - bdist_wheel.finalize_options(self) - if self.azure_namespace_package and not self.azure_namespace_package.endswith("-nspkg"): - raise ValueError("azure_namespace_package must finish by -nspkg") - - def run(self): - if not self.distribution.install_requires: - self.distribution.install_requires = [] - self.distribution.install_requires.append( - "{}>=2.0.0".format(self.azure_namespace_package)) - bdist_wheel.run(self) - - def write_record(self, bdist_dir, distinfo_dir): - if self.azure_namespace_package: - # Split and remove last part, assuming it's "nspkg" - subparts = self.azure_namespace_package.split('-')[0:-1] - folder_with_init = [os.path.join(*subparts[0:i+1]) for i in range(len(subparts))] - for azure_sub_package in folder_with_init: - init_file = os.path.join(bdist_dir, azure_sub_package, '__init__.py') - if os.path.isfile(init_file): - logger.info("manually remove {} while building the wheel".format(init_file)) - os.remove(init_file) - else: - raise ValueError("Unable to find {}. Are you sure of your namespace package?".format(init_file)) - bdist_wheel.write_record(self, bdist_dir, distinfo_dir) -cmdclass = { - 'bdist_wheel': azure_bdist_wheel, -} diff --git a/azure-mgmt-sql/setup.cfg b/azure-mgmt-sql/setup.cfg index 856f4164982c..3c6e79cf31da 100644 --- a/azure-mgmt-sql/setup.cfg +++ b/azure-mgmt-sql/setup.cfg @@ -1,3 +1,2 @@ [bdist_wheel] universal=1 -azure-namespace-package=azure-mgmt-nspkg \ No newline at end of file diff --git a/azure-mgmt-sql/setup.py b/azure-mgmt-sql/setup.py index bf699f63001d..16c6c1db50a8 100644 --- a/azure-mgmt-sql/setup.py +++ b/azure-mgmt-sql/setup.py @@ -10,12 +10,6 @@ import os.path from io import open from setuptools import find_packages, setup -try: - from azure_bdist_wheel import cmdclass -except ImportError: - from distutils import log as logger - logger.warn("Wheel is not available, disabling bdist_wheel hook") - cmdclass = {} # Change the PACKAGE_NAME only to change folder and different name PACKAGE_NAME = "azure-mgmt-sql" @@ -76,11 +70,18 @@ 'License :: OSI Approved :: MIT License', ], zip_safe=False, - packages=find_packages(exclude=["tests"]), + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.mgmt', + ]), install_requires=[ 'msrest>=0.5.0', 'msrestazure>=0.4.32,<2.0.0', 'azure-common~=1.1', ], - cmdclass=cmdclass + extras_require={ + ":python_version<'3.0'": ['azure-mgmt-nspkg'], + } ) From 08184b8f00553de21818adc733d83ac95a226e68 Mon Sep 17 00:00:00 2001 From: azuresdkci Date: Wed, 17 Oct 2018 18:27:18 +0000 Subject: [PATCH 17/19] Packaging update of azure-mgmt-sql --- azure-mgmt-sql/MANIFEST.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/azure-mgmt-sql/MANIFEST.in b/azure-mgmt-sql/MANIFEST.in index bb37a2723dae..6ceb27f7a96e 100644 --- a/azure-mgmt-sql/MANIFEST.in +++ b/azure-mgmt-sql/MANIFEST.in @@ -1 +1,4 @@ include *.rst +include azure/__init__.py +include azure/mgmt/__init__.py + From 99a20f96e54392b98cea32756a865e121c13520f Mon Sep 17 00:00:00 2001 From: Laurent Mazuel Date: Wed, 17 Oct 2018 15:46:17 -0700 Subject: [PATCH 18/19] Update version.py --- azure-mgmt-sql/azure/mgmt/sql/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-mgmt-sql/azure/mgmt/sql/version.py b/azure-mgmt-sql/azure/mgmt/sql/version.py index 3697d9b71739..1f08862acee4 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/version.py +++ b/azure-mgmt-sql/azure/mgmt/sql/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.9.0" +VERSION = "0.10.0" From 6d3693feb41a6ae11b3936d079fd0dc726b11f49 Mon Sep 17 00:00:00 2001 From: Laurent Mazuel Date: Wed, 17 Oct 2018 17:10:52 -0700 Subject: [PATCH 19/19] Update HISTORY.rst --- azure-mgmt-sql/HISTORY.rst | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/azure-mgmt-sql/HISTORY.rst b/azure-mgmt-sql/HISTORY.rst index c29eec3d663b..c62421fd8970 100644 --- a/azure-mgmt-sql/HISTORY.rst +++ b/azure-mgmt-sql/HISTORY.rst @@ -3,6 +3,37 @@ Release History =============== +0.10.0 (2018-10-18) ++++++++++++++++++++ + +**Features** + +- Model DatabaseVulnerabilityAssessment has a new parameter storage_account_access_key +- Model ManagedInstanceUpdate has a new parameter dns_zone_partner +- Model ManagedInstanceUpdate has a new parameter collation +- Model ManagedInstanceUpdate has a new parameter dns_zone +- Model ManagedInstance has a new parameter dns_zone_partner +- Model ManagedInstance has a new parameter collation +- Model ManagedInstance has a new parameter dns_zone +- Added operation BackupShortTermRetentionPoliciesOperations.list_by_database +- Added operation group ManagedDatabaseVulnerabilityAssessmentsOperations +- Added operation group ExtendedDatabaseBlobAuditingPoliciesOperations +- Added operation group TdeCertificatesOperations +- Added operation group ManagedInstanceKeysOperations +- Added operation group ServerBlobAuditingPoliciesOperations +- Added operation group ManagedInstanceEncryptionProtectorsOperations +- Added operation group ExtendedServerBlobAuditingPoliciesOperations +- Added operation group ServerSecurityAlertPoliciesOperations +- Added operation group ManagedDatabaseVulnerabilityAssessmentScansOperations +- Added operation group ManagedInstanceTdeCertificatesOperations +- Added operation group ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations + +**Breaking changes** + +- Operation DatabaseVulnerabilityAssessmentRuleBaselinesOperations.delete has a new signature +- Operation DatabaseVulnerabilityAssessmentRuleBaselinesOperations.get has a new signature +- Operation DatabaseVulnerabilityAssessmentRuleBaselinesOperations.create_or_update has a new signature + 0.9.1 (2018-05-24) ++++++++++++++++++