Skip to content

Commit

Permalink
CodeGen from PR 14023 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
PR for new api-version: Microsoft.Cache/redis/stable/2020-12-01 [rebased + refactored] (Azure#14023)

* Adds base for updating Microsoft.Cache from version stable/2020-06-01 to version 2020-12-01

* Updates readme

* Updates API version in new specs and examples

* Adding Redis Version to PUT request (Azure#12675)

* Adding Redis Version to PUT request

* Include RedisVersion in PUT and PATCH, and update description to clarify major version

* Adding new properties isPrimary and replicasPerPrimary (Azure#13005)

* Adding new properties isPrimary and replicasPerPrimary

* Addressing PR feedback

Co-authored-by: Lavanya Singampalli <lasingam@microsoft.com>

* Refactor the latest redis.json API spec proposal to use the definitions ProxyResource, TrackedResource and OperationListResult from common-types/resource-management/v2. (I hope CI likes this!)

* Cleanup  now-unreferenced #definitions which were still flagged as duplicate definitions.

* Fix linter errors for camelCasing of API names and formatting of integer types.

* Fix more linter errors by adding pagable, refactoring LinkedServers and FirewallRules. These will be between-versions breaking changes for the SDK, in the name of more API consistency.

* Fix linter error 'PUT' operation 'PrivateEndpointConnections_Put' should use method name 'Create'. Note: If you have already shipped an SDK on top of this spec, fixing this warning may introduce a breaking change.

* Fix some duplicate example names.

* Revert "Fix linter error 'PUT' operation 'PrivateEndpointConnections_Put' should use method name 'Create'. Note: If you have already shipped an SDK on top of this spec, fixing this warning may introduce a breaking change." -- because it introduces new linter errors.

* Revert "Fix more linter errors by adding pagable, refactoring LinkedServers and FirewallRules. These will be between-versions breaking changes for the SDK, in the name of more API consistency."

This reverts commit c0e305128834947066bb59de2c4247b29feef5ee.

* Fix the example name for CheckNameAvailability.

* Add x-ms-pageable suggested by the linter.

* Revert the linter fix for CheckNameAvailabiltiy camelCasing to avoid introducing new linter errors.

* Use same FirewallRule response schema for PUT and GET, addressing linter errors, and have RedisFirewallRuleCreateParameters inherit it in hopes that helps with SDK backcompat.

* Fix indenting.

* Fix broken $ref reference syntax.

* Add back the description for RedisFirewallRuleCreateParameters.

* Actually run prettier.

* With print width 20

* Suppress the warnings that booleans are not descriptive, since to change them would be a breaking change.

* Delete unintended extra character

* Revert enum type-hinting and refactors to common-types that are getting flagged as breaking changes.

* Add back the refactorings to use Resource/ProxyResource/TrackedResource from common-types. Since otherwise we get "Duplicate Schema named Resource -- properties.id.description: undefined => "Fully qualified resource ID for the resource. Ex - /subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/resourceProviderNamespace/resourceType/resourceName",

properties.name.description: undefined => "The name of the resource","

Co-authored-by: MECHANDR <30642185+MECHANDR@users.noreply.github.com>
Co-authored-by: lasingam <68033674+lasingam@users.noreply.github.com>
Co-authored-by: Lavanya Singampalli <lasingam@microsoft.com>
  • Loading branch information
4 people committed May 11, 2021
1 parent 8dd26ca commit a120603
Show file tree
Hide file tree
Showing 16 changed files with 1,706 additions and 345 deletions.
1 change: 1 addition & 0 deletions sdk/redis/azure-mgmt-redis/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include _meta.json
recursive-include tests *.py *.yaml
include *.md
include azure/__init__.py
Expand Down
8 changes: 8 additions & 0 deletions sdk/redis/azure-mgmt-redis/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"autorest": "V2",
"use": "@microsoft.azure/autorest.python@~4.0.71",
"commit": "fc32868d898ec14420bcdad85116c0c1f875c490",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest_command": "autorest specification/redis/resource-manager/readme.md --keep-version-file --multiapi --no-async --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --use=@microsoft.azure/autorest.python@~4.0.71 --version=V2",
"readme": "specification/redis/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
from .operations import FirewallRulesOperations
from .operations import PatchSchedulesOperations
from .operations import LinkedServerOperations
from .operations import PrivateEndpointConnectionsOperations
from .operations import PrivateLinkResourcesOperations
from . import models


Expand All @@ -37,6 +39,10 @@ class RedisManagementClient(SDKClient):
:vartype patch_schedules: azure.mgmt.redis.operations.PatchSchedulesOperations
:ivar linked_server: LinkedServer operations
:vartype linked_server: azure.mgmt.redis.operations.LinkedServerOperations
:ivar private_endpoint_connections: PrivateEndpointConnections operations
:vartype private_endpoint_connections: azure.mgmt.redis.operations.PrivateEndpointConnectionsOperations
:ivar private_link_resources: PrivateLinkResources operations
:vartype private_link_resources: azure.mgmt.redis.operations.PrivateLinkResourcesOperations
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
Expand All @@ -55,7 +61,7 @@ def __init__(
super(RedisManagementClient, self).__init__(self.config.credentials, self.config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '2019-07-01'
self.api_version = '2020-12-01'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

Expand All @@ -69,3 +75,7 @@ def __init__(
self._client, self.config, self._serialize, self._deserialize)
self.linked_server = LinkedServerOperations(
self._client, self.config, self._serialize, self._deserialize)
self.private_endpoint_connections = PrivateEndpointConnectionsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.private_link_resources = PrivateLinkResourcesOperations(
self._client, self.config, self._serialize, self._deserialize)
39 changes: 36 additions & 3 deletions sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,19 @@
# --------------------------------------------------------------------------

try:
from ._models_py3 import AzureEntityResource
from ._models_py3 import CheckNameAvailabilityParameters
from ._models_py3 import ErrorAdditionalInfo
from ._models_py3 import ErrorDetail
from ._models_py3 import ErrorResponse, ErrorResponseException
from ._models_py3 import ExportRDBParameters
from ._models_py3 import ImportRDBParameters
from ._models_py3 import NotificationListResponse
from ._models_py3 import Operation
from ._models_py3 import OperationDisplay
from ._models_py3 import PrivateEndpoint
from ._models_py3 import PrivateEndpointConnection
from ._models_py3 import PrivateLinkResource
from ._models_py3 import PrivateLinkServiceConnectionState
from ._models_py3 import ProxyResource
from ._models_py3 import RedisAccessKeys
from ._models_py3 import RedisCreateParameters
Expand All @@ -37,12 +44,19 @@
from ._models_py3 import TrackedResource
from ._models_py3 import UpgradeNotification
except (SyntaxError, ImportError):
from ._models import AzureEntityResource
from ._models import CheckNameAvailabilityParameters
from ._models import ErrorAdditionalInfo
from ._models import ErrorDetail
from ._models import ErrorResponse, ErrorResponseException
from ._models import ExportRDBParameters
from ._models import ImportRDBParameters
from ._models import NotificationListResponse
from ._models import Operation
from ._models import OperationDisplay
from ._models import PrivateEndpoint
from ._models import PrivateEndpointConnection
from ._models import PrivateLinkResource
from ._models import PrivateLinkServiceConnectionState
from ._models import ProxyResource
from ._models import RedisAccessKeys
from ._models import RedisCreateParameters
Expand All @@ -64,28 +78,41 @@
from ._models import TrackedResource
from ._models import UpgradeNotification
from ._paged_models import OperationPaged
from ._paged_models import PrivateEndpointConnectionPaged
from ._paged_models import PrivateLinkResourcePaged
from ._paged_models import RedisFirewallRulePaged
from ._paged_models import RedisLinkedServerWithPropertiesPaged
from ._paged_models import RedisPatchSchedulePaged
from ._paged_models import RedisResourcePaged
from ._paged_models import UpgradeNotificationPaged
from ._redis_management_client_enums import (
SkuName,
SkuFamily,
TlsVersion,
PublicNetworkAccess,
ProvisioningState,
PrivateEndpointServiceConnectionStatus,
PrivateEndpointConnectionProvisioningState,
RedisKeyType,
RebootType,
DayOfWeek,
ReplicationRole,
)

__all__ = [
'AzureEntityResource',
'CheckNameAvailabilityParameters',
'ErrorAdditionalInfo',
'ErrorDetail',
'ErrorResponse', 'ErrorResponseException',
'ExportRDBParameters',
'ImportRDBParameters',
'NotificationListResponse',
'Operation',
'OperationDisplay',
'PrivateEndpoint',
'PrivateEndpointConnection',
'PrivateLinkResource',
'PrivateLinkServiceConnectionState',
'ProxyResource',
'RedisAccessKeys',
'RedisCreateParameters',
Expand All @@ -107,14 +134,20 @@
'TrackedResource',
'UpgradeNotification',
'OperationPaged',
'UpgradeNotificationPaged',
'RedisResourcePaged',
'RedisFirewallRulePaged',
'RedisPatchSchedulePaged',
'RedisLinkedServerWithPropertiesPaged',
'PrivateEndpointConnectionPaged',
'PrivateLinkResourcePaged',
'SkuName',
'SkuFamily',
'TlsVersion',
'PublicNetworkAccess',
'ProvisioningState',
'PrivateEndpointServiceConnectionStatus',
'PrivateEndpointConnectionProvisioningState',
'RedisKeyType',
'RebootType',
'DayOfWeek',
Expand Down
Loading

0 comments on commit a120603

Please sign in to comment.