-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AutoPR sql/resource-manager] Managed Instance GeoRestore Cmds (#4135)
* 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
1 parent
202afff
commit f605299
Showing
7 changed files
with
310 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
azure-mgmt-sql/azure/mgmt/sql/models/recoverable_managed_database.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
27 changes: 27 additions & 0 deletions
27
azure-mgmt-sql/azure/mgmt/sql/models/recoverable_managed_database_paged.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
47 changes: 47 additions & 0 deletions
47
azure-mgmt-sql/azure/mgmt/sql/models/recoverable_managed_database_py3.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
177 changes: 177 additions & 0 deletions
177
azure-mgmt-sql/azure/mgmt/sql/operations/recoverable_managed_databases_operations.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}'} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters