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

[ReleasePR azure-mgmt-redis] Add reboot parameters. #11641

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
30 changes: 11 additions & 19 deletions sdk/redis/azure-mgmt-redis/README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,21 @@
## Microsoft Azure SDK for Python
# Microsoft Azure SDK for Python

This is the Microsoft Azure Redis Cache Management Client Library.
This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8.
For a more complete view of Azure libraries, see the [Github repo](https://github.com/Azure/azure-sdk-for-python/)

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.5, 3.6 and 3.7.
# Usage

For the older Azure Service Management (ASM) libraries, see
[azure-servicemanagement-legacy](https://pypi.python.org/pypi/azure-servicemanagement-legacy)
library.

For a more complete set of Azure libraries, see the
[azure](https://pypi.python.org/pypi/azure) bundle package.

## Usage

For code examples, see [Redis Cache
Management](https://docs.microsoft.com/python/api/overview/azure/redis)
For code examples, see [Redis Cache Management](https://docs.microsoft.com/python/api/overview/azure/redis)
on docs.microsoft.com.

## Provide Feedback

If you encounter any bugs or have suggestions, please file an issue in
the [Issues](https://github.com/Azure/azure-sdk-for-python/issues)
# Provide Feedback

If you encounter any bugs or have suggestions, please file an issue in the
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
section of the project.

![image](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-redis%2FREADME.png)

![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-redis%2FREADME.png)
20 changes: 12 additions & 8 deletions sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,20 +568,24 @@ class RedisInstanceDetails(Model):
:vartype zone: str
:ivar shard_id: If clustering is enabled, the Shard ID of Redis Instance
:vartype shard_id: int
:ivar is_master: Specifies whether the instance is a master node.
:vartype is_master: bool
"""

_validation = {
'ssl_port': {'readonly': True},
'non_ssl_port': {'readonly': True},
'zone': {'readonly': True},
'shard_id': {'readonly': True},
'is_master': {'readonly': True},
}

_attribute_map = {
'ssl_port': {'key': 'sslPort', 'type': 'int'},
'non_ssl_port': {'key': 'nonSslPort', 'type': 'int'},
'zone': {'key': 'zone', 'type': 'str'},
'shard_id': {'key': 'shardId', 'type': 'int'},
'is_master': {'key': 'isMaster', 'type': 'bool'},
}

def __init__(self, **kwargs):
Expand All @@ -590,6 +594,7 @@ def __init__(self, **kwargs):
self.non_ssl_port = None
self.zone = None
self.shard_id = None
self.is_master = None


class RedisLinkedServer(Model):
Expand Down Expand Up @@ -747,30 +752,29 @@ def __init__(self, **kwargs):
class RedisRebootParameters(Model):
"""Specifies which Redis node(s) to reboot.

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

:param reboot_type: Required. Which Redis node(s) to reboot. Depending on
this value data loss is possible. Possible values include: 'PrimaryNode',
:param reboot_type: Which Redis node(s) to reboot. Depending on this value
data loss is possible. Possible values include: 'PrimaryNode',
'SecondaryNode', 'AllNodes'
:type reboot_type: str or ~azure.mgmt.redis.models.RebootType
:param shard_id: If clustering is enabled, the ID of the shard to be
rebooted.
:type shard_id: int
:param ports: A list of redis instances to reboot, specified by
per-instance SSL ports or non-SSL ports.
:type ports: list[int]
"""

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

_attribute_map = {
'reboot_type': {'key': 'rebootType', 'type': 'str'},
'shard_id': {'key': 'shardId', 'type': 'int'},
'ports': {'key': 'ports', 'type': '[int]'},
}

def __init__(self, **kwargs):
super(RedisRebootParameters, self).__init__(**kwargs)
self.reboot_type = kwargs.get('reboot_type', None)
self.shard_id = kwargs.get('shard_id', None)
self.ports = kwargs.get('ports', None)


class RedisRegenerateKeyParameters(Model):
Expand Down
22 changes: 13 additions & 9 deletions sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/_models_py3.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,20 +568,24 @@ class RedisInstanceDetails(Model):
:vartype zone: str
:ivar shard_id: If clustering is enabled, the Shard ID of Redis Instance
:vartype shard_id: int
:ivar is_master: Specifies whether the instance is a master node.
:vartype is_master: bool
"""

_validation = {
'ssl_port': {'readonly': True},
'non_ssl_port': {'readonly': True},
'zone': {'readonly': True},
'shard_id': {'readonly': True},
'is_master': {'readonly': True},
}

_attribute_map = {
'ssl_port': {'key': 'sslPort', 'type': 'int'},
'non_ssl_port': {'key': 'nonSslPort', 'type': 'int'},
'zone': {'key': 'zone', 'type': 'str'},
'shard_id': {'key': 'shardId', 'type': 'int'},
'is_master': {'key': 'isMaster', 'type': 'bool'},
}

def __init__(self, **kwargs) -> None:
Expand All @@ -590,6 +594,7 @@ def __init__(self, **kwargs) -> None:
self.non_ssl_port = None
self.zone = None
self.shard_id = None
self.is_master = None


class RedisLinkedServer(Model):
Expand Down Expand Up @@ -747,30 +752,29 @@ def __init__(self, *, schedule_entries, **kwargs) -> None:
class RedisRebootParameters(Model):
"""Specifies which Redis node(s) to reboot.

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

:param reboot_type: Required. Which Redis node(s) to reboot. Depending on
this value data loss is possible. Possible values include: 'PrimaryNode',
:param reboot_type: Which Redis node(s) to reboot. Depending on this value
data loss is possible. Possible values include: 'PrimaryNode',
'SecondaryNode', 'AllNodes'
:type reboot_type: str or ~azure.mgmt.redis.models.RebootType
:param shard_id: If clustering is enabled, the ID of the shard to be
rebooted.
:type shard_id: int
:param ports: A list of redis instances to reboot, specified by
per-instance SSL ports or non-SSL ports.
:type ports: list[int]
"""

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

_attribute_map = {
'reboot_type': {'key': 'rebootType', 'type': 'str'},
'shard_id': {'key': 'shardId', 'type': 'int'},
'ports': {'key': 'ports', 'type': '[int]'},
}

def __init__(self, *, reboot_type, shard_id: int=None, **kwargs) -> None:
def __init__(self, *, reboot_type=None, shard_id: int=None, ports=None, **kwargs) -> None:
super(RedisRebootParameters, self).__init__(**kwargs)
self.reboot_type = reboot_type
self.shard_id = shard_id
self.ports = ports


class RedisRegenerateKeyParameters(Model):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -743,21 +743,16 @@ def regenerate_key(
regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/regenerateKey'}

def force_reboot(
self, resource_group_name, name, reboot_type, shard_id=None, custom_headers=None, raw=False, **operation_config):
self, resource_group_name, name, parameters, custom_headers=None, raw=False, **operation_config):
"""Reboot specified Redis node(s). This operation requires write
permission to the cache resource. There can be potential data loss.

:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param name: The name of the Redis cache.
:type name: str
:param reboot_type: Which Redis node(s) to reboot. Depending on this
value data loss is possible. Possible values include: 'PrimaryNode',
'SecondaryNode', 'AllNodes'
:type reboot_type: str or ~azure.mgmt.redis.models.RebootType
:param shard_id: If clustering is enabled, the ID of the shard to be
rebooted.
:type shard_id: int
:param parameters: Specifies which Redis node(s) to reboot.
:type parameters: ~azure.mgmt.redis.models.RedisRebootParameters
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
Expand All @@ -768,8 +763,6 @@ def force_reboot(
~msrest.pipeline.ClientRawResponse
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
parameters = models.RedisRebootParameters(reboot_type=reboot_type, shard_id=shard_id)

# Construct URL
url = self.force_reboot.metadata['url']
path_format_arguments = {
Expand Down
5 changes: 4 additions & 1 deletion sdk/redis/azure-mgmt-redis/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
pass

# Version extraction inspired from 'requests'
with open(os.path.join(package_folder_path, 'version.py'), 'r') as fd:
with open(os.path.join(package_folder_path, 'version.py')
if os.path.exists(os.path.join(package_folder_path, 'version.py'))
else os.path.join(package_folder_path, '_version.py'), 'r') as fd:
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTILINE).group(1)

Expand Down Expand Up @@ -67,6 +69,7 @@
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'License :: OSI Approved :: MIT License',
],
zip_safe=False,
Expand Down