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 redis/resource-manager] Improve redis Swagger. #2485

Merged
merged 3 commits into from
May 3, 2018
Merged
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
6 changes: 6 additions & 0 deletions azure-mgmt-redis/azure/mgmt/redis/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,13 @@
from .operation_paged import OperationPaged
from .redis_resource_paged import RedisResourcePaged
from .redis_firewall_rule_paged import RedisFirewallRulePaged
from .redis_patch_schedule_paged import RedisPatchSchedulePaged
from .redis_linked_server_with_properties_paged import RedisLinkedServerWithPropertiesPaged
from .redis_management_client_enums import (
SkuName,
SkuFamily,
TlsVersion,
ProvisioningState,
RedisKeyType,
RebootType,
DayOfWeek,
Expand Down Expand Up @@ -76,9 +79,12 @@
'OperationPaged',
'RedisResourcePaged',
'RedisFirewallRulePaged',
'RedisPatchSchedulePaged',
'RedisLinkedServerWithPropertiesPaged',
'SkuName',
'SkuFamily',
'TlsVersion',
'ProvisioningState',
'RedisKeyType',
'RebootType',
'DayOfWeek',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,26 @@


class CheckNameAvailabilityParameters(Model):
"""Parameters body to pass for name availability check.
"""Parameters body to pass for resource name availability check.

:param name: Resource name.
:type name: str
:param type: Resource type.
:param type: Resource type. The only legal value of this property for
checking redis cache name availability is 'Microsoft.Cache/redis'.
:type type: str
"""

_validation = {
'name': {'required': True},
'type': {'required': True},
}

_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
}

def __init__(self, name=None, type=None):
def __init__(self, name, type):
super(CheckNameAvailabilityParameters, self).__init__()
self.name = name
self.type = type
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ class RedisCreateParameters(Model):
:param shard_count: The number of shards to be created on a Premium
Cluster Cache.
:type shard_count: int
:param minimum_tls_version: Optional: requires clients to use a specified
TLS version (or higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible
values include: '1.0', '1.1', '1.2'
:type minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion
:param sku: The SKU of the Redis cache to deploy.
:type sku: ~azure.mgmt.redis.models.Sku
:param subnet_id: The full resource ID of a subnet in a virtual network to
Expand Down Expand Up @@ -57,6 +61,7 @@ class RedisCreateParameters(Model):
'enable_non_ssl_port': {'key': 'properties.enableNonSslPort', 'type': 'bool'},
'tenant_settings': {'key': 'properties.tenantSettings', 'type': '{str}'},
'shard_count': {'key': 'properties.shardCount', 'type': 'int'},
'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'},
'sku': {'key': 'properties.sku', 'type': 'Sku'},
'subnet_id': {'key': 'properties.subnetId', 'type': 'str'},
'static_ip': {'key': 'properties.staticIP', 'type': 'str'},
Expand All @@ -65,12 +70,13 @@ class RedisCreateParameters(Model):
'tags': {'key': 'tags', 'type': '{str}'},
}

def __init__(self, sku, location, redis_configuration=None, enable_non_ssl_port=None, tenant_settings=None, shard_count=None, subnet_id=None, static_ip=None, zones=None, tags=None):
def __init__(self, sku, location, redis_configuration=None, enable_non_ssl_port=None, tenant_settings=None, shard_count=None, minimum_tls_version=None, subnet_id=None, static_ip=None, zones=None, tags=None):
super(RedisCreateParameters, self).__init__()
self.redis_configuration = redis_configuration
self.enable_non_ssl_port = enable_non_ssl_port
self.tenant_settings = tenant_settings
self.shard_count = shard_count
self.minimum_tls_version = minimum_tls_version
self.sku = sku
self.subnet_id = subnet_id
self.static_ip = static_ip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,29 @@ class SkuFamily(Enum):
p = "P"


class TlsVersion(Enum):

one_full_stop_zero = "1.0"
one_full_stop_one = "1.1"
one_full_stop_two = "1.2"


class ProvisioningState(Enum):

creating = "Creating"
deleting = "Deleting"
disabled = "Disabled"
failed = "Failed"
linking = "Linking"
provisioning = "Provisioning"
recovering_scale_failure = "RecoveringScaleFailure"
scaling = "Scaling"
succeeded = "Succeeded"
unlinking = "Unlinking"
unprovisioning = "Unprovisioning"
updating = "Updating"


class RedisKeyType(Enum):

primary = "Primary"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.paging import Paged


class RedisPatchSchedulePaged(Paged):
"""
A paging container for iterating over a list of :class:`RedisPatchSchedule <azure.mgmt.redis.models.RedisPatchSchedule>` object
"""

_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
'current_page': {'key': 'value', 'type': '[RedisPatchSchedule]'}
}

def __init__(self, *args, **kwargs):

super(RedisPatchSchedulePaged, self).__init__(*args, **kwargs)
16 changes: 13 additions & 3 deletions azure-mgmt-redis/azure/mgmt/redis/models/redis_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ class RedisResource(TrackedResource):
:param shard_count: The number of shards to be created on a Premium
Cluster Cache.
:type shard_count: int
:param minimum_tls_version: Optional: requires clients to use a specified
TLS version (or higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible
values include: '1.0', '1.1', '1.2'
:type minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion
:param sku: The SKU of the Redis cache to deploy.
:type sku: ~azure.mgmt.redis.models.Sku
:param subnet_id: The full resource ID of a subnet in a virtual network to
Expand All @@ -51,8 +55,12 @@ class RedisResource(TrackedResource):
:type static_ip: str
:ivar redis_version: Redis version.
:vartype redis_version: str
:ivar provisioning_state: Redis instance provisioning status.
:vartype provisioning_state: str
:ivar provisioning_state: Redis instance provisioning status. Possible
values include: 'Creating', 'Deleting', 'Disabled', 'Failed', 'Linking',
'Provisioning', 'RecoveringScaleFailure', 'Scaling', 'Succeeded',
'Unlinking', 'Unprovisioning', 'Updating'
:vartype provisioning_state: str or
~azure.mgmt.redis.models.ProvisioningState
:ivar host_name: Redis host name.
:vartype host_name: str
:ivar port: Redis non-SSL port.
Expand Down Expand Up @@ -96,6 +104,7 @@ class RedisResource(TrackedResource):
'enable_non_ssl_port': {'key': 'properties.enableNonSslPort', 'type': 'bool'},
'tenant_settings': {'key': 'properties.tenantSettings', 'type': '{str}'},
'shard_count': {'key': 'properties.shardCount', 'type': 'int'},
'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'},
'sku': {'key': 'properties.sku', 'type': 'Sku'},
'subnet_id': {'key': 'properties.subnetId', 'type': 'str'},
'static_ip': {'key': 'properties.staticIP', 'type': 'str'},
Expand All @@ -109,12 +118,13 @@ class RedisResource(TrackedResource):
'zones': {'key': 'zones', 'type': '[str]'},
}

def __init__(self, location, sku, tags=None, redis_configuration=None, enable_non_ssl_port=None, tenant_settings=None, shard_count=None, subnet_id=None, static_ip=None, zones=None):
def __init__(self, location, sku, tags=None, redis_configuration=None, enable_non_ssl_port=None, tenant_settings=None, shard_count=None, minimum_tls_version=None, subnet_id=None, static_ip=None, zones=None):
super(RedisResource, self).__init__(tags=tags, location=location)
self.redis_configuration = redis_configuration
self.enable_non_ssl_port = enable_non_ssl_port
self.tenant_settings = tenant_settings
self.shard_count = shard_count
self.minimum_tls_version = minimum_tls_version
self.sku = sku
self.subnet_id = subnet_id
self.static_ip = static_ip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ class RedisUpdateParameters(Model):
:param shard_count: The number of shards to be created on a Premium
Cluster Cache.
:type shard_count: int
:param minimum_tls_version: Optional: requires clients to use a specified
TLS version (or higher) to connect (e,g, '1.0', '1.1', '1.2'). Possible
values include: '1.0', '1.1', '1.2'
:type minimum_tls_version: str or ~azure.mgmt.redis.models.TlsVersion
:param sku: The SKU of the Redis cache to deploy.
:type sku: ~azure.mgmt.redis.models.Sku
:param tags: Resource tags.
Expand All @@ -38,15 +42,17 @@ class RedisUpdateParameters(Model):
'enable_non_ssl_port': {'key': 'properties.enableNonSslPort', 'type': 'bool'},
'tenant_settings': {'key': 'properties.tenantSettings', 'type': '{str}'},
'shard_count': {'key': 'properties.shardCount', 'type': 'int'},
'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'},
'sku': {'key': 'properties.sku', 'type': 'Sku'},
'tags': {'key': 'tags', 'type': '{str}'},
}

def __init__(self, redis_configuration=None, enable_non_ssl_port=None, tenant_settings=None, shard_count=None, sku=None, tags=None):
def __init__(self, redis_configuration=None, enable_non_ssl_port=None, tenant_settings=None, shard_count=None, minimum_tls_version=None, sku=None, tags=None):
super(RedisUpdateParameters, self).__init__()
self.redis_configuration = redis_configuration
self.enable_non_ssl_port = enable_non_ssl_port
self.tenant_settings = tenant_settings
self.shard_count = shard_count
self.minimum_tls_version = minimum_tls_version
self.sku = sku
self.tags = tags
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class FirewallRulesOperations(object):
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
:ivar api_version: Client Api Version. Constant value: "2017-10-01".
:ivar api_version: Client Api Version. Constant value: "2018-03-01".
"""

models = models
Expand All @@ -33,7 +33,7 @@ def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.api_version = "2017-10-01"
self.api_version = "2018-03-01"

self.config = config

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class LinkedServerOperations(object):
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
:ivar api_version: Client Api Version. Constant value: "2017-10-01".
:ivar api_version: Client Api Version. Constant value: "2018-03-01".
"""

models = models
Expand All @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.api_version = "2017-10-01"
self.api_version = "2018-03-01"

self.config = config

Expand Down
4 changes: 2 additions & 2 deletions azure-mgmt-redis/azure/mgmt/redis/operations/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Operations(object):
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
:ivar api_version: Client Api Version. Constant value: "2017-10-01".
:ivar api_version: Client Api Version. Constant value: "2018-03-01".
"""

models = models
Expand All @@ -33,7 +33,7 @@ def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.api_version = "2017-10-01"
self.api_version = "2018-03-01"

self.config = config

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class PatchSchedulesOperations(object):
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
:ivar api_version: Client Api Version. Constant value: "2018-03-01".
:ivar default: Default string modeled as parameter for auto generation to work correctly. Constant value: "default".
:ivar api_version: Client Api Version. Constant value: "2017-10-01".
"""

models = models
Expand All @@ -34,11 +34,83 @@ def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.api_version = "2018-03-01"
self.default = "default"
self.api_version = "2017-10-01"

self.config = config

def list_by_redis_resource(
self, resource_group_name, cache_name, custom_headers=None, raw=False, **operation_config):
"""Gets all patch schedules in the specified redis cache (there is only
one).

:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param cache_name: The name of the Redis cache.
:type cache_name: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: An iterator like instance of RedisPatchSchedule
:rtype:
~azure.mgmt.redis.models.RedisPatchSchedulePaged[~azure.mgmt.redis.models.RedisPatchSchedule]
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
def internal_paging(next_link=None, raw=False):

if not next_link:
# Construct URL
url = self.list_by_redis_resource.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'cacheName': self._serialize.url("cache_name", cache_name, 'str')
}
url = self._client.format_url(url, **path_format_arguments)

# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')

else:
url = next_link
query_parameters = {}

# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

# Construct and send request
request = self._client.get(url, query_parameters)
response = self._client.send(
request, header_parameters, stream=False, **operation_config)

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

return response

# Deserialize response
deserialized = models.RedisPatchSchedulePaged(internal_paging, self._deserialize.dependencies)

if raw:
header_dict = {}
client_raw_response = models.RedisPatchSchedulePaged(internal_paging, self._deserialize.dependencies, header_dict)
return client_raw_response

return deserialized
list_by_redis_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{cacheName}/patchSchedules'}

def create_or_update(
self, resource_group_name, name, schedule_entries, custom_headers=None, raw=False, **operation_config):
"""Create or replace the patching schedule for Redis cache (requires
Expand Down
Loading