Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[AutoPR mysql/resource-manager] [Don't merge until 06/29/2018] Add mysql replica APIs into spec #2725

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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions azure-mgmt-rdbms/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This is the Microsoft Azure RDBMS Management Client Library.
Azure Resource Manager (ARM) is the next generation of management APIs that
replace the old Azure Service Management (ASM).

This package has been tested with Python 2.7, 3.4, 3.5 and 3.6.
This package has been tested with Python 2.7, 3.4, 3.5, 3.6 and 3.7.

For the older Azure Service Management (ASM) libraries, see
`azure-servicemanagement-legacy <https://pypi.python.org/pypi/azure-servicemanagement-legacy>`__ library.
Expand Down Expand Up @@ -36,12 +36,8 @@ If you see azure==0.11.0 (or any version below 1.0), uninstall it first:
Usage
=====

For code examples, see `PostgreSQL
<https://docs.microsoft.com/python/api/overview/azure/postgresql>`__
on docs.microsoft.com.

For code examples, see `MySQL
<https://docs.microsoft.com/python/api/overview/azure/mysql>`__
For code examples, see `RDBMS Management
<https://docs.microsoft.com/python/api/overview/azure/>`__
on docs.microsoft.com.


Expand Down
8 changes: 8 additions & 0 deletions azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from .server_properties_for_default_create_py3 import ServerPropertiesForDefaultCreate
from .server_properties_for_restore_py3 import ServerPropertiesForRestore
from .server_properties_for_geo_restore_py3 import ServerPropertiesForGeoRestore
from .server_properties_for_replica_py3 import ServerPropertiesForReplica
from .sku_py3 import Sku
from .server_py3 import Server
from .server_for_create_py3 import ServerForCreate
Expand All @@ -33,6 +34,7 @@
from .performance_tier_properties_py3 import PerformanceTierProperties
from .name_availability_request_py3 import NameAvailabilityRequest
from .name_availability_py3 import NameAvailability
from .server_security_alert_policy_py3 import ServerSecurityAlertPolicy
except (SyntaxError, ImportError):
from .proxy_resource import ProxyResource
from .tracked_resource import TrackedResource
Expand All @@ -41,6 +43,7 @@
from .server_properties_for_default_create import ServerPropertiesForDefaultCreate
from .server_properties_for_restore import ServerPropertiesForRestore
from .server_properties_for_geo_restore import ServerPropertiesForGeoRestore
from .server_properties_for_replica import ServerPropertiesForReplica
from .sku import Sku
from .server import Server
from .server_for_create import ServerForCreate
Expand All @@ -57,6 +60,7 @@
from .performance_tier_properties import PerformanceTierProperties
from .name_availability_request import NameAvailabilityRequest
from .name_availability import NameAvailability
from .server_security_alert_policy import ServerSecurityAlertPolicy
from .server_paged import ServerPaged
from .firewall_rule_paged import FirewallRulePaged
from .virtual_network_rule_paged import VirtualNetworkRulePaged
Expand All @@ -72,6 +76,7 @@
SkuTier,
VirtualNetworkRuleState,
OperationOrigin,
ServerSecurityAlertPolicyState,
)

__all__ = [
Expand All @@ -82,6 +87,7 @@
'ServerPropertiesForDefaultCreate',
'ServerPropertiesForRestore',
'ServerPropertiesForGeoRestore',
'ServerPropertiesForReplica',
'Sku',
'Server',
'ServerForCreate',
Expand All @@ -98,6 +104,7 @@
'PerformanceTierProperties',
'NameAvailabilityRequest',
'NameAvailability',
'ServerSecurityAlertPolicy',
'ServerPaged',
'FirewallRulePaged',
'VirtualNetworkRulePaged',
Expand All @@ -112,4 +119,5 @@
'SkuTier',
'VirtualNetworkRuleState',
'OperationOrigin',
'ServerSecurityAlertPolicyState',
]
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,9 @@ class OperationOrigin(str, Enum):
not_specified = "NotSpecified"
user = "user"
system = "system"


class ServerSecurityAlertPolicyState(str, Enum):

enabled = "Enabled"
disabled = "Disabled"
14 changes: 14 additions & 0 deletions azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/models/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,21 @@ class Server(TrackedResource):
:type earliest_restore_date: datetime
:param storage_profile: Storage profile of a server.
:type storage_profile: ~azure.mgmt.rdbms.mysql.models.StorageProfile
:param replication_role: The replication role of the server.
:type replication_role: str
:param master_server_id: The master server id of a relica server.
:type master_server_id: str
:param replica_capacity: The maximum number of replicas that a master
server can have.
:type replica_capacity: int
"""

_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'location': {'required': True},
'replica_capacity': {'minimum': 0},
}

_attribute_map = {
Expand All @@ -77,6 +85,9 @@ class Server(TrackedResource):
'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'},
'replication_role': {'key': 'properties.replicationRole', 'type': 'str'},
'master_server_id': {'key': 'properties.masterServerId', 'type': 'str'},
'replica_capacity': {'key': 'properties.replicaCapacity', 'type': 'int'},
}

def __init__(self, **kwargs):
Expand All @@ -89,3 +100,6 @@ def __init__(self, **kwargs):
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)
self.replication_role = kwargs.get('replication_role', None)
self.master_server_id = kwargs.get('master_server_id', None)
self.replica_capacity = kwargs.get('replica_capacity', None)
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class ServerPropertiesForCreate(Model):

You probably want to use the sub-classes and not this class directly. Known
sub-classes are: ServerPropertiesForDefaultCreate,
ServerPropertiesForRestore, ServerPropertiesForGeoRestore
ServerPropertiesForRestore, ServerPropertiesForGeoRestore,
ServerPropertiesForReplica

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

Expand Down Expand Up @@ -45,7 +46,7 @@ class ServerPropertiesForCreate(Model):
}

_subtype_map = {
'create_mode': {'Default': 'ServerPropertiesForDefaultCreate', 'PointInTimeRestore': 'ServerPropertiesForRestore', 'GeoRestore': 'ServerPropertiesForGeoRestore'}
'create_mode': {'Default': 'ServerPropertiesForDefaultCreate', 'PointInTimeRestore': 'ServerPropertiesForRestore', 'GeoRestore': 'ServerPropertiesForGeoRestore', 'Replica': 'ServerPropertiesForReplica'}
}

def __init__(self, **kwargs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class ServerPropertiesForCreate(Model):

You probably want to use the sub-classes and not this class directly. Known
sub-classes are: ServerPropertiesForDefaultCreate,
ServerPropertiesForRestore, ServerPropertiesForGeoRestore
ServerPropertiesForRestore, ServerPropertiesForGeoRestore,
ServerPropertiesForReplica

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

Expand Down Expand Up @@ -45,7 +46,7 @@ class ServerPropertiesForCreate(Model):
}

_subtype_map = {
'create_mode': {'Default': 'ServerPropertiesForDefaultCreate', 'PointInTimeRestore': 'ServerPropertiesForRestore', 'GeoRestore': 'ServerPropertiesForGeoRestore'}
'create_mode': {'Default': 'ServerPropertiesForDefaultCreate', 'PointInTimeRestore': 'ServerPropertiesForRestore', 'GeoRestore': 'ServerPropertiesForGeoRestore', 'Replica': 'ServerPropertiesForReplica'}
}

def __init__(self, *, version=None, ssl_enforcement=None, storage_profile=None, **kwargs) -> None:
Expand Down
Original file line number Diff line number Diff line change
@@ -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 .server_properties_for_create import ServerPropertiesForCreate


class ServerPropertiesForReplica(ServerPropertiesForCreate):
"""The properties to create a new replica.

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

:param version: Server version. Possible values include: '5.6', '5.7'
:type version: str or ~azure.mgmt.rdbms.mysql.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.mysql.models.SslEnforcementEnum
:param storage_profile: Storage profile of a server.
:type storage_profile: ~azure.mgmt.rdbms.mysql.models.StorageProfile
:param create_mode: Required. Constant filled by server.
:type create_mode: str
:param source_server_id: Required. The master server id to create replica
from.
:type source_server_id: str
"""

_validation = {
'create_mode': {'required': True},
'source_server_id': {'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'},
}

def __init__(self, **kwargs):
super(ServerPropertiesForReplica, self).__init__(**kwargs)
self.source_server_id = kwargs.get('source_server_id', None)
self.create_mode = 'Replica'
Original file line number Diff line number Diff line change
@@ -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 .server_properties_for_create_py3 import ServerPropertiesForCreate


class ServerPropertiesForReplica(ServerPropertiesForCreate):
"""The properties to create a new replica.

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

:param version: Server version. Possible values include: '5.6', '5.7'
:type version: str or ~azure.mgmt.rdbms.mysql.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.mysql.models.SslEnforcementEnum
:param storage_profile: Storage profile of a server.
:type storage_profile: ~azure.mgmt.rdbms.mysql.models.StorageProfile
:param create_mode: Required. Constant filled by server.
:type create_mode: str
:param source_server_id: Required. The master server id to create replica
from.
:type source_server_id: str
"""

_validation = {
'create_mode': {'required': True},
'source_server_id': {'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'},
}

def __init__(self, *, source_server_id: str, version=None, ssl_enforcement=None, storage_profile=None, **kwargs) -> None:
super(ServerPropertiesForReplica, self).__init__(version=version, ssl_enforcement=ssl_enforcement, storage_profile=storage_profile, **kwargs)
self.source_server_id = source_server_id
self.create_mode = 'Replica'
16 changes: 15 additions & 1 deletion azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/models/server_py3.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,21 @@ class Server(TrackedResource):
:type earliest_restore_date: datetime
:param storage_profile: Storage profile of a server.
:type storage_profile: ~azure.mgmt.rdbms.mysql.models.StorageProfile
:param replication_role: The replication role of the server.
:type replication_role: str
:param master_server_id: The master server id of a relica server.
:type master_server_id: str
:param replica_capacity: The maximum number of replicas that a master
server can have.
:type replica_capacity: int
"""

_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'location': {'required': True},
'replica_capacity': {'minimum': 0},
}

_attribute_map = {
Expand All @@ -77,9 +85,12 @@ class Server(TrackedResource):
'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'},
'replication_role': {'key': 'properties.replicationRole', 'type': 'str'},
'master_server_id': {'key': 'properties.masterServerId', 'type': 'str'},
'replica_capacity': {'key': 'properties.replicaCapacity', 'type': 'int'},
}

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:
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, replication_role: str=None, master_server_id: str=None, replica_capacity: int=None, **kwargs) -> None:
super(Server, self).__init__(location=location, tags=tags, **kwargs)
self.sku = sku
self.administrator_login = administrator_login
Expand All @@ -89,3 +100,6 @@ def __init__(self, *, location: str, tags=None, sku=None, administrator_login: s
self.fully_qualified_domain_name = fully_qualified_domain_name
self.earliest_restore_date = earliest_restore_date
self.storage_profile = storage_profile
self.replication_role = replication_role
self.master_server_id = master_server_id
self.replica_capacity = replica_capacity
Loading