Skip to content

Commit

Permalink
Update from master
Browse files Browse the repository at this point in the history
  • Loading branch information
SDK Automation committed May 4, 2020
1 parent fb78518 commit b924ed3
Show file tree
Hide file tree
Showing 8 changed files with 410 additions and 17 deletions.
7 changes: 7 additions & 0 deletions sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@
from ._models_py3 import TrackedResource
from ._models_py3 import TransparentDataEncryption
from ._models_py3 import TransparentDataEncryptionActivity
from ._models_py3 import UnlinkParameters
from ._models_py3 import Usage
from ._models_py3 import VirtualCluster
from ._models_py3 import VirtualClusterUpdate
Expand Down Expand Up @@ -354,6 +355,7 @@
from ._models import TrackedResource
from ._models import TransparentDataEncryption
from ._models import TransparentDataEncryptionActivity
from ._models import UnlinkParameters
from ._models import Usage
from ._models import VirtualCluster
from ._models import VirtualClusterUpdate
Expand All @@ -375,6 +377,8 @@
from ._paged_models import ElasticPoolOperationPaged
from ._paged_models import ElasticPoolPaged
from ._paged_models import EncryptionProtectorPaged
from ._paged_models import ExtendedDatabaseBlobAuditingPolicyPaged
from ._paged_models import ExtendedServerBlobAuditingPolicyPaged
from ._paged_models import FailoverGroupPaged
from ._paged_models import FirewallRulePaged
from ._paged_models import GeoBackupPolicyPaged
Expand Down Expand Up @@ -705,6 +709,7 @@
'TrackedResource',
'TransparentDataEncryption',
'TransparentDataEncryptionActivity',
'UnlinkParameters',
'Usage',
'VirtualCluster',
'VirtualClusterUpdate',
Expand Down Expand Up @@ -748,6 +753,8 @@
'SubscriptionUsagePaged',
'VirtualClusterPaged',
'VirtualNetworkRulePaged',
'ExtendedDatabaseBlobAuditingPolicyPaged',
'ExtendedServerBlobAuditingPolicyPaged',
'ServerBlobAuditingPolicyPaged',
'DatabaseBlobAuditingPolicyPaged',
'DatabaseVulnerabilityAssessmentPaged',
Expand Down
69 changes: 61 additions & 8 deletions sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,8 +802,17 @@ class DatabaseBlobAuditingPolicy(ProxyResource):
storageEndpoint or isAzureMonitorTargetEnabled is required.
:type storage_endpoint: str
:param storage_account_access_key: Specifies the identifier key of the
auditing storage account. If state is Enabled and storageEndpoint is
specified, storageAccountAccessKey is required.
auditing storage account.
If state is Enabled and storageEndpoint is specified, not specifying the
storageAccountAccessKey will use SQL server system-assigned managed
identity to access the storage.
Prerequisites for using managed identity authentication:
1. Assign SQL Server a system-assigned managed identity in Azure Active
Directory (AAD).
2. Grant SQL Server identity access to the storage account by adding
'Storage Blob Data Contributor' RBAC role to the server identity.
For more information, see [Auditing to storage using Managed Identity
authentication](https://go.microsoft.com/fwlink/?linkid=2114355)
:type storage_account_access_key: str
:param retention_days: Specifies the number of days to keep in the audit
logs in the storage account.
Expand Down Expand Up @@ -2671,8 +2680,17 @@ class ExtendedDatabaseBlobAuditingPolicy(ProxyResource):
storageEndpoint or isAzureMonitorTargetEnabled is required.
:type storage_endpoint: str
:param storage_account_access_key: Specifies the identifier key of the
auditing storage account. If state is Enabled and storageEndpoint is
specified, storageAccountAccessKey is required.
auditing storage account.
If state is Enabled and storageEndpoint is specified, not specifying the
storageAccountAccessKey will use SQL server system-assigned managed
identity to access the storage.
Prerequisites for using managed identity authentication:
1. Assign SQL Server a system-assigned managed identity in Azure Active
Directory (AAD).
2. Grant SQL Server identity access to the storage account by adding
'Storage Blob Data Contributor' RBAC role to the server identity.
For more information, see [Auditing to storage using Managed Identity
authentication](https://go.microsoft.com/fwlink/?linkid=2114355)
:type storage_account_access_key: str
:param retention_days: Specifies the number of days to keep in the audit
logs in the storage account.
Expand Down Expand Up @@ -2831,8 +2849,17 @@ class ExtendedServerBlobAuditingPolicy(ProxyResource):
storageEndpoint or isAzureMonitorTargetEnabled is required.
:type storage_endpoint: str
:param storage_account_access_key: Specifies the identifier key of the
auditing storage account. If state is Enabled and storageEndpoint is
specified, storageAccountAccessKey is required.
auditing storage account.
If state is Enabled and storageEndpoint is specified, not specifying the
storageAccountAccessKey will use SQL server system-assigned managed
identity to access the storage.
Prerequisites for using managed identity authentication:
1. Assign SQL Server a system-assigned managed identity in Azure Active
Directory (AAD).
2. Grant SQL Server identity access to the storage account by adding
'Storage Blob Data Contributor' RBAC role to the server identity.
For more information, see [Auditing to storage using Managed Identity
authentication](https://go.microsoft.com/fwlink/?linkid=2114355)
:type storage_account_access_key: str
:param retention_days: Specifies the number of days to keep in the audit
logs in the storage account.
Expand Down Expand Up @@ -7778,8 +7805,17 @@ class ServerBlobAuditingPolicy(ProxyResource):
storageEndpoint or isAzureMonitorTargetEnabled is required.
:type storage_endpoint: str
:param storage_account_access_key: Specifies the identifier key of the
auditing storage account. If state is Enabled and storageEndpoint is
specified, storageAccountAccessKey is required.
auditing storage account.
If state is Enabled and storageEndpoint is specified, not specifying the
storageAccountAccessKey will use SQL server system-assigned managed
identity to access the storage.
Prerequisites for using managed identity authentication:
1. Assign SQL Server a system-assigned managed identity in Azure Active
Directory (AAD).
2. Grant SQL Server identity access to the storage account by adding
'Storage Blob Data Contributor' RBAC role to the server identity.
For more information, see [Auditing to storage using Managed Identity
authentication](https://go.microsoft.com/fwlink/?linkid=2114355)
:type storage_account_access_key: str
:param retention_days: Specifies the number of days to keep in the audit
logs in the storage account.
Expand Down Expand Up @@ -9609,6 +9645,23 @@ def __init__(self, **kwargs):
self.percent_complete = None


class UnlinkParameters(Model):
"""Represents the parameters for Unlink Replication Link request.
:param forced_termination: Determines whether link will be terminated in a
forced or a friendly way.
:type forced_termination: bool
"""

_attribute_map = {
'forced_termination': {'key': 'forcedTermination', 'type': 'bool'},
}

def __init__(self, **kwargs):
super(UnlinkParameters, self).__init__(**kwargs)
self.forced_termination = kwargs.get('forced_termination', None)


class Usage(Model):
"""ARM usage.
Expand Down
69 changes: 61 additions & 8 deletions sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_models_py3.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,8 +802,17 @@ class DatabaseBlobAuditingPolicy(ProxyResource):
storageEndpoint or isAzureMonitorTargetEnabled is required.
:type storage_endpoint: str
:param storage_account_access_key: Specifies the identifier key of the
auditing storage account. If state is Enabled and storageEndpoint is
specified, storageAccountAccessKey is required.
auditing storage account.
If state is Enabled and storageEndpoint is specified, not specifying the
storageAccountAccessKey will use SQL server system-assigned managed
identity to access the storage.
Prerequisites for using managed identity authentication:
1. Assign SQL Server a system-assigned managed identity in Azure Active
Directory (AAD).
2. Grant SQL Server identity access to the storage account by adding
'Storage Blob Data Contributor' RBAC role to the server identity.
For more information, see [Auditing to storage using Managed Identity
authentication](https://go.microsoft.com/fwlink/?linkid=2114355)
:type storage_account_access_key: str
:param retention_days: Specifies the number of days to keep in the audit
logs in the storage account.
Expand Down Expand Up @@ -2671,8 +2680,17 @@ class ExtendedDatabaseBlobAuditingPolicy(ProxyResource):
storageEndpoint or isAzureMonitorTargetEnabled is required.
:type storage_endpoint: str
:param storage_account_access_key: Specifies the identifier key of the
auditing storage account. If state is Enabled and storageEndpoint is
specified, storageAccountAccessKey is required.
auditing storage account.
If state is Enabled and storageEndpoint is specified, not specifying the
storageAccountAccessKey will use SQL server system-assigned managed
identity to access the storage.
Prerequisites for using managed identity authentication:
1. Assign SQL Server a system-assigned managed identity in Azure Active
Directory (AAD).
2. Grant SQL Server identity access to the storage account by adding
'Storage Blob Data Contributor' RBAC role to the server identity.
For more information, see [Auditing to storage using Managed Identity
authentication](https://go.microsoft.com/fwlink/?linkid=2114355)
:type storage_account_access_key: str
:param retention_days: Specifies the number of days to keep in the audit
logs in the storage account.
Expand Down Expand Up @@ -2831,8 +2849,17 @@ class ExtendedServerBlobAuditingPolicy(ProxyResource):
storageEndpoint or isAzureMonitorTargetEnabled is required.
:type storage_endpoint: str
:param storage_account_access_key: Specifies the identifier key of the
auditing storage account. If state is Enabled and storageEndpoint is
specified, storageAccountAccessKey is required.
auditing storage account.
If state is Enabled and storageEndpoint is specified, not specifying the
storageAccountAccessKey will use SQL server system-assigned managed
identity to access the storage.
Prerequisites for using managed identity authentication:
1. Assign SQL Server a system-assigned managed identity in Azure Active
Directory (AAD).
2. Grant SQL Server identity access to the storage account by adding
'Storage Blob Data Contributor' RBAC role to the server identity.
For more information, see [Auditing to storage using Managed Identity
authentication](https://go.microsoft.com/fwlink/?linkid=2114355)
:type storage_account_access_key: str
:param retention_days: Specifies the number of days to keep in the audit
logs in the storage account.
Expand Down Expand Up @@ -7778,8 +7805,17 @@ class ServerBlobAuditingPolicy(ProxyResource):
storageEndpoint or isAzureMonitorTargetEnabled is required.
:type storage_endpoint: str
:param storage_account_access_key: Specifies the identifier key of the
auditing storage account. If state is Enabled and storageEndpoint is
specified, storageAccountAccessKey is required.
auditing storage account.
If state is Enabled and storageEndpoint is specified, not specifying the
storageAccountAccessKey will use SQL server system-assigned managed
identity to access the storage.
Prerequisites for using managed identity authentication:
1. Assign SQL Server a system-assigned managed identity in Azure Active
Directory (AAD).
2. Grant SQL Server identity access to the storage account by adding
'Storage Blob Data Contributor' RBAC role to the server identity.
For more information, see [Auditing to storage using Managed Identity
authentication](https://go.microsoft.com/fwlink/?linkid=2114355)
:type storage_account_access_key: str
:param retention_days: Specifies the number of days to keep in the audit
logs in the storage account.
Expand Down Expand Up @@ -9609,6 +9645,23 @@ def __init__(self, **kwargs) -> None:
self.percent_complete = None


class UnlinkParameters(Model):
"""Represents the parameters for Unlink Replication Link request.
:param forced_termination: Determines whether link will be terminated in a
forced or a friendly way.
:type forced_termination: bool
"""

_attribute_map = {
'forced_termination': {'key': 'forcedTermination', 'type': 'bool'},
}

def __init__(self, *, forced_termination: bool=None, **kwargs) -> None:
super(UnlinkParameters, self).__init__(**kwargs)
self.forced_termination = forced_termination


class Usage(Model):
"""ARM usage.
Expand Down
26 changes: 26 additions & 0 deletions sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_paged_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,32 @@ class VirtualNetworkRulePaged(Paged):
def __init__(self, *args, **kwargs):

super(VirtualNetworkRulePaged, self).__init__(*args, **kwargs)
class ExtendedDatabaseBlobAuditingPolicyPaged(Paged):
"""
A paging container for iterating over a list of :class:`ExtendedDatabaseBlobAuditingPolicy <azure.mgmt.sql.models.ExtendedDatabaseBlobAuditingPolicy>` object
"""

_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
'current_page': {'key': 'value', 'type': '[ExtendedDatabaseBlobAuditingPolicy]'}
}

def __init__(self, *args, **kwargs):

super(ExtendedDatabaseBlobAuditingPolicyPaged, self).__init__(*args, **kwargs)
class ExtendedServerBlobAuditingPolicyPaged(Paged):
"""
A paging container for iterating over a list of :class:`ExtendedServerBlobAuditingPolicy <azure.mgmt.sql.models.ExtendedServerBlobAuditingPolicy>` object
"""

_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
'current_page': {'key': 'value', 'type': '[ExtendedServerBlobAuditingPolicy]'}
}

def __init__(self, *args, **kwargs):

super(ExtendedServerBlobAuditingPolicyPaged, self).__init__(*args, **kwargs)
class ServerBlobAuditingPolicyPaged(Paged):
"""
A paging container for iterating over a list of :class:`ServerBlobAuditingPolicy <azure.mgmt.sql.models.ServerBlobAuditingPolicy>` object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,81 @@ def create_or_update(

return deserialized
create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extendedAuditingSettings/{blobAuditingPolicyName}'}

def list_by_database(
self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config):
"""Lists extended auditing settings 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 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<msrest:optionsforoperations>`.
:return: An iterator like instance of
ExtendedDatabaseBlobAuditingPolicy
:rtype:
~azure.mgmt.sql.models.ExtendedDatabaseBlobAuditingPolicyPaged[~azure.mgmt.sql.models.ExtendedDatabaseBlobAuditingPolicy]
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
def prepare_request(next_link=None):
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['Accept'] = 'application/json'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
return request

def internal_paging(next_link=None):
request = prepare_request(next_link)

response = self._client.send(request, stream=False, **operation_config)

if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp

return response

# Deserialize response
header_dict = None
if raw:
header_dict = {}
deserialized = models.ExtendedDatabaseBlobAuditingPolicyPaged(internal_paging, self._deserialize.dependencies, header_dict)

return deserialized
list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extendedAuditingSettings'}
Loading

0 comments on commit b924ed3

Please sign in to comment.