Skip to content
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
2 changes: 2 additions & 0 deletions azure-mgmt-redis/azure/mgmt/redis/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from .import_rdb_parameters import ImportRDBParameters
from .schedule_entry import ScheduleEntry
from .redis_patch_schedule import RedisPatchSchedule
from .redis_force_reboot_response import RedisForceRebootResponse
from .redis_resource_paged import RedisResourcePaged
from .redis_management_client_enums import (
SkuName,
Expand All @@ -43,6 +44,7 @@
'ImportRDBParameters',
'ScheduleEntry',
'RedisPatchSchedule',
'RedisForceRebootResponse',
'RedisResourcePaged',
'SkuName',
'SkuFamily',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 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 RedisForceRebootResponse(Model):
"""Response to force reboot for Redis cache.

Variables are only populated by the server, and will be ignored when
sending a request.

:ivar message: Status message
:vartype message: str
"""

_validation = {
'message': {'readonly': True},
}

_attribute_map = {
'message': {'key': 'Message', 'type': 'str'},
}

def __init__(self):
self.message = None
7 changes: 7 additions & 0 deletions azure-mgmt-redis/azure/mgmt/redis/models/redis_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ class RedisResource(Resource):
:vartype port: int
:ivar ssl_port: Redis SSL port.
:vartype ssl_port: int
:ivar access_keys: The keys of the Redis cache - not set if this object is
not the response to Create or Update redis cache
:vartype access_keys: :class:`RedisAccessKeys
<azure.mgmt.redis.models.RedisAccessKeys>`
"""

_validation = {
Expand All @@ -73,6 +77,7 @@ class RedisResource(Resource):
'host_name': {'readonly': True},
'port': {'readonly': True},
'ssl_port': {'readonly': True},
'access_keys': {'readonly': True},
}

_attribute_map = {
Expand All @@ -93,6 +98,7 @@ class RedisResource(Resource):
'host_name': {'key': 'properties.hostName', 'type': 'str'},
'port': {'key': 'properties.port', 'type': 'int'},
'ssl_port': {'key': 'properties.sslPort', 'type': 'int'},
'access_keys': {'key': 'properties.accessKeys', 'type': 'RedisAccessKeys'},
}

def __init__(self, location, tags=None, redis_configuration=None, enable_non_ssl_port=None, tenant_settings=None, shard_count=None, subnet_id=None, static_ip=None, sku=None):
Expand All @@ -109,3 +115,4 @@ def __init__(self, location, tags=None, redis_configuration=None, enable_non_ssl
self.host_name = None
self.port = None
self.ssl_port = None
self.access_keys = None
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def create_or_update(
response = self._client.send(
request, header_parameters, body_content, **operation_config)

if response.status_code not in [200]:
if response.status_code not in [200, 201]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
Expand All @@ -98,6 +98,8 @@ def create_or_update(

if response.status_code == 200:
deserialized = self._deserialize('RedisPatchSchedule', response)
if response.status_code == 201:
deserialized = self._deserialize('RedisPatchSchedule', response)

if raw:
client_raw_response = ClientRawResponse(deserialized, response)
Expand Down Expand Up @@ -205,7 +207,7 @@ def get(
request = self._client.get(url, query_parameters)
response = self._client.send(request, header_parameters, **operation_config)

if response.status_code not in [200, 404]:
if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
Expand Down
18 changes: 13 additions & 5 deletions azure-mgmt-redis/azure/mgmt/redis/operations/redis_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,8 @@ def force_reboot(
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:rtype: None
:rtype: :class:`RedisForceRebootResponse
<azure.mgmt.redis.models.RedisForceRebootResponse>`
:rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
if raw=true
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
Expand Down Expand Up @@ -660,15 +661,22 @@ def force_reboot(
response = self._client.send(
request, header_parameters, body_content, **operation_config)

if response.status_code not in [200, 204]:
if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp

deserialized = None

if response.status_code == 200:
deserialized = self._deserialize('RedisForceRebootResponse', response)

if raw:
client_raw_response = ClientRawResponse(None, response)
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response

return deserialized

def import_data(
self, resource_group_name, name, files, format=None, custom_headers=None, raw=False, **operation_config):
"""Import data into Redis cache.
Expand Down Expand Up @@ -736,7 +744,7 @@ def get_long_running_status(status_link, headers=None):

def get_long_running_output(response):

if response.status_code not in [202]:
if response.status_code not in [202, 200, 204]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
Expand Down Expand Up @@ -820,7 +828,7 @@ def get_long_running_status(status_link, headers=None):

def get_long_running_output(response):

if response.status_code not in [202]:
if response.status_code not in [202, 200, 204]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
Expand Down
35 changes: 4 additions & 31 deletions azure-mgmt-redis/azure/mgmt/redis/redis_management_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,11 @@ class RedisManagementClientConfiguration(AzureConfiguration):
:type subscription_id: str
:param api_version: Client Api Version.
:type api_version: str
:param accept_language: Gets or sets the preferred language for the
response.
:type accept_language: str
:param long_running_operation_retry_timeout: Gets or sets the retry
timeout in seconds for Long Running Operations. Default value is 30.
:type long_running_operation_retry_timeout: int
:param generate_client_request_id: When set to true a unique
x-ms-client-request-id value is generated and included in each request.
Default is true.
:type generate_client_request_id: bool
:param str base_url: Service URL
:param str filepath: Existing config
"""

def __init__(
self, credentials, subscription_id, api_version='2016-04-01', accept_language='en-US', long_running_operation_retry_timeout=30, generate_client_request_id=True, base_url=None, filepath=None):
self, credentials, subscription_id, api_version='2016-04-01', base_url=None):

if credentials is None:
raise ValueError("Parameter 'credentials' must not be None.")
Expand All @@ -57,22 +46,17 @@ def __init__(
raise TypeError("Parameter 'subscription_id' must be str.")
if api_version is not None and not isinstance(api_version, str):
raise TypeError("Optional parameter 'api_version' must be str.")
if accept_language is not None and not isinstance(accept_language, str):
raise TypeError("Optional parameter 'accept_language' must be str.")
if not base_url:
base_url = 'https://management.azure.com'

super(RedisManagementClientConfiguration, self).__init__(base_url, filepath)
super(RedisManagementClientConfiguration, self).__init__(base_url)

self.add_user_agent('redismanagementclient/{}'.format(VERSION))
self.add_user_agent('Azure-SDK-For-Python')

self.credentials = credentials
self.subscription_id = subscription_id
self.api_version = api_version
self.accept_language = accept_language
self.long_running_operation_retry_timeout = long_running_operation_retry_timeout
self.generate_client_request_id = generate_client_request_id


class RedisManagementClient(object):
Expand All @@ -95,24 +79,13 @@ class RedisManagementClient(object):
:type subscription_id: str
:param api_version: Client Api Version.
:type api_version: str
:param accept_language: Gets or sets the preferred language for the
response.
:type accept_language: str
:param long_running_operation_retry_timeout: Gets or sets the retry
timeout in seconds for Long Running Operations. Default value is 30.
:type long_running_operation_retry_timeout: int
:param generate_client_request_id: When set to true a unique
x-ms-client-request-id value is generated and included in each request.
Default is true.
:type generate_client_request_id: bool
:param str base_url: Service URL
:param str filepath: Existing config
"""

def __init__(
self, credentials, subscription_id, api_version='2016-04-01', accept_language='en-US', long_running_operation_retry_timeout=30, generate_client_request_id=True, base_url=None, filepath=None):
self, credentials, subscription_id, api_version='2016-04-01', base_url=None):

self.config = RedisManagementClientConfiguration(credentials, subscription_id, api_version, accept_language, long_running_operation_retry_timeout, generate_client_request_id, base_url, filepath)
self.config = RedisManagementClientConfiguration(credentials, subscription_id, api_version, base_url)
self._client = ServiceClient(self.config.credentials, self.config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
Expand Down