Skip to content

Commit

Permalink
[AutoPR sql/resource-manager] Managed Instance GeoRestore Cmds (#4135)
Browse files Browse the repository at this point in the history
* Generated from 6bb8cd671fb641dad3af4d4b557d6230c99237af

Modify example files and readme.md

Modify example files and readme.md for get recoverable managed databases

* Generated from 6bb8cd671fb641dad3af4d4b557d6230c99237af

Modify example files and readme.md

Modify example files and readme.md for get recoverable managed databases

* Generated from 056912d8e7565bffe7b39979ad9e6e2d69a69014

Update recoverableManagedDatabaseName to recoverableDatabaseName

Update recoverableManagedDatabaseName to recoverableDatabaseName
  • Loading branch information
AutorestCI authored Jan 22, 2019
1 parent 202afff commit f605299
Show file tree
Hide file tree
Showing 7 changed files with 310 additions and 0 deletions.
5 changes: 5 additions & 0 deletions azure-mgmt-sql/azure/mgmt/sql/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
from .tde_certificate_py3 import TdeCertificate
from .managed_instance_key_py3 import ManagedInstanceKey
from .managed_instance_encryption_protector_py3 import ManagedInstanceEncryptionProtector
from .recoverable_managed_database_py3 import RecoverableManagedDatabase
from .managed_instance_vulnerability_assessment_py3 import ManagedInstanceVulnerabilityAssessment
from .server_vulnerability_assessment_py3 import ServerVulnerabilityAssessment
except (SyntaxError, ImportError):
Expand Down Expand Up @@ -303,6 +304,7 @@
from .tde_certificate import TdeCertificate
from .managed_instance_key import ManagedInstanceKey
from .managed_instance_encryption_protector import ManagedInstanceEncryptionProtector
from .recoverable_managed_database import RecoverableManagedDatabase
from .managed_instance_vulnerability_assessment import ManagedInstanceVulnerabilityAssessment
from .server_vulnerability_assessment import ServerVulnerabilityAssessment
from .recoverable_database_paged import RecoverableDatabasePaged
Expand Down Expand Up @@ -362,6 +364,7 @@
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 .recoverable_managed_database_paged import RecoverableManagedDatabasePaged
from .managed_instance_vulnerability_assessment_paged import ManagedInstanceVulnerabilityAssessmentPaged
from .server_vulnerability_assessment_paged import ServerVulnerabilityAssessmentPaged
from .sql_management_client_enums import (
Expand Down Expand Up @@ -589,6 +592,7 @@
'TdeCertificate',
'ManagedInstanceKey',
'ManagedInstanceEncryptionProtector',
'RecoverableManagedDatabase',
'ManagedInstanceVulnerabilityAssessment',
'ServerVulnerabilityAssessment',
'RecoverableDatabasePaged',
Expand Down Expand Up @@ -648,6 +652,7 @@
'BackupShortTermRetentionPolicyPaged',
'ManagedInstanceKeyPaged',
'ManagedInstanceEncryptionProtectorPaged',
'RecoverableManagedDatabasePaged',
'ManagedInstanceVulnerabilityAssessmentPaged',
'ServerVulnerabilityAssessmentPaged',
'CheckNameAvailabilityReason',
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 RecoverableManagedDatabase(ProxyResource):
"""A recoverable managed database resource.
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
:ivar last_available_backup_date: The last available backup date.
:vartype last_available_backup_date: str
"""

_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'last_available_backup_date': {'readonly': True},
}

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'last_available_backup_date': {'key': 'properties.lastAvailableBackupDate', 'type': 'str'},
}

def __init__(self, **kwargs):
super(RecoverableManagedDatabase, self).__init__(**kwargs)
self.last_available_backup_date = None
Original file line number Diff line number Diff line change
@@ -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 RecoverableManagedDatabasePaged(Paged):
"""
A paging container for iterating over a list of :class:`RecoverableManagedDatabase <azure.mgmt.sql.models.RecoverableManagedDatabase>` object
"""

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

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

super(RecoverableManagedDatabasePaged, self).__init__(*args, **kwargs)
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 RecoverableManagedDatabase(ProxyResource):
"""A recoverable managed database resource.
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
:ivar last_available_backup_date: The last available backup date.
:vartype last_available_backup_date: str
"""

