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 track2_azure-mgmt-redis] Set cache patching default time as 5 hours #9827

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
4 changes: 2 additions & 2 deletions sdk/redis/azure-mgmt-redis/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"@autorest/python@5.12.0",
"@autorest/modelerfour@4.19.3"
],
"commit": "b28cdff098a89aab796e38c78b6b71a897fbae47",
"commit": "496ceca04f9cf59fe040bf4c3aac3b2228060300",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest_command": "autorest specification/redis/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2",
"autorest_command": "autorest specification/redis/resource-manager/readme.md --multiapi --python --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2",
"readme": "specification/redis/resource-manager/readme.md"
}
13 changes: 5 additions & 8 deletions sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import TYPE_CHECKING
from typing import Any, TYPE_CHECKING

from azure.core.configuration import Configuration
from azure.core.pipeline import policies
Expand All @@ -16,8 +16,6 @@

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any

from azure.core.credentials import TokenCredential


Expand All @@ -35,11 +33,10 @@ class RedisManagementClientConfiguration(Configuration):

def __init__(
self,
credential, # type: "TokenCredential"
subscription_id, # type: str
**kwargs # type: Any
):
# type: (...) -> None
credential: "TokenCredential",
subscription_id: str,
**kwargs: Any
) -> None:
super(RedisManagementClientConfiguration, self).__init__(**kwargs)
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
Expand Down
3 changes: 2 additions & 1 deletion sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
"patch_schedules": "PatchSchedulesOperations",
"linked_server": "LinkedServerOperations",
"private_endpoint_connections": "PrivateEndpointConnectionsOperations",
"private_link_resources": "PrivateLinkResourcesOperations"
"private_link_resources": "PrivateLinkResourcesOperations",
"async_operation_status": "AsyncOperationStatusOperations"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,21 @@
# --------------------------------------------------------------------------

from copy import deepcopy
from typing import TYPE_CHECKING
from typing import Any, Optional, TYPE_CHECKING

from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient
from msrest import Deserializer, Serializer

from . import models
from ._configuration import RedisManagementClientConfiguration
from .operations import FirewallRulesOperations, LinkedServerOperations, Operations, PatchSchedulesOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, RedisOperations
from .operations import AsyncOperationStatusOperations, FirewallRulesOperations, LinkedServerOperations, Operations, PatchSchedulesOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, RedisOperations

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any, Optional

from azure.core.credentials import TokenCredential
from azure.core.rest import HttpRequest, HttpResponse

class RedisManagementClient(object):
class RedisManagementClient:
"""REST API for Azure Redis Cache Service.

:ivar operations: Operations operations
Expand All @@ -41,6 +39,8 @@ class RedisManagementClient(object):
azure.mgmt.redis.operations.PrivateEndpointConnectionsOperations
:ivar private_link_resources: PrivateLinkResourcesOperations operations
:vartype private_link_resources: azure.mgmt.redis.operations.PrivateLinkResourcesOperations
:ivar async_operation_status: AsyncOperationStatusOperations operations
:vartype async_operation_status: azure.mgmt.redis.operations.AsyncOperationStatusOperations
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: Gets subscription credentials which uniquely identify the Microsoft
Expand All @@ -54,12 +54,11 @@ class RedisManagementClient(object):

def __init__(
self,
credential, # type: "TokenCredential"
subscription_id, # type: str
base_url="https://management.azure.com", # type: str
**kwargs # type: Any
):
# type: (...) -> None
credential: "TokenCredential",
subscription_id: str,
base_url: str = "https://management.azure.com",
**kwargs: Any
) -> None:
self._config = RedisManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)

Expand All @@ -74,14 +73,14 @@ def __init__(
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)
self.async_operation_status = AsyncOperationStatusOperations(self._client, self._config, self._serialize, self._deserialize)


def _send_request(
self,
request, # type: HttpRequest
**kwargs # type: Any
):
# type: (...) -> HttpResponse
**kwargs: Any
) -> HttpResponse:
"""Runs the network request through the client's chained policies.

>>> from azure.core.rest import HttpRequest
Expand Down
2 changes: 1 addition & 1 deletion sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

VERSION = "13.1.0"
VERSION = "12.0.0b1"
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from .. import models
from ._configuration import RedisManagementClientConfiguration
from .operations import FirewallRulesOperations, LinkedServerOperations, Operations, PatchSchedulesOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, RedisOperations
from .operations import AsyncOperationStatusOperations, FirewallRulesOperations, LinkedServerOperations, Operations, PatchSchedulesOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, RedisOperations

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
Expand All @@ -39,6 +39,8 @@ class RedisManagementClient:
azure.mgmt.redis.aio.operations.PrivateEndpointConnectionsOperations
:ivar private_link_resources: PrivateLinkResourcesOperations operations
:vartype private_link_resources: azure.mgmt.redis.aio.operations.PrivateLinkResourcesOperations
:ivar async_operation_status: AsyncOperationStatusOperations operations
:vartype async_operation_status: azure.mgmt.redis.aio.operations.AsyncOperationStatusOperations
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: Gets subscription credentials which uniquely identify the Microsoft
Expand Down Expand Up @@ -71,6 +73,7 @@ def __init__(
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)
self.async_operation_status = AsyncOperationStatusOperations(self._client, self._config, self._serialize, self._deserialize)


def _send_request(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from ._linked_server_operations import LinkedServerOperations
from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations
from ._private_link_resources_operations import PrivateLinkResourcesOperations
from ._async_operation_status_operations import AsyncOperationStatusOperations

__all__ = [
'Operations',
Expand All @@ -22,4 +23,5 @@
'LinkedServerOperations',
'PrivateEndpointConnectionsOperations',
'PrivateLinkResourcesOperations',
'AsyncOperationStatusOperations',
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# 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.
# --------------------------------------------------------------------------
import functools
from typing import Any, Callable, Dict, Generic, Optional, TypeVar
import warnings

from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.mgmt.core.exceptions import ARMErrorFormat

from ... import models as _models
from ..._vendor import _convert_request
from ...operations._async_operation_status_operations import build_get_request
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]

class AsyncOperationStatusOperations:
"""AsyncOperationStatusOperations async operations.

You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.

:ivar models: Alias to model classes used in this operation group.
:type models: ~azure.mgmt.redis.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
"""

models = _models

def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config

@distributed_trace_async
async def get(
self,
location: str,
operation_id: str,
**kwargs: Any
) -> "_models.OperationStatus":
"""For checking the ongoing status of an operation.

:param location: The location at which operation was triggered.
:type location: str
:param operation_id: The ID of asynchronous operation.
:type operation_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: OperationStatus, or the result of cls(response)
:rtype: ~azure.mgmt.redis.models.OperationStatus
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))


request = build_get_request(
location=location,
operation_id=operation_id,
subscription_id=self._config.subscription_id,
template_url=self.get.metadata['url'],
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)

pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

deserialized = self._deserialize('OperationStatus', pipeline_response)

if cls:
return cls(pipeline_response, deserialized, {})

return deserialized

get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Cache/locations/{location}/asyncOperations/{operationId}'} # type: ignore

Loading