Skip to content

Commit

Permalink
CodeGen from PR 19395 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
[Hub Generated] Review request for Microsoft.KeyVault to add version stable/2022-07-01 (Azure#19395)

* Adds base for updating Microsoft.KeyVault from version preview/2021-11-01-preview to version 2022-07-01

* Updates readme

* Updates API version in new specs and examples

* Merges changes from 2021-10-01 into 2022-07-01.

Changes that were merged include:
- Adding "object" type.
- Fixing description of enableRbacAuthorization (no longer a preview feature).

* Addresses the LRO_RESPONSE_HEADER guideline.

This commit ensures the following invariant in managedHsm.json:
```
If an operation can return a 202 Accepted response, then we insert
'"x-ms-long-running-operation": true,' directly below the operationId,
and we insert a Location header in the operation as well as the
corresponding example.
```

* Add check name availability api and security domain status property to managed hsm specificiation

Co-authored-by: Neeraja Akula <[email protected]>
  • Loading branch information
SDKAuto and neeerajaakula committed Jul 11, 2022
1 parent 705caa4 commit f158f68
Show file tree
Hide file tree
Showing 178 changed files with 11,217 additions and 7,401 deletions.
6 changes: 3 additions & 3 deletions sdk/keyvault/azure-mgmt-keyvault/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"autorest": "3.7.2",
"use": [
"@autorest/python@5.13.0",
"@autorest/python@5.16.0",
"@autorest/[email protected]"
],
"commit": "61001b68a8aa743f0dd890224c6b5cb130ef006e",
"commit": "2de5136a3664520fa0a6f9517997676590534403",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest_command": "autorest specification/keyvault/resource-manager/readme.md --multiapi --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/[email protected] --version=3.7.2",
"autorest_command": "autorest specification/keyvault/resource-manager/readme.md --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.16.0 --use=@autorest/[email protected] --version=3.7.2",
"readme": "specification/keyvault/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@
from ._version import VERSION

__version__ = VERSION

try:
from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
__all__ = ['KeyVaultManagementClient']
__all__.extend([p for p in _patch_all if p not in __all__])

# `._patch.py` is used for handwritten extensions to the generated code
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
from ._patch import patch_sdk
patch_sdk()
_patch_sdk()
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,12 @@ def __init__(
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.vaults = VaultsOperations(self._client, self._config, self._serialize, self._deserialize)
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.vaults = VaultsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.operations = Operations(
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 @@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

VERSION = "10.0.0"
VERSION = "1.0.0b1"
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@
# --------------------------------------------------------------------------

from ._key_vault_management_client import KeyVaultManagementClient

try:
from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
__all__ = ['KeyVaultManagementClient']
__all__.extend([p for p in _patch_all if p not in __all__])

# `._patch.py` is used for handwritten extensions to the generated code
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
from ._patch import patch_sdk
patch_sdk()
_patch_sdk()
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,12 @@ def __init__(
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.vaults = VaultsOperations(self._client, self._config, self._serialize, self._deserialize)
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.vaults = VaultsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.operations = Operations(
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 @@ -9,7 +9,12 @@
from ._vaults_operations import VaultsOperations
from ._operations import Operations

from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
from ._patch import patch_sdk as _patch_sdk
__all__ = [
'VaultsOperations',
'Operations',
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat

from ... import models as _models
Expand All @@ -23,32 +24,30 @@
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]

class Operations:
"""Operations 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.
"""
.. warning::
**DO NOT** instantiate this class directly.
:ivar models: Alias to model classes used in this operation group.
:type models: ~azure.mgmt.keyvault.v2016_10_01.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.
Instead, you should access the following operations through
:class:`~azure.mgmt.keyvault.v2016_10_01.aio.KeyVaultManagementClient`'s
:attr:`operations` attribute.
"""

models = _models

def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")


@distributed_trace
def list(
self,
**kwargs: Any
) -> AsyncIterable["_models.OperationListResult"]:
) -> AsyncIterable[_models.OperationListResult]:
"""Lists all of the available Key Vault Rest API operations.
:keyword callable cls: A custom type or function that will be passed the direct response
Expand All @@ -57,31 +56,38 @@ def list(
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.OperationListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
api_version = kwargs.pop('api_version', "2016-10-01") # type: str
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult]

cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:

request = build_list_request(
api_version=api_version,
template_url=self.list.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.url = self._client.format_url(request.url) # type: ignore

else:

request = build_list_request(
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
"""Customize generated code here.
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
"""
from typing import List

__all__: List[str] = [] # Add all objects you want publicly available to users at this package level

def patch_sdk():
"""Do not remove from this file.
`patch_sdk` is a last resort escape hatch that allows you to do customizations
you can't accomplish using the techniques described in
https://aka.ms/azsdk/python/dpcodegen/python/customize
"""
Loading

0 comments on commit f158f68

Please sign in to comment.