Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR sql/resource-manager] Use common Resource & Sku definitions in all Sql specs #2625

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
184 changes: 165 additions & 19 deletions azure-mgmt-sql/azure/mgmt/sql/models/__init__.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# regenerated.
# --------------------------------------------------------------------------

from .proxy_resource import ProxyResource
from .proxy_resource_py3 import ProxyResource


class BackupLongTermRetentionPolicy(ProxyResource):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# 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 BackupShortTermRetentionPolicy(ProxyResource):
"""A short term retention policy.

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 retention_days: The backup retention period in days. This is how
many days Point-in-Time Restore will be supported.
:type retention_days: int
"""

_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'},
'retention_days': {'key': 'properties.retentionDays', 'type': 'int'},
}

def __init__(self, **kwargs):
super(BackupShortTermRetentionPolicy, self).__init__(**kwargs)
self.retention_days = kwargs.get('retention_days', None)
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# 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 BackupShortTermRetentionPolicy(ProxyResource):
"""A short term retention policy.

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 retention_days: The backup retention period in days. This is how
many days Point-in-Time Restore will be supported.
:type retention_days: int
"""

_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'},
'retention_days': {'key': 'properties.retentionDays', 'type': 'int'},
}

def __init__(self, *, retention_days: int=None, **kwargs) -> None:
super(BackupShortTermRetentionPolicy, self).__init__(**kwargs)
self.retention_days = retention_days
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class CompleteDatabaseRestoreDefinition(Model):
"""Contains the information necessary to perform a complete database restore
operation.

All required parameters must be populated in order to send to Azure.

:param last_backup_name: Required. The last backup name to apply
:type last_backup_name: str
"""

_validation = {
'last_backup_name': {'required': True},
}

_attribute_map = {
'last_backup_name': {'key': 'lastBackupName', 'type': 'str'},
}

def __init__(self, **kwargs):
super(CompleteDatabaseRestoreDefinition, self).__init__(**kwargs)
self.last_backup_name = kwargs.get('last_backup_name', None)
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class CompleteDatabaseRestoreDefinition(Model):
"""Contains the information necessary to perform a complete database restore
operation.

All required parameters must be populated in order to send to Azure.

:param last_backup_name: Required. The last backup name to apply
:type last_backup_name: str
"""

_validation = {
'last_backup_name': {'required': True},
}

_attribute_map = {
'last_backup_name': {'key': 'lastBackupName', 'type': 'str'},
}

def __init__(self, *, last_backup_name: str, **kwargs) -> None:
super(CompleteDatabaseRestoreDefinition, self).__init__(**kwargs)
self.last_backup_name = last_backup_name
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# regenerated.
# --------------------------------------------------------------------------

from .proxy_resource import ProxyResource
from .proxy_resource_py3 import ProxyResource


class DataMaskingPolicy(ProxyResource):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# regenerated.
# --------------------------------------------------------------------------

from .proxy_resource import ProxyResource
from .proxy_resource_py3 import ProxyResource


class DataMaskingRule(ProxyResource):
Expand Down
6 changes: 3 additions & 3 deletions azure-mgmt-sql/azure/mgmt/sql/models/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ class Database(TrackedResource):
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:param tags: Resource tags.
:type tags: dict[str, str]
:param location: Required. Resource location.
:type location: str
:param tags: Resource tags.
:type tags: dict[str, str]
:param sku: The name and tier of the SKU.
:type sku: ~azure.mgmt.sql.models.Sku
:ivar kind: Kind of database. This is metadata used for the Azure portal
Expand Down Expand Up @@ -171,8 +171,8 @@ class Database(TrackedResource):
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'location': {'key': 'location', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'sku': {'key': 'sku', 'type': 'Sku'},
'kind': {'key': 'kind', 'type': 'str'},
'managed_by': {'key': 'managedBy', 'type': 'str'},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# regenerated.
# --------------------------------------------------------------------------

from .proxy_resource import ProxyResource
from .proxy_resource_py3 import ProxyResource


class DatabaseAutomaticTuning(ProxyResource):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# regenerated.
# --------------------------------------------------------------------------

from .proxy_resource import ProxyResource
from .proxy_resource_py3 import ProxyResource


class DatabaseBlobAuditingPolicy(ProxyResource):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# regenerated.
# --------------------------------------------------------------------------

from .proxy_resource import ProxyResource
from .proxy_resource_py3 import ProxyResource


class DatabaseOperation(ProxyResource):
Expand Down
10 changes: 5 additions & 5 deletions azure-mgmt-sql/azure/mgmt/sql/models/database_py3.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# regenerated.
# --------------------------------------------------------------------------

from .tracked_resource import TrackedResource
from .tracked_resource_py3 import TrackedResource


class Database(TrackedResource):
Expand All @@ -26,10 +26,10 @@ class Database(TrackedResource):
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:param tags: Resource tags.
:type tags: dict[str, str]
:param location: Required. Resource location.
:type location: str
:param tags: Resource tags.
:type tags: dict[str, str]
:param sku: The name and tier of the SKU.
:type sku: ~azure.mgmt.sql.models.Sku
:ivar kind: Kind of database. This is metadata used for the Azure portal
Expand Down Expand Up @@ -171,8 +171,8 @@ class Database(TrackedResource):
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'location': {'key': 'location', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'sku': {'key': 'sku', 'type': 'Sku'},
'kind': {'key': 'kind', 'type': 'str'},
'managed_by': {'key': 'managedBy', 'type': 'str'},
Expand Down Expand Up @@ -205,7 +205,7 @@ class Database(TrackedResource):
}

def __init__(self, *, location: str, tags=None, sku=None, create_mode=None, collation: str=None, max_size_bytes: int=None, sample_name=None, elastic_pool_id: str=None, source_database_id: str=None, restore_point_in_time=None, source_database_deletion_date=None, recovery_services_recovery_point_id: str=None, long_term_retention_backup_resource_id: str=None, recoverable_database_id: str=None, restorable_dropped_database_id: str=None, catalog_collation=None, zone_redundant: bool=None, license_type=None, read_scale=None, **kwargs) -> None:
super(Database, self).__init__(tags=tags, location=location, **kwargs)
super(Database, self).__init__(location=location, tags=tags, **kwargs)
self.sku = sku
self.kind = None
self.managed_by = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# regenerated.
# --------------------------------------------------------------------------

from .proxy_resource import ProxyResource
from .proxy_resource_py3 import ProxyResource


class DatabaseSecurityAlertPolicy(ProxyResource):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# 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 DatabaseVulnerabilityAssessment(ProxyResource):
"""A database vulnerability assessment.

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 storage_container_path: Required. A blob storage container path to
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.
:type storage_container_sas_key: str
:param recurring_scans: The recurring scans settings
:type recurring_scans:
~azure.mgmt.sql.models.VulnerabilityAssessmentRecurringScansProperties
"""

_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'storage_container_path': {'required': True},
'storage_container_sas_key': {'required': True},
}

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'storage_container_path': {'key': 'properties.storageContainerPath', 'type': 'str'},
'storage_container_sas_key': {'key': 'properties.storageContainerSasKey', 'type': 'str'},
'recurring_scans': {'key': 'properties.recurringScans', 'type': 'VulnerabilityAssessmentRecurringScansProperties'},
}

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.recurring_scans = kwargs.get('recurring_scans', None)
Loading