_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'last_available_backup_date': {'readonly': True},
}

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'last_available_backup_date': {'key': 'properties.lastAvailableBackupDate', 'type': 'str'},
}

def __init__(self, **kwargs) -> None:
super(RecoverableManagedDatabase, self).__init__(**kwargs)
self.last_available_backup_date = None
2 changes: 2 additions & 0 deletions azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
from .managed_instance_tde_certificates_operations import ManagedInstanceTdeCertificatesOperations
from .managed_instance_keys_operations import ManagedInstanceKeysOperations
from .managed_instance_encryption_protectors_operations import ManagedInstanceEncryptionProtectorsOperations
from .recoverable_managed_databases_operations import RecoverableManagedDatabasesOperations
from .managed_instance_vulnerability_assessments_operations import ManagedInstanceVulnerabilityAssessmentsOperations
from .server_vulnerability_assessments_operations import ServerVulnerabilityAssessmentsOperations

Expand Down Expand Up @@ -161,6 +162,7 @@
'ManagedInstanceTdeCertificatesOperations',
'ManagedInstanceKeysOperations',
'ManagedInstanceEncryptionProtectorsOperations',
'RecoverableManagedDatabasesOperations',
'ManagedInstanceVulnerabilityAssessmentsOperations',
'ServerVulnerabilityAssessmentsOperations',
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
# 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 RecoverableManagedDatabasesOperations(object):
"""RecoverableManagedDatabasesOperations 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, custom_headers=None, raw=False, **operation_config):
"""Gets a list of recoverable managed databases.
: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<msrest:optionsforoperations>`.
:return: An iterator like instance of RecoverableManagedDatabase
:rtype:
~azure.mgmt.sql.models.RecoverableManagedDatabasePaged[~azure.mgmt.sql.models.RecoverableManagedDatabase]
:raises: :class:`CloudError<msrestazure.azure_exceptions.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.RecoverableManagedDatabasePaged(internal_paging, self._deserialize.dependencies)

if raw:
header_dict = {}
client_raw_response = models.RecoverableManagedDatabasePaged(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}/recoverableDatabases'}

def get(
self, resource_group_name, managed_instance_name, recoverable_database_name, custom_headers=None, raw=False, **operation_config):
"""Gets a recoverable managed 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 recoverable_database_name:
:type recoverable_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: RecoverableManagedDatabase or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.sql.models.RecoverableManagedDatabase or
~msrest.pipeline.ClientRawResponse
:raises: :class:`CloudError<msrestazure.azure_exceptions.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'),
'recoverableDatabaseName': self._serialize.url("recoverable_database_name", recoverable_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')

# 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('RecoverableManagedDatabase', 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}/recoverableDatabases/{recoverableDatabaseName}'}
5 changes: 5 additions & 0 deletions azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
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 .operations.recoverable_managed_databases_operations import RecoverableManagedDatabasesOperations
from .operations.managed_instance_vulnerability_assessments_operations import ManagedInstanceVulnerabilityAssessmentsOperations
from .operations.server_vulnerability_assessments_operations import ServerVulnerabilityAssessmentsOperations
from . import models
Expand Down Expand Up @@ -279,6 +280,8 @@ class SqlManagementClient(SDKClient):
: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
:ivar recoverable_managed_databases: RecoverableManagedDatabases operations
:vartype recoverable_managed_databases: azure.mgmt.sql.operations.RecoverableManagedDatabasesOperations
:ivar managed_instance_vulnerability_assessments: ManagedInstanceVulnerabilityAssessments operations
:vartype managed_instance_vulnerability_assessments: azure.mgmt.sql.operations.ManagedInstanceVulnerabilityAssessmentsOperations
:ivar server_vulnerability_assessments: ServerVulnerabilityAssessments operations
Expand Down Expand Up @@ -451,6 +454,8 @@ def __init__(
self._client, self.config, self._serialize, self._deserialize)
self.managed_instance_encryption_protectors = ManagedInstanceEncryptionProtectorsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.recoverable_managed_databases = RecoverableManagedDatabasesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.managed_instance_vulnerability_assessments = ManagedInstanceVulnerabilityAssessmentsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.server_vulnerability_assessments = ServerVulnerabilityAssessmentsOperations(
Expand Down

0 comments on commit f605299

Please sign in to comment.