diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/__init__.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/__init__.py index 6f36d52a3624..618ceb6faf62 100644 --- a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/__init__.py +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/__init__.py @@ -9,27 +9,50 @@ # regenerated. # -------------------------------------------------------------------------- -from .proxy_resource import ProxyResource -from .tracked_resource import TrackedResource -from .storage_profile import StorageProfile -from .server_properties_for_create import ServerPropertiesForCreate -from .server_properties_for_default_create import ServerPropertiesForDefaultCreate -from .server_properties_for_restore import ServerPropertiesForRestore -from .sku import Sku -from .server import Server -from .server_for_create import ServerForCreate -from .server_update_parameters import ServerUpdateParameters -from .firewall_rule import FirewallRule -from .database import Database -from .configuration import Configuration -from .operation_display import OperationDisplay -from .operation import Operation -from .operation_list_result import OperationListResult -from .log_file import LogFile -from .performance_tier_service_level_objectives import PerformanceTierServiceLevelObjectives -from .performance_tier_properties import PerformanceTierProperties -from .name_availability_request import NameAvailabilityRequest -from .name_availability import NameAvailability +try: + from .proxy_resource_py3 import ProxyResource + from .tracked_resource_py3 import TrackedResource + from .storage_profile_py3 import StorageProfile + from .server_properties_for_create_py3 import ServerPropertiesForCreate + from .server_properties_for_default_create_py3 import ServerPropertiesForDefaultCreate + from .server_properties_for_restore_py3 import ServerPropertiesForRestore + from .sku_py3 import Sku + from .server_py3 import Server + from .server_for_create_py3 import ServerForCreate + from .server_update_parameters_py3 import ServerUpdateParameters + from .firewall_rule_py3 import FirewallRule + from .database_py3 import Database + from .configuration_py3 import Configuration + from .operation_display_py3 import OperationDisplay + from .operation_py3 import Operation + from .operation_list_result_py3 import OperationListResult + from .log_file_py3 import LogFile + from .performance_tier_service_level_objectives_py3 import PerformanceTierServiceLevelObjectives + from .performance_tier_properties_py3 import PerformanceTierProperties + from .name_availability_request_py3 import NameAvailabilityRequest + from .name_availability_py3 import NameAvailability +except (SyntaxError, ImportError): + from .proxy_resource import ProxyResource + from .tracked_resource import TrackedResource + from .storage_profile import StorageProfile + from .server_properties_for_create import ServerPropertiesForCreate + from .server_properties_for_default_create import ServerPropertiesForDefaultCreate + from .server_properties_for_restore import ServerPropertiesForRestore + from .sku import Sku + from .server import Server + from .server_for_create import ServerForCreate + from .server_update_parameters import ServerUpdateParameters + from .firewall_rule import FirewallRule + from .database import Database + from .configuration import Configuration + from .operation_display import OperationDisplay + from .operation import Operation + from .operation_list_result import OperationListResult + from .log_file import LogFile + from .performance_tier_service_level_objectives import PerformanceTierServiceLevelObjectives + from .performance_tier_properties import PerformanceTierProperties + from .name_availability_request import NameAvailabilityRequest + from .name_availability import NameAvailability from .server_paged import ServerPaged from .firewall_rule_paged import FirewallRulePaged from .database_paged import DatabasePaged diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/configuration.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/configuration.py index 958b4df22372..8d95fc4a0f25 100644 --- a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/configuration.py +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/configuration.py @@ -60,11 +60,11 @@ class Configuration(ProxyResource): 'source': {'key': 'properties.source', 'type': 'str'}, } - def __init__(self, value=None, source=None): - super(Configuration, self).__init__() - self.value = value + def __init__(self, **kwargs): + super(Configuration, self).__init__(**kwargs) + self.value = kwargs.get('value', None) self.description = None self.default_value = None self.data_type = None self.allowed_values = None - self.source = source + self.source = kwargs.get('source', None) diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/configuration_py3.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/configuration_py3.py new file mode 100644 index 000000000000..9ad3350cf611 --- /dev/null +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/configuration_py3.py @@ -0,0 +1,70 @@ +# 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 Configuration(ProxyResource): + """Represents a Configuration. + + 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 value: Value of the configuration. + :type value: str + :ivar description: Description of the configuration. + :vartype description: str + :ivar default_value: Default value of the configuration. + :vartype default_value: str + :ivar data_type: Data type of the configuration. + :vartype data_type: str + :ivar allowed_values: Allowed values of the configuration. + :vartype allowed_values: str + :param source: Source of the configuration. + :type source: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'description': {'readonly': True}, + 'default_value': {'readonly': True}, + 'data_type': {'readonly': True}, + 'allowed_values': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'value': {'key': 'properties.value', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'default_value': {'key': 'properties.defaultValue', 'type': 'str'}, + 'data_type': {'key': 'properties.dataType', 'type': 'str'}, + 'allowed_values': {'key': 'properties.allowedValues', 'type': 'str'}, + 'source': {'key': 'properties.source', 'type': 'str'}, + } + + def __init__(self, *, value: str=None, source: str=None, **kwargs) -> None: + super(Configuration, self).__init__(, **kwargs) + self.value = value + self.description = None + self.default_value = None + self.data_type = None + self.allowed_values = None + self.source = source diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/database.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/database.py index f4e129302c9d..f503efb9fa34 100644 --- a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/database.py +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/database.py @@ -44,7 +44,7 @@ class Database(ProxyResource): 'collation': {'key': 'properties.collation', 'type': 'str'}, } - def __init__(self, charset=None, collation=None): - super(Database, self).__init__() - self.charset = charset - self.collation = collation + def __init__(self, **kwargs): + super(Database, self).__init__(**kwargs) + self.charset = kwargs.get('charset', None) + self.collation = kwargs.get('collation', None) diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/database_py3.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/database_py3.py new file mode 100644 index 000000000000..e7880e928d6d --- /dev/null +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/database_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 import ProxyResource + + +class Database(ProxyResource): + """Represents a Database. + + 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 charset: The charset of the database. + :type charset: str + :param collation: The collation of the database. + :type collation: 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'}, + 'charset': {'key': 'properties.charset', 'type': 'str'}, + 'collation': {'key': 'properties.collation', 'type': 'str'}, + } + + def __init__(self, *, charset: str=None, collation: str=None, **kwargs) -> None: + super(Database, self).__init__(, **kwargs) + self.charset = charset + self.collation = collation diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/firewall_rule.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/firewall_rule.py index ed7b9c13a026..af9a04f835d9 100644 --- a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/firewall_rule.py +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/firewall_rule.py @@ -18,17 +18,19 @@ class FirewallRule(ProxyResource): 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 start_ip_address: The start IP address of the server firewall rule. - Must be IPv4 format. + :param start_ip_address: Required. The start IP address of the server + firewall rule. Must be IPv4 format. :type start_ip_address: str - :param end_ip_address: The end IP address of the server firewall rule. - Must be IPv4 format. + :param end_ip_address: Required. The end IP address of the server firewall + rule. Must be IPv4 format. :type end_ip_address: str """ @@ -48,7 +50,7 @@ class FirewallRule(ProxyResource): 'end_ip_address': {'key': 'properties.endIpAddress', 'type': 'str'}, } - def __init__(self, start_ip_address, end_ip_address): - super(FirewallRule, self).__init__() - self.start_ip_address = start_ip_address - self.end_ip_address = end_ip_address + def __init__(self, **kwargs): + super(FirewallRule, self).__init__(**kwargs) + self.start_ip_address = kwargs.get('start_ip_address', None) + self.end_ip_address = kwargs.get('end_ip_address', None) diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/firewall_rule_py3.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/firewall_rule_py3.py new file mode 100644 index 000000000000..2891333362da --- /dev/null +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/firewall_rule_py3.py @@ -0,0 +1,56 @@ +# 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 FirewallRule(ProxyResource): + """Represents a server firewall rule. + + 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 start_ip_address: Required. The start IP address of the server + firewall rule. Must be IPv4 format. + :type start_ip_address: str + :param end_ip_address: Required. The end IP address of the server firewall + rule. Must be IPv4 format. + :type end_ip_address: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'start_ip_address': {'required': True, 'pattern': r'^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$'}, + 'end_ip_address': {'required': True, 'pattern': r'^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$'}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'start_ip_address': {'key': 'properties.startIpAddress', 'type': 'str'}, + 'end_ip_address': {'key': 'properties.endIpAddress', 'type': 'str'}, + } + + def __init__(self, *, start_ip_address: str, end_ip_address: str, **kwargs) -> None: + super(FirewallRule, self).__init__(, **kwargs) + self.start_ip_address = start_ip_address + self.end_ip_address = end_ip_address diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/log_file.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/log_file.py index 7ca4f91fe2a5..60d3b7e27bd1 100644 --- a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/log_file.py +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/log_file.py @@ -58,11 +58,11 @@ class LogFile(ProxyResource): 'url': {'key': 'properties.url', 'type': 'str'}, } - def __init__(self, log_file_name=None, size_in_kb=None, log_file_type=None, url=None): - super(LogFile, self).__init__() - self.log_file_name = log_file_name - self.size_in_kb = size_in_kb + def __init__(self, **kwargs): + super(LogFile, self).__init__(**kwargs) + self.log_file_name = kwargs.get('log_file_name', None) + self.size_in_kb = kwargs.get('size_in_kb', None) self.created_time = None self.last_modified_time = None - self.log_file_type = log_file_type - self.url = url + self.log_file_type = kwargs.get('log_file_type', None) + self.url = kwargs.get('url', None) diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/log_file_py3.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/log_file_py3.py new file mode 100644 index 000000000000..93cb8e07197e --- /dev/null +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/log_file_py3.py @@ -0,0 +1,68 @@ +# 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 LogFile(ProxyResource): + """Represents a log file. + + 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 log_file_name: Log file name. + :type log_file_name: str + :param size_in_kb: Size of the log file. + :type size_in_kb: long + :ivar created_time: Creation timestamp of the log file. + :vartype created_time: datetime + :ivar last_modified_time: Last modified timestamp of the log file. + :vartype last_modified_time: datetime + :param log_file_type: Type of the log file. + :type log_file_type: str + :param url: The url to download the log file from. + :type url: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'created_time': {'readonly': True}, + 'last_modified_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'log_file_name': {'key': 'properties.name', 'type': 'str'}, + 'size_in_kb': {'key': 'properties.sizeInKB', 'type': 'long'}, + 'created_time': {'key': 'properties.createdTime', 'type': 'iso-8601'}, + 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, + 'log_file_type': {'key': 'properties.type', 'type': 'str'}, + 'url': {'key': 'properties.url', 'type': 'str'}, + } + + def __init__(self, *, log_file_name: str=None, size_in_kb: int=None, log_file_type: str=None, url: str=None, **kwargs) -> None: + super(LogFile, self).__init__(, **kwargs) + self.log_file_name = log_file_name + self.size_in_kb = size_in_kb + self.created_time = None + self.last_modified_time = None + self.log_file_type = log_file_type + self.url = url diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/name_availability.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/name_availability.py index b7759d8d4726..327a74ca8a48 100644 --- a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/name_availability.py +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/name_availability.py @@ -29,8 +29,8 @@ class NameAvailability(Model): 'reason': {'key': 'reason', 'type': 'str'}, } - def __init__(self, message=None, name_available=None, reason=None): - super(NameAvailability, self).__init__() - self.message = message - self.name_available = name_available - self.reason = reason + def __init__(self, **kwargs): + super(NameAvailability, self).__init__(**kwargs) + self.message = kwargs.get('message', None) + self.name_available = kwargs.get('name_available', None) + self.reason = kwargs.get('reason', None) diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/name_availability_py3.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/name_availability_py3.py new file mode 100644 index 000000000000..f7b52a09e29f --- /dev/null +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/name_availability_py3.py @@ -0,0 +1,36 @@ +# 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 NameAvailability(Model): + """Represents a resource name availability. + + :param message: Error Message. + :type message: str + :param name_available: Indicates whether the resource name is available. + :type name_available: bool + :param reason: Reason for name being unavailable. + :type reason: str + """ + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + } + + def __init__(self, *, message: str=None, name_available: bool=None, reason: str=None, **kwargs) -> None: + super(NameAvailability, self).__init__(**kwargs) + self.message = message + self.name_available = name_available + self.reason = reason diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/name_availability_request.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/name_availability_request.py index 715b87ea3676..33cac8ab5308 100644 --- a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/name_availability_request.py +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/name_availability_request.py @@ -15,7 +15,9 @@ class NameAvailabilityRequest(Model): """Request from client to check resource name availability. - :param name: Resource name to verify. + All required parameters must be populated in order to send to Azure. + + :param name: Required. Resource name to verify. :type name: str :param type: Resource type used for verification. :type type: str @@ -30,7 +32,7 @@ class NameAvailabilityRequest(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, name, type=None): - super(NameAvailabilityRequest, self).__init__() - self.name = name - self.type = type + def __init__(self, **kwargs): + super(NameAvailabilityRequest, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/name_availability_request_py3.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/name_availability_request_py3.py new file mode 100644 index 000000000000..ec45bb2e4730 --- /dev/null +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/name_availability_request_py3.py @@ -0,0 +1,38 @@ +# 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 NameAvailabilityRequest(Model): + """Request from client to check resource name availability. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Resource name to verify. + :type name: str + :param type: Resource type used for verification. + :type type: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, *, name: str, type: str=None, **kwargs) -> None: + super(NameAvailabilityRequest, self).__init__(**kwargs) + self.name = name + self.type = type diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/operation.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/operation.py index c0ad896a743e..6e54cd3c45b9 100644 --- a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/operation.py +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/operation.py @@ -46,8 +46,8 @@ class Operation(Model): 'properties': {'key': 'properties', 'type': '{object}'}, } - def __init__(self): - super(Operation, self).__init__() + def __init__(self, **kwargs): + super(Operation, self).__init__(**kwargs) self.name = None self.display = None self.origin = None diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/operation_display.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/operation_display.py index 66b7f736d293..98314a2871d5 100644 --- a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/operation_display.py +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/operation_display.py @@ -42,8 +42,8 @@ class OperationDisplay(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self): - super(OperationDisplay, self).__init__() + def __init__(self, **kwargs): + super(OperationDisplay, self).__init__(**kwargs) self.provider = None self.resource = None self.operation = None diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/operation_display_py3.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/operation_display_py3.py new file mode 100644 index 000000000000..9b5a77c699a9 --- /dev/null +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/operation_display_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 msrest.serialization import Model + + +class OperationDisplay(Model): + """Display metadata associated with the operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar provider: Operation resource provider name. + :vartype provider: str + :ivar resource: Resource on which the operation is performed. + :vartype resource: str + :ivar operation: Localized friendly name for the operation. + :vartype operation: str + :ivar description: Operation description. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/operation_list_result.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/operation_list_result.py index b6521d80d2be..064d889c5878 100644 --- a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/operation_list_result.py +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/operation_list_result.py @@ -23,6 +23,6 @@ class OperationListResult(Model): 'value': {'key': 'value', 'type': '[Operation]'}, } - def __init__(self, value=None): - super(OperationListResult, self).__init__() - self.value = value + def __init__(self, **kwargs): + super(OperationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/operation_list_result_py3.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/operation_list_result_py3.py new file mode 100644 index 000000000000..b20d89e4c6e1 --- /dev/null +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/operation_list_result_py3.py @@ -0,0 +1,28 @@ +# 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 OperationListResult(Model): + """A list of resource provider operations. + + :param value: The list of resource provider operations. + :type value: list[~azure.mgmt.rdbms.postgresql.models.Operation] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + } + + def __init__(self, *, value=None, **kwargs) -> None: + super(OperationListResult, self).__init__(**kwargs) + self.value = value diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/operation_py3.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/operation_py3.py new file mode 100644 index 000000000000..bb0791b4a594 --- /dev/null +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/operation_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 msrest.serialization import Model + + +class Operation(Model): + """REST API operation definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: The name of the operation being performed on this particular + object. + :vartype name: str + :ivar display: The localized display information for this particular + operation or action. + :vartype display: ~azure.mgmt.rdbms.postgresql.models.OperationDisplay + :ivar origin: The intended executor of the operation. Possible values + include: 'NotSpecified', 'user', 'system' + :vartype origin: str or + ~azure.mgmt.rdbms.postgresql.models.OperationOrigin + :ivar properties: Additional descriptions for the operation. + :vartype properties: dict[str, object] + """ + + _validation = { + 'name': {'readonly': True}, + 'display': {'readonly': True}, + 'origin': {'readonly': True}, + 'properties': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{object}'}, + } + + def __init__(self, **kwargs) -> None: + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = None + self.origin = None + self.properties = None diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/performance_tier_properties.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/performance_tier_properties.py index f9cab7e5fbe8..c820966eaeb5 100644 --- a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/performance_tier_properties.py +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/performance_tier_properties.py @@ -42,11 +42,11 @@ class PerformanceTierProperties(Model): 'service_level_objectives': {'key': 'serviceLevelObjectives', 'type': '[PerformanceTierServiceLevelObjectives]'}, } - def __init__(self, id=None, max_backup_retention_days=None, min_backup_retention_days=None, max_storage_mb=None, min_storage_mb=None, service_level_objectives=None): - super(PerformanceTierProperties, self).__init__() - self.id = id - self.max_backup_retention_days = max_backup_retention_days - self.min_backup_retention_days = min_backup_retention_days - self.max_storage_mb = max_storage_mb - self.min_storage_mb = min_storage_mb - self.service_level_objectives = service_level_objectives + def __init__(self, **kwargs): + super(PerformanceTierProperties, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.max_backup_retention_days = kwargs.get('max_backup_retention_days', None) + self.min_backup_retention_days = kwargs.get('min_backup_retention_days', None) + self.max_storage_mb = kwargs.get('max_storage_mb', None) + self.min_storage_mb = kwargs.get('min_storage_mb', None) + self.service_level_objectives = kwargs.get('service_level_objectives', None) diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/performance_tier_properties_py3.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/performance_tier_properties_py3.py new file mode 100644 index 000000000000..94cdad4e2cb8 --- /dev/null +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/performance_tier_properties_py3.py @@ -0,0 +1,52 @@ +# 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 PerformanceTierProperties(Model): + """Performance tier properties. + + :param id: ID of the performance tier. + :type id: str + :param max_backup_retention_days: Maximum Backup retention in days for the + performance tier edition + :type max_backup_retention_days: int + :param min_backup_retention_days: Minimum Backup retention in days for the + performance tier edition + :type min_backup_retention_days: int + :param max_storage_mb: Max storage allowed for a server. + :type max_storage_mb: int + :param min_storage_mb: Max storage allowed for a server. + :type min_storage_mb: int + :param service_level_objectives: Service level objectives associated with + the performance tier + :type service_level_objectives: + list[~azure.mgmt.rdbms.postgresql.models.PerformanceTierServiceLevelObjectives] + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'max_backup_retention_days': {'key': 'maxBackupRetentionDays', 'type': 'int'}, + 'min_backup_retention_days': {'key': 'minBackupRetentionDays', 'type': 'int'}, + 'max_storage_mb': {'key': 'maxStorageMB', 'type': 'int'}, + 'min_storage_mb': {'key': 'minStorageMB', 'type': 'int'}, + 'service_level_objectives': {'key': 'serviceLevelObjectives', 'type': '[PerformanceTierServiceLevelObjectives]'}, + } + + def __init__(self, *, id: str=None, max_backup_retention_days: int=None, min_backup_retention_days: int=None, max_storage_mb: int=None, min_storage_mb: int=None, service_level_objectives=None, **kwargs) -> None: + super(PerformanceTierProperties, self).__init__(**kwargs) + self.id = id + self.max_backup_retention_days = max_backup_retention_days + self.min_backup_retention_days = min_backup_retention_days + self.max_storage_mb = max_storage_mb + self.min_storage_mb = min_storage_mb + self.service_level_objectives = service_level_objectives diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/performance_tier_service_level_objectives.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/performance_tier_service_level_objectives.py index 96ba9e7c889c..fb6bf82c0f1b 100644 --- a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/performance_tier_service_level_objectives.py +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/performance_tier_service_level_objectives.py @@ -33,9 +33,9 @@ class PerformanceTierServiceLevelObjectives(Model): 'hardware_generation': {'key': 'hardwareGeneration', 'type': 'str'}, } - def __init__(self, id=None, edition=None, v_core=None, hardware_generation=None): - super(PerformanceTierServiceLevelObjectives, self).__init__() - self.id = id - self.edition = edition - self.v_core = v_core - self.hardware_generation = hardware_generation + def __init__(self, **kwargs): + super(PerformanceTierServiceLevelObjectives, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.edition = kwargs.get('edition', None) + self.v_core = kwargs.get('v_core', None) + self.hardware_generation = kwargs.get('hardware_generation', None) diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/performance_tier_service_level_objectives_py3.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/performance_tier_service_level_objectives_py3.py new file mode 100644 index 000000000000..0c202901b237 --- /dev/null +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/performance_tier_service_level_objectives_py3.py @@ -0,0 +1,41 @@ +# 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 PerformanceTierServiceLevelObjectives(Model): + """Service level objectives for performance tier. + + :param id: ID for the service level objective. + :type id: str + :param edition: Edition of the performance tier. + :type edition: str + :param v_core: vCore associated with the service level objective + :type v_core: int + :param hardware_generation: Hardware generation associated with the + service level objective + :type hardware_generation: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'edition': {'key': 'edition', 'type': 'str'}, + 'v_core': {'key': 'vCore', 'type': 'int'}, + 'hardware_generation': {'key': 'hardwareGeneration', 'type': 'str'}, + } + + def __init__(self, *, id: str=None, edition: str=None, v_core: int=None, hardware_generation: str=None, **kwargs) -> None: + super(PerformanceTierServiceLevelObjectives, self).__init__(**kwargs) + self.id = id + self.edition = edition + self.v_core = v_core + self.hardware_generation = hardware_generation diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/postgre_sql_management_client_enums.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/postgre_sql_management_client_enums.py index ccaa28a4ddad..067e776798b4 100644 --- a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/postgre_sql_management_client_enums.py +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/postgre_sql_management_client_enums.py @@ -12,38 +12,39 @@ from enum import Enum -class ServerVersion(Enum): +class ServerVersion(str, Enum): nine_full_stop_five = "9.5" nine_full_stop_six = "9.6" -class SslEnforcementEnum(Enum): +class SslEnforcementEnum(str, Enum): enabled = "Enabled" disabled = "Disabled" -class ServerState(Enum): +class ServerState(str, Enum): ready = "Ready" dropping = "Dropping" disabled = "Disabled" -class GeoRedundantBackup(Enum): +class GeoRedundantBackup(str, Enum): enabled = "Enabled" disabled = "Disabled" -class SkuTier(Enum): +class SkuTier(str, Enum): basic = "Basic" - standard = "Standard" + general_purpose = "GeneralPurpose" + memory_optimized = "MemoryOptimized" -class OperationOrigin(Enum): +class OperationOrigin(str, Enum): not_specified = "NotSpecified" user = "user" diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/proxy_resource.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/proxy_resource.py index b982916c5e5b..1223f4670fe9 100644 --- a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/proxy_resource.py +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/proxy_resource.py @@ -38,8 +38,8 @@ class ProxyResource(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self): - super(ProxyResource, self).__init__() + def __init__(self, **kwargs): + super(ProxyResource, self).__init__(**kwargs) self.id = None self.name = None self.type = None diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/proxy_resource_py3.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/proxy_resource_py3.py new file mode 100644 index 000000000000..e0dde467e583 --- /dev/null +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/proxy_resource_py3.py @@ -0,0 +1,45 @@ +# 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 ProxyResource(Model): + """Resource properties. + + 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 + """ + + _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'}, + } + + def __init__(self, **kwargs) -> None: + super(ProxyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server.py index c7bc6e3e1a6a..be0aabcb6fa4 100644 --- a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server.py +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server.py @@ -18,13 +18,15 @@ class Server(TrackedResource): 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 location: The location the resource resides in. + :param location: Required. The location the resource resides in. :type location: str :param tags: Application-specific metadata in the form of key-value pairs. :type tags: dict[str, str] @@ -77,13 +79,13 @@ class Server(TrackedResource): 'storage_profile': {'key': 'properties.storageProfile', 'type': 'StorageProfile'}, } - def __init__(self, location, tags=None, sku=None, administrator_login=None, version=None, ssl_enforcement=None, user_visible_state=None, fully_qualified_domain_name=None, earliest_restore_date=None, storage_profile=None): - super(Server, self).__init__(location=location, tags=tags) - self.sku = sku - self.administrator_login = administrator_login - self.version = version - self.ssl_enforcement = ssl_enforcement - self.user_visible_state = user_visible_state - self.fully_qualified_domain_name = fully_qualified_domain_name - self.earliest_restore_date = earliest_restore_date - self.storage_profile = storage_profile + def __init__(self, **kwargs): + super(Server, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) + self.administrator_login = kwargs.get('administrator_login', None) + self.version = kwargs.get('version', None) + self.ssl_enforcement = kwargs.get('ssl_enforcement', None) + self.user_visible_state = kwargs.get('user_visible_state', None) + self.fully_qualified_domain_name = kwargs.get('fully_qualified_domain_name', None) + self.earliest_restore_date = kwargs.get('earliest_restore_date', None) + self.storage_profile = kwargs.get('storage_profile', None) diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_for_create.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_for_create.py index 3b28a60b632a..f62cec527444 100644 --- a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_for_create.py +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_for_create.py @@ -15,12 +15,14 @@ class ServerForCreate(Model): """Represents a server to be created. + All required parameters must be populated in order to send to Azure. + :param sku: The SKU (pricing tier) of the server. :type sku: ~azure.mgmt.rdbms.postgresql.models.Sku - :param properties: Properties of the server. + :param properties: Required. Properties of the server. :type properties: ~azure.mgmt.rdbms.postgresql.models.ServerPropertiesForCreate - :param location: The location the resource resides in. + :param location: Required. The location the resource resides in. :type location: str :param tags: Application-specific metadata in the form of key-value pairs. :type tags: dict[str, str] @@ -38,9 +40,9 @@ class ServerForCreate(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, properties, location, sku=None, tags=None): - super(ServerForCreate, self).__init__() - self.sku = sku - self.properties = properties - self.location = location - self.tags = tags + def __init__(self, **kwargs): + super(ServerForCreate, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) + self.properties = kwargs.get('properties', None) + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_for_create_py3.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_for_create_py3.py new file mode 100644 index 000000000000..4e686e7a2669 --- /dev/null +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_for_create_py3.py @@ -0,0 +1,48 @@ +# 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 ServerForCreate(Model): + """Represents a server to be created. + + All required parameters must be populated in order to send to Azure. + + :param sku: The SKU (pricing tier) of the server. + :type sku: ~azure.mgmt.rdbms.postgresql.models.Sku + :param properties: Required. Properties of the server. + :type properties: + ~azure.mgmt.rdbms.postgresql.models.ServerPropertiesForCreate + :param location: Required. The location the resource resides in. + :type location: str + :param tags: Application-specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + """ + + _validation = { + 'properties': {'required': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'properties': {'key': 'properties', 'type': 'ServerPropertiesForCreate'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, properties, location: str, sku=None, tags=None, **kwargs) -> None: + super(ServerForCreate, self).__init__(**kwargs) + self.sku = sku + self.properties = properties + self.location = location + self.tags = tags diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_properties_for_create.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_properties_for_create.py index 28dbe618494d..f8722d5af2d0 100644 --- a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_properties_for_create.py +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_properties_for_create.py @@ -19,6 +19,8 @@ class ServerPropertiesForCreate(Model): sub-classes are: ServerPropertiesForDefaultCreate, ServerPropertiesForRestore + All required parameters must be populated in order to send to Azure. + :param version: Server version. Possible values include: '9.5', '9.6' :type version: str or ~azure.mgmt.rdbms.postgresql.models.ServerVersion :param ssl_enforcement: Enable ssl enforcement or not when connect to @@ -27,7 +29,7 @@ class ServerPropertiesForCreate(Model): ~azure.mgmt.rdbms.postgresql.models.SslEnforcementEnum :param storage_profile: Storage profile of a server. :type storage_profile: ~azure.mgmt.rdbms.postgresql.models.StorageProfile - :param create_mode: Constant filled by server. + :param create_mode: Required. Constant filled by server. :type create_mode: str """ @@ -46,9 +48,9 @@ class ServerPropertiesForCreate(Model): 'create_mode': {'Default': 'ServerPropertiesForDefaultCreate', 'PointInTimeRestore': 'ServerPropertiesForRestore'} } - def __init__(self, version=None, ssl_enforcement=None, storage_profile=None): - super(ServerPropertiesForCreate, self).__init__() - self.version = version - self.ssl_enforcement = ssl_enforcement - self.storage_profile = storage_profile + def __init__(self, **kwargs): + super(ServerPropertiesForCreate, self).__init__(**kwargs) + self.version = kwargs.get('version', None) + self.ssl_enforcement = kwargs.get('ssl_enforcement', None) + self.storage_profile = kwargs.get('storage_profile', None) self.create_mode = None diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_properties_for_create_py3.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_properties_for_create_py3.py new file mode 100644 index 000000000000..29c3f2259eff --- /dev/null +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_properties_for_create_py3.py @@ -0,0 +1,56 @@ +# 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 ServerPropertiesForCreate(Model): + """The properties used to create a new server. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ServerPropertiesForDefaultCreate, + ServerPropertiesForRestore + + All required parameters must be populated in order to send to Azure. + + :param version: Server version. Possible values include: '9.5', '9.6' + :type version: str or ~azure.mgmt.rdbms.postgresql.models.ServerVersion + :param ssl_enforcement: Enable ssl enforcement or not when connect to + server. Possible values include: 'Enabled', 'Disabled' + :type ssl_enforcement: str or + ~azure.mgmt.rdbms.postgresql.models.SslEnforcementEnum + :param storage_profile: Storage profile of a server. + :type storage_profile: ~azure.mgmt.rdbms.postgresql.models.StorageProfile + :param create_mode: Required. Constant filled by server. + :type create_mode: str + """ + + _validation = { + 'create_mode': {'required': True}, + } + + _attribute_map = { + 'version': {'key': 'version', 'type': 'str'}, + 'ssl_enforcement': {'key': 'sslEnforcement', 'type': 'SslEnforcementEnum'}, + 'storage_profile': {'key': 'storageProfile', 'type': 'StorageProfile'}, + 'create_mode': {'key': 'createMode', 'type': 'str'}, + } + + _subtype_map = { + 'create_mode': {'Default': 'ServerPropertiesForDefaultCreate', 'PointInTimeRestore': 'ServerPropertiesForRestore'} + } + + def __init__(self, *, version=None, ssl_enforcement=None, storage_profile=None, **kwargs) -> None: + super(ServerPropertiesForCreate, self).__init__(**kwargs) + self.version = version + self.ssl_enforcement = ssl_enforcement + self.storage_profile = storage_profile + self.create_mode = None diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_properties_for_default_create.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_properties_for_default_create.py index 487e01908dde..89d145f48dc1 100644 --- a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_properties_for_default_create.py +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_properties_for_default_create.py @@ -15,6 +15,8 @@ class ServerPropertiesForDefaultCreate(ServerPropertiesForCreate): """The properties used to create a new server. + All required parameters must be populated in order to send to Azure. + :param version: Server version. Possible values include: '9.5', '9.6' :type version: str or ~azure.mgmt.rdbms.postgresql.models.ServerVersion :param ssl_enforcement: Enable ssl enforcement or not when connect to @@ -23,14 +25,14 @@ class ServerPropertiesForDefaultCreate(ServerPropertiesForCreate): ~azure.mgmt.rdbms.postgresql.models.SslEnforcementEnum :param storage_profile: Storage profile of a server. :type storage_profile: ~azure.mgmt.rdbms.postgresql.models.StorageProfile - :param create_mode: Constant filled by server. + :param create_mode: Required. Constant filled by server. :type create_mode: str - :param administrator_login: The administrator's login name of a server. - Can only be specified when the server is being created (and is required - for creation). + :param administrator_login: Required. The administrator's login name of a + server. Can only be specified when the server is being created (and is + required for creation). :type administrator_login: str - :param administrator_login_password: The password of the administrator - login. + :param administrator_login_password: Required. The password of the + administrator login. :type administrator_login_password: str """ @@ -49,8 +51,8 @@ class ServerPropertiesForDefaultCreate(ServerPropertiesForCreate): 'administrator_login_password': {'key': 'administratorLoginPassword', 'type': 'str'}, } - def __init__(self, administrator_login, administrator_login_password, version=None, ssl_enforcement=None, storage_profile=None): - super(ServerPropertiesForDefaultCreate, self).__init__(version=version, ssl_enforcement=ssl_enforcement, storage_profile=storage_profile) - self.administrator_login = administrator_login - self.administrator_login_password = administrator_login_password + def __init__(self, **kwargs): + super(ServerPropertiesForDefaultCreate, self).__init__(**kwargs) + self.administrator_login = kwargs.get('administrator_login', None) + self.administrator_login_password = kwargs.get('administrator_login_password', None) self.create_mode = 'Default' diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_properties_for_default_create_py3.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_properties_for_default_create_py3.py new file mode 100644 index 000000000000..6bb8809b653c --- /dev/null +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_properties_for_default_create_py3.py @@ -0,0 +1,58 @@ +# 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 .server_properties_for_create import ServerPropertiesForCreate + + +class ServerPropertiesForDefaultCreate(ServerPropertiesForCreate): + """The properties used to create a new server. + + All required parameters must be populated in order to send to Azure. + + :param version: Server version. Possible values include: '9.5', '9.6' + :type version: str or ~azure.mgmt.rdbms.postgresql.models.ServerVersion + :param ssl_enforcement: Enable ssl enforcement or not when connect to + server. Possible values include: 'Enabled', 'Disabled' + :type ssl_enforcement: str or + ~azure.mgmt.rdbms.postgresql.models.SslEnforcementEnum + :param storage_profile: Storage profile of a server. + :type storage_profile: ~azure.mgmt.rdbms.postgresql.models.StorageProfile + :param create_mode: Required. Constant filled by server. + :type create_mode: str + :param administrator_login: Required. The administrator's login name of a + server. Can only be specified when the server is being created (and is + required for creation). + :type administrator_login: str + :param administrator_login_password: Required. The password of the + administrator login. + :type administrator_login_password: str + """ + + _validation = { + 'create_mode': {'required': True}, + 'administrator_login': {'required': True}, + 'administrator_login_password': {'required': True}, + } + + _attribute_map = { + 'version': {'key': 'version', 'type': 'str'}, + 'ssl_enforcement': {'key': 'sslEnforcement', 'type': 'SslEnforcementEnum'}, + 'storage_profile': {'key': 'storageProfile', 'type': 'StorageProfile'}, + 'create_mode': {'key': 'createMode', 'type': 'str'}, + 'administrator_login': {'key': 'administratorLogin', 'type': 'str'}, + 'administrator_login_password': {'key': 'administratorLoginPassword', 'type': 'str'}, + } + + def __init__(self, *, administrator_login: str, administrator_login_password: str, version=None, ssl_enforcement=None, storage_profile=None, **kwargs) -> None: + super(ServerPropertiesForDefaultCreate, self).__init__(version=version, ssl_enforcement=ssl_enforcement, storage_profile=storage_profile, **kwargs) + self.administrator_login = administrator_login + self.administrator_login_password = administrator_login_password + self.create_mode = 'Default' diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_properties_for_restore.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_properties_for_restore.py index a8f224f343ef..090c90c33f65 100644 --- a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_properties_for_restore.py +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_properties_for_restore.py @@ -15,6 +15,8 @@ class ServerPropertiesForRestore(ServerPropertiesForCreate): """The properties to a new server by restoring from a backup. + All required parameters must be populated in order to send to Azure. + :param version: Server version. Possible values include: '9.5', '9.6' :type version: str or ~azure.mgmt.rdbms.postgresql.models.ServerVersion :param ssl_enforcement: Enable ssl enforcement or not when connect to @@ -23,12 +25,12 @@ class ServerPropertiesForRestore(ServerPropertiesForCreate): ~azure.mgmt.rdbms.postgresql.models.SslEnforcementEnum :param storage_profile: Storage profile of a server. :type storage_profile: ~azure.mgmt.rdbms.postgresql.models.StorageProfile - :param create_mode: Constant filled by server. + :param create_mode: Required. Constant filled by server. :type create_mode: str - :param source_server_id: The source server id to restore from. + :param source_server_id: Required. The source server id to restore from. :type source_server_id: str - :param restore_point_in_time: Restore point creation time (ISO8601 - format), specifying the time to restore from. + :param restore_point_in_time: Required. Restore point creation time + (ISO8601 format), specifying the time to restore from. :type restore_point_in_time: datetime """ @@ -47,8 +49,8 @@ class ServerPropertiesForRestore(ServerPropertiesForCreate): 'restore_point_in_time': {'key': 'restorePointInTime', 'type': 'iso-8601'}, } - def __init__(self, source_server_id, restore_point_in_time, version=None, ssl_enforcement=None, storage_profile=None): - super(ServerPropertiesForRestore, self).__init__(version=version, ssl_enforcement=ssl_enforcement, storage_profile=storage_profile) - self.source_server_id = source_server_id - self.restore_point_in_time = restore_point_in_time + def __init__(self, **kwargs): + super(ServerPropertiesForRestore, self).__init__(**kwargs) + self.source_server_id = kwargs.get('source_server_id', None) + self.restore_point_in_time = kwargs.get('restore_point_in_time', None) self.create_mode = 'PointInTimeRestore' diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_properties_for_restore_py3.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_properties_for_restore_py3.py new file mode 100644 index 000000000000..f4f4660b4c51 --- /dev/null +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_properties_for_restore_py3.py @@ -0,0 +1,56 @@ +# 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 .server_properties_for_create import ServerPropertiesForCreate + + +class ServerPropertiesForRestore(ServerPropertiesForCreate): + """The properties to a new server by restoring from a backup. + + All required parameters must be populated in order to send to Azure. + + :param version: Server version. Possible values include: '9.5', '9.6' + :type version: str or ~azure.mgmt.rdbms.postgresql.models.ServerVersion + :param ssl_enforcement: Enable ssl enforcement or not when connect to + server. Possible values include: 'Enabled', 'Disabled' + :type ssl_enforcement: str or + ~azure.mgmt.rdbms.postgresql.models.SslEnforcementEnum + :param storage_profile: Storage profile of a server. + :type storage_profile: ~azure.mgmt.rdbms.postgresql.models.StorageProfile + :param create_mode: Required. Constant filled by server. + :type create_mode: str + :param source_server_id: Required. The source server id to restore from. + :type source_server_id: str + :param restore_point_in_time: Required. Restore point creation time + (ISO8601 format), specifying the time to restore from. + :type restore_point_in_time: datetime + """ + + _validation = { + 'create_mode': {'required': True}, + 'source_server_id': {'required': True}, + 'restore_point_in_time': {'required': True}, + } + + _attribute_map = { + 'version': {'key': 'version', 'type': 'str'}, + 'ssl_enforcement': {'key': 'sslEnforcement', 'type': 'SslEnforcementEnum'}, + 'storage_profile': {'key': 'storageProfile', 'type': 'StorageProfile'}, + 'create_mode': {'key': 'createMode', 'type': 'str'}, + 'source_server_id': {'key': 'sourceServerId', 'type': 'str'}, + 'restore_point_in_time': {'key': 'restorePointInTime', 'type': 'iso-8601'}, + } + + def __init__(self, *, source_server_id: str, restore_point_in_time, version=None, ssl_enforcement=None, storage_profile=None, **kwargs) -> None: + super(ServerPropertiesForRestore, self).__init__(version=version, ssl_enforcement=ssl_enforcement, storage_profile=storage_profile, **kwargs) + self.source_server_id = source_server_id + self.restore_point_in_time = restore_point_in_time + self.create_mode = 'PointInTimeRestore' diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_py3.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_py3.py new file mode 100644 index 000000000000..2db1674947d2 --- /dev/null +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_py3.py @@ -0,0 +1,91 @@ +# 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 .tracked_resource import TrackedResource + + +class Server(TrackedResource): + """Represents 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 location: Required. The location the resource resides in. + :type location: str + :param tags: Application-specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :param sku: The SKU (pricing tier) of the server. + :type sku: ~azure.mgmt.rdbms.postgresql.models.Sku + :param administrator_login: The administrator's login name of a server. + Can only be specified when the server is being created (and is required + for creation). + :type administrator_login: str + :param version: Server version. Possible values include: '9.5', '9.6' + :type version: str or ~azure.mgmt.rdbms.postgresql.models.ServerVersion + :param ssl_enforcement: Enable ssl enforcement or not when connect to + server. Possible values include: 'Enabled', 'Disabled' + :type ssl_enforcement: str or + ~azure.mgmt.rdbms.postgresql.models.SslEnforcementEnum + :param user_visible_state: A state of a server that is visible to user. + Possible values include: 'Ready', 'Dropping', 'Disabled' + :type user_visible_state: str or + ~azure.mgmt.rdbms.postgresql.models.ServerState + :param fully_qualified_domain_name: The fully qualified domain name of a + server. + :type fully_qualified_domain_name: str + :param earliest_restore_date: Earliest restore point creation time + (ISO8601 format) + :type earliest_restore_date: datetime + :param storage_profile: Storage profile of a server. + :type storage_profile: ~azure.mgmt.rdbms.postgresql.models.StorageProfile + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'administrator_login': {'key': 'properties.administratorLogin', 'type': 'str'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + 'ssl_enforcement': {'key': 'properties.sslEnforcement', 'type': 'SslEnforcementEnum'}, + 'user_visible_state': {'key': 'properties.userVisibleState', 'type': 'str'}, + 'fully_qualified_domain_name': {'key': 'properties.fullyQualifiedDomainName', 'type': 'str'}, + 'earliest_restore_date': {'key': 'properties.earliestRestoreDate', 'type': 'iso-8601'}, + 'storage_profile': {'key': 'properties.storageProfile', 'type': 'StorageProfile'}, + } + + def __init__(self, *, location: str, tags=None, sku=None, administrator_login: str=None, version=None, ssl_enforcement=None, user_visible_state=None, fully_qualified_domain_name: str=None, earliest_restore_date=None, storage_profile=None, **kwargs) -> None: + super(Server, self).__init__(location=location, tags=tags, **kwargs) + self.sku = sku + self.administrator_login = administrator_login + self.version = version + self.ssl_enforcement = ssl_enforcement + self.user_visible_state = user_visible_state + self.fully_qualified_domain_name = fully_qualified_domain_name + self.earliest_restore_date = earliest_restore_date + self.storage_profile = storage_profile diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_update_parameters.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_update_parameters.py index 5888125236a7..f806ed2151a7 100644 --- a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_update_parameters.py +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_update_parameters.py @@ -42,11 +42,11 @@ class ServerUpdateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, sku=None, storage_profile=None, administrator_login_password=None, version=None, ssl_enforcement=None, tags=None): - super(ServerUpdateParameters, self).__init__() - self.sku = sku - self.storage_profile = storage_profile - self.administrator_login_password = administrator_login_password - self.version = version - self.ssl_enforcement = ssl_enforcement - self.tags = tags + def __init__(self, **kwargs): + super(ServerUpdateParameters, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) + self.storage_profile = kwargs.get('storage_profile', None) + self.administrator_login_password = kwargs.get('administrator_login_password', None) + self.version = kwargs.get('version', None) + self.ssl_enforcement = kwargs.get('ssl_enforcement', None) + self.tags = kwargs.get('tags', None) diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_update_parameters_py3.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_update_parameters_py3.py new file mode 100644 index 000000000000..f7f3a6a1b00b --- /dev/null +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/server_update_parameters_py3.py @@ -0,0 +1,52 @@ +# 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 ServerUpdateParameters(Model): + """Parameters allowd to update for a server. + + :param sku: The SKU (pricing tier) of the server. + :type sku: ~azure.mgmt.rdbms.postgresql.models.Sku + :param storage_profile: Storage profile of a server. + :type storage_profile: ~azure.mgmt.rdbms.postgresql.models.StorageProfile + :param administrator_login_password: The password of the administrator + login. + :type administrator_login_password: str + :param version: The version of a server. Possible values include: '9.5', + '9.6' + :type version: str or ~azure.mgmt.rdbms.postgresql.models.ServerVersion + :param ssl_enforcement: Enable ssl enforcement or not when connect to + server. Possible values include: 'Enabled', 'Disabled' + :type ssl_enforcement: str or + ~azure.mgmt.rdbms.postgresql.models.SslEnforcementEnum + :param tags: Application-specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'storage_profile': {'key': 'properties.storageProfile', 'type': 'StorageProfile'}, + 'administrator_login_password': {'key': 'properties.administratorLoginPassword', 'type': 'str'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + 'ssl_enforcement': {'key': 'properties.sslEnforcement', 'type': 'SslEnforcementEnum'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, sku=None, storage_profile=None, administrator_login_password: str=None, version=None, ssl_enforcement=None, tags=None, **kwargs) -> None: + super(ServerUpdateParameters, self).__init__(**kwargs) + self.sku = sku + self.storage_profile = storage_profile + self.administrator_login_password = administrator_login_password + self.version = version + self.ssl_enforcement = ssl_enforcement + self.tags = tags diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/sku.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/sku.py index 77d15a740b3a..a2dfddd40786 100644 --- a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/sku.py +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/sku.py @@ -19,7 +19,7 @@ class Sku(Model): B_Gen4_1, GP_Gen5_8. :type name: str :param tier: The tier of the particular SKU, e.g. Basic. Possible values - include: 'Basic', 'Standard' + include: 'Basic', 'GeneralPurpose', 'MemoryOptimized' :type tier: str or ~azure.mgmt.rdbms.postgresql.models.SkuTier :param capacity: The scale up/out capacity, representing server's compute units. @@ -42,10 +42,10 @@ class Sku(Model): 'family': {'key': 'family', 'type': 'str'}, } - def __init__(self, name=None, tier=None, capacity=None, size=None, family=None): - super(Sku, self).__init__() - self.name = name - self.tier = tier - self.capacity = capacity - self.size = size - self.family = family + def __init__(self, **kwargs): + super(Sku, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.tier = kwargs.get('tier', None) + self.capacity = kwargs.get('capacity', None) + self.size = kwargs.get('size', None) + self.family = kwargs.get('family', None) diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/sku_py3.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/sku_py3.py new file mode 100644 index 000000000000..918f88853b47 --- /dev/null +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/sku_py3.py @@ -0,0 +1,51 @@ +# 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 Sku(Model): + """Billing information related properties of a server. + + :param name: The name of the sku, typically, tier + family + cores, e.g. + B_Gen4_1, GP_Gen5_8. + :type name: str + :param tier: The tier of the particular SKU, e.g. Basic. Possible values + include: 'Basic', 'GeneralPurpose', 'MemoryOptimized' + :type tier: str or ~azure.mgmt.rdbms.postgresql.models.SkuTier + :param capacity: The scale up/out capacity, representing server's compute + units. + :type capacity: int + :param size: The size code, to be interpreted by resource as appropriate. + :type size: str + :param family: The family of hardware. + :type family: str + """ + + _validation = { + 'capacity': {'minimum': 0}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + 'size': {'key': 'size', 'type': 'str'}, + 'family': {'key': 'family', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, tier=None, capacity: int=None, size: str=None, family: str=None, **kwargs) -> None: + super(Sku, self).__init__(**kwargs) + self.name = name + self.tier = tier + self.capacity = capacity + self.size = size + self.family = family diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/storage_profile.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/storage_profile.py index 0f408839ce2d..52d2ce839cdc 100644 --- a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/storage_profile.py +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/storage_profile.py @@ -31,8 +31,8 @@ class StorageProfile(Model): 'storage_mb': {'key': 'storageMB', 'type': 'int'}, } - def __init__(self, backup_retention_days=None, geo_redundant_backup=None, storage_mb=None): - super(StorageProfile, self).__init__() - self.backup_retention_days = backup_retention_days - self.geo_redundant_backup = geo_redundant_backup - self.storage_mb = storage_mb + def __init__(self, **kwargs): + super(StorageProfile, self).__init__(**kwargs) + self.backup_retention_days = kwargs.get('backup_retention_days', None) + self.geo_redundant_backup = kwargs.get('geo_redundant_backup', None) + self.storage_mb = kwargs.get('storage_mb', None) diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/storage_profile_py3.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/storage_profile_py3.py new file mode 100644 index 000000000000..bd6e048710a2 --- /dev/null +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/storage_profile_py3.py @@ -0,0 +1,38 @@ +# 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 StorageProfile(Model): + """Storage Profile properties of a server. + + :param backup_retention_days: Backup retention days for the server. + :type backup_retention_days: int + :param geo_redundant_backup: Enable Geo-redundant or not for server + backup. Possible values include: 'Enabled', 'Disabled' + :type geo_redundant_backup: str or + ~azure.mgmt.rdbms.postgresql.models.GeoRedundantBackup + :param storage_mb: Max storage allowed for a server. + :type storage_mb: int + """ + + _attribute_map = { + 'backup_retention_days': {'key': 'backupRetentionDays', 'type': 'int'}, + 'geo_redundant_backup': {'key': 'geoRedundantBackup', 'type': 'str'}, + 'storage_mb': {'key': 'storageMB', 'type': 'int'}, + } + + def __init__(self, *, backup_retention_days: int=None, geo_redundant_backup=None, storage_mb: int=None, **kwargs) -> None: + super(StorageProfile, self).__init__(**kwargs) + self.backup_retention_days = backup_retention_days + self.geo_redundant_backup = geo_redundant_backup + self.storage_mb = storage_mb diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/tracked_resource.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/tracked_resource.py index 0d199e6f6f97..67e93dd79e77 100644 --- a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/tracked_resource.py +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/tracked_resource.py @@ -18,13 +18,15 @@ class TrackedResource(ProxyResource): 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 location: The location the resource resides in. + :param location: Required. The location the resource resides in. :type location: str :param tags: Application-specific metadata in the form of key-value pairs. :type tags: dict[str, str] @@ -45,7 +47,7 @@ class TrackedResource(ProxyResource): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, location, tags=None): - super(TrackedResource, self).__init__() - self.location = location - self.tags = tags + def __init__(self, **kwargs): + super(TrackedResource, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/tracked_resource_py3.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/tracked_resource_py3.py new file mode 100644 index 000000000000..6db5a5b1b40c --- /dev/null +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/tracked_resource_py3.py @@ -0,0 +1,53 @@ +# 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 TrackedResource(ProxyResource): + """Resource properties including location and tags for track resources. + + 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 location: Required. The location the resource resides in. + :type location: str + :param tags: Application-specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, location: str, tags=None, **kwargs) -> None: + super(TrackedResource, self).__init__(, **kwargs) + self.location = location + self.tags = tags diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/configurations_operations.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/configurations_operations.py index 3b05def60d9f..56659c8d70e5 100644 --- a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/configurations_operations.py +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/configurations_operations.py @@ -12,8 +12,8 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError -from msrest.exceptions import DeserializationError -from msrestazure.azure_operation import AzureOperationPoller +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling from .. import models @@ -93,7 +93,7 @@ def _create_or_update_initial( return deserialized def create_or_update( - self, resource_group_name, server_name, configuration_name, value=None, source=None, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, server_name, configuration_name, value=None, source=None, custom_headers=None, raw=False, polling=True, **operation_config): """Updates a configuration of a server. :param resource_group_name: The name of the resource group that @@ -109,13 +109,16 @@ def create_or_update( :param source: Source of the configuration. :type source: str :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - Configuration or ClientRawResponse if raw=true + :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 Configuration or + ClientRawResponse if raw==True :rtype: ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.rdbms.postgresql.models.Configuration] - or ~msrest.pipeline.ClientRawResponse + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.rdbms.postgresql.models.Configuration]] :raises: :class:`CloudError` """ raw_result = self._create_or_update_initial( @@ -128,30 +131,8 @@ def create_or_update( raw=True, **operation_config ) - if raw: - return raw_result - - # Construct and send request - def long_running_send(): - return raw_result.response - - def get_long_running_status(status_link, headers=None): - - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - header_parameters = {} - header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] - return self._client.send( - request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): - - if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - deserialized = self._deserialize('Configuration', response) if raw: @@ -160,12 +141,13 @@ def get_long_running_output(response): return deserialized - long_running_operation_timeout = operation_config.get( + lro_delay = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) - return AzureOperationPoller( - long_running_send, get_long_running_output, - get_long_running_status, 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.DBforPostgreSQL/servers/{serverName}/configurations/{configurationName}'} def get( diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/databases_operations.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/databases_operations.py index dd1a3ed96756..ddad0c26e74d 100644 --- a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/databases_operations.py +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/databases_operations.py @@ -12,8 +12,8 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError -from msrest.exceptions import DeserializationError -from msrestazure.azure_operation import AzureOperationPoller +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling from .. import models @@ -95,7 +95,7 @@ def _create_or_update_initial( return deserialized def create_or_update( - self, resource_group_name, server_name, database_name, charset=None, collation=None, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, server_name, database_name, charset=None, collation=None, custom_headers=None, raw=False, polling=True, **operation_config): """Creates a new database or updates an existing database. :param resource_group_name: The name of the resource group that @@ -111,13 +111,16 @@ def create_or_update( :param collation: The collation of the database. :type collation: str :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns Database or - ClientRawResponse if raw=true + :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 Database or + ClientRawResponse if raw==True :rtype: ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.rdbms.postgresql.models.Database] - or ~msrest.pipeline.ClientRawResponse + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.rdbms.postgresql.models.Database]] :raises: :class:`CloudError` """ raw_result = self._create_or_update_initial( @@ -130,30 +133,8 @@ def create_or_update( raw=True, **operation_config ) - if raw: - return raw_result - - # Construct and send request - def long_running_send(): - return raw_result.response - - def get_long_running_status(status_link, headers=None): - - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - header_parameters = {} - header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] - return self._client.send( - request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): - - 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 = self._deserialize('Database', response) if raw: @@ -162,12 +143,13 @@ def get_long_running_output(response): return deserialized - long_running_operation_timeout = operation_config.get( + lro_delay = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) - return AzureOperationPoller( - long_running_send, get_long_running_output, - get_long_running_status, 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.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}'} @@ -211,7 +193,7 @@ def _delete_initial( return client_raw_response def delete( - self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, polling=True, **operation_config): """Deletes a database. :param resource_group_name: The name of the resource group that @@ -223,12 +205,14 @@ def delete( :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 - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true + :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 - ~msrest.pipeline.ClientRawResponse + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] :raises: :class:`CloudError` """ raw_result = self._delete_initial( @@ -239,40 +223,19 @@ def delete( raw=True, **operation_config ) - if raw: - return raw_result - - # Construct and send request - def long_running_send(): - return raw_result.response - - def get_long_running_status(status_link, headers=None): - - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - header_parameters = {} - header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] - return self._client.send( - request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): - - 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 - long_running_operation_timeout = operation_config.get( + lro_delay = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) - return AzureOperationPoller( - long_running_send, get_long_running_output, - get_long_running_status, 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.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}'} def get( diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/firewall_rules_operations.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/firewall_rules_operations.py index 07d47bda47e9..dc202e09a79d 100644 --- a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/firewall_rules_operations.py +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/firewall_rules_operations.py @@ -12,8 +12,8 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError -from msrest.exceptions import DeserializationError -from msrestazure.azure_operation import AzureOperationPoller +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling from .. import models @@ -95,7 +95,7 @@ def _create_or_update_initial( return deserialized def create_or_update( - self, resource_group_name, server_name, firewall_rule_name, start_ip_address, end_ip_address, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, server_name, firewall_rule_name, start_ip_address, end_ip_address, custom_headers=None, raw=False, polling=True, **operation_config): """Creates a new firewall rule or updates an existing firewall rule. :param resource_group_name: The name of the resource group that @@ -113,13 +113,16 @@ def create_or_update( Must be IPv4 format. :type end_ip_address: str :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns FirewallRule - or ClientRawResponse if raw=true + :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 FirewallRule or + ClientRawResponse if raw==True :rtype: ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.rdbms.postgresql.models.FirewallRule] - or ~msrest.pipeline.ClientRawResponse + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.rdbms.postgresql.models.FirewallRule]] :raises: :class:`CloudError` """ raw_result = self._create_or_update_initial( @@ -132,30 +135,8 @@ def create_or_update( raw=True, **operation_config ) - if raw: - return raw_result - - # Construct and send request - def long_running_send(): - return raw_result.response - - def get_long_running_status(status_link, headers=None): - - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - header_parameters = {} - header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] - return self._client.send( - request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): - - 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 = self._deserialize('FirewallRule', response) if raw: @@ -164,12 +145,13 @@ def get_long_running_output(response): return deserialized - long_running_operation_timeout = operation_config.get( + lro_delay = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) - return AzureOperationPoller( - long_running_send, get_long_running_output, - get_long_running_status, 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.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}'} @@ -213,7 +195,7 @@ def _delete_initial( return client_raw_response def delete( - self, resource_group_name, server_name, firewall_rule_name, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, server_name, firewall_rule_name, custom_headers=None, raw=False, polling=True, **operation_config): """Deletes a server firewall rule. :param resource_group_name: The name of the resource group that @@ -225,12 +207,14 @@ def delete( :param firewall_rule_name: The name of the server firewall rule. :type firewall_rule_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 - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true + :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 - ~msrest.pipeline.ClientRawResponse + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] :raises: :class:`CloudError` """ raw_result = self._delete_initial( @@ -241,40 +225,19 @@ def delete( raw=True, **operation_config ) - if raw: - return raw_result - - # Construct and send request - def long_running_send(): - return raw_result.response - - def get_long_running_status(status_link, headers=None): - - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - header_parameters = {} - header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] - return self._client.send( - request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): - - 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 - long_running_operation_timeout = operation_config.get( + lro_delay = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) - return AzureOperationPoller( - long_running_send, get_long_running_output, - get_long_running_status, 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.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}'} def get( diff --git a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/servers_operations.py b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/servers_operations.py index d16cc5eb2f49..b3c556aab92b 100644 --- a/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/servers_operations.py +++ b/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/servers_operations.py @@ -12,8 +12,8 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError -from msrest.exceptions import DeserializationError -from msrestazure.azure_operation import AzureOperationPoller +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling from .. import models @@ -92,7 +92,7 @@ def _create_initial( return deserialized def create( - self, resource_group_name, server_name, parameters, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, server_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): """Creates a new server, or will overwrite an existing server. :param resource_group_name: The name of the resource group that @@ -105,13 +105,16 @@ def create( server. :type parameters: ~azure.mgmt.rdbms.postgresql.models.ServerForCreate :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns Server or - ClientRawResponse if raw=true + :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 Server or + ClientRawResponse if raw==True :rtype: ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.rdbms.postgresql.models.Server] - or ~msrest.pipeline.ClientRawResponse + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.rdbms.postgresql.models.Server]] :raises: :class:`CloudError` """ raw_result = self._create_initial( @@ -122,30 +125,8 @@ def create( raw=True, **operation_config ) - if raw: - return raw_result - - # Construct and send request - def long_running_send(): - return raw_result.response - - def get_long_running_status(status_link, headers=None): - - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - header_parameters = {} - header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] - return self._client.send( - request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): - - 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 = self._deserialize('Server', response) if raw: @@ -154,12 +135,13 @@ def get_long_running_output(response): return deserialized - long_running_operation_timeout = operation_config.get( + lro_delay = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) - return AzureOperationPoller( - long_running_send, get_long_running_output, - get_long_running_status, 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.DBforPostgreSQL/servers/{serverName}'} @@ -213,7 +195,7 @@ def _update_initial( return deserialized def update( - self, resource_group_name, server_name, parameters, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, server_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): """Updates an existing server. The request body can contain one to many of the properties present in the normal server definition. @@ -227,13 +209,16 @@ def update( :type parameters: ~azure.mgmt.rdbms.postgresql.models.ServerUpdateParameters :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns Server or - ClientRawResponse if raw=true + :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 Server or + ClientRawResponse if raw==True :rtype: ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.rdbms.postgresql.models.Server] - or ~msrest.pipeline.ClientRawResponse + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.rdbms.postgresql.models.Server]] :raises: :class:`CloudError` """ raw_result = self._update_initial( @@ -244,30 +229,8 @@ def update( raw=True, **operation_config ) - if raw: - return raw_result - - # Construct and send request - def long_running_send(): - return raw_result.response - - def get_long_running_status(status_link, headers=None): - - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - header_parameters = {} - header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] - return self._client.send( - request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): - - if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - deserialized = self._deserialize('Server', response) if raw: @@ -276,12 +239,13 @@ def get_long_running_output(response): return deserialized - long_running_operation_timeout = operation_config.get( + lro_delay = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) - return AzureOperationPoller( - long_running_send, get_long_running_output, - get_long_running_status, 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) update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}'} @@ -324,7 +288,7 @@ def _delete_initial( return client_raw_response def delete( - self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, server_name, custom_headers=None, raw=False, polling=True, **operation_config): """Deletes a server. :param resource_group_name: The name of the resource group that @@ -334,12 +298,14 @@ def delete( :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 - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true + :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 - ~msrest.pipeline.ClientRawResponse + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] :raises: :class:`CloudError` """ raw_result = self._delete_initial( @@ -349,40 +315,19 @@ def delete( raw=True, **operation_config ) - if raw: - return raw_result - - # Construct and send request - def long_running_send(): - return raw_result.response - - def get_long_running_status(status_link, headers=None): - - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - header_parameters = {} - header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] - return self._client.send( - request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): - - 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 - long_running_operation_timeout = operation_config.get( + lro_delay = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) - return AzureOperationPoller( - long_running_send, get_long_running_output, - get_long_running_status, 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.DBforPostgreSQL/servers/{serverName}'} def get(