-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
generate mixedreality track2 sdk (#15779)
- Loading branch information
Showing
54 changed files
with
4,412 additions
and
2,077 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,78 @@ | ||
# Release History | ||
|
||
## 1.0.0b1 (2020-12-14) | ||
|
||
This is beta preview version. | ||
|
||
This version uses a next-generation code generator that introduces important breaking changes, but also important new features (like unified authentication and async programming). | ||
|
||
**General breaking changes** | ||
|
||
- Credential system has been completly revamped: | ||
|
||
- `azure.common.credentials` or `msrestazure.azure_active_directory` instances are no longer supported, use the `azure-identity` classes instead: https://pypi.org/project/azure-identity/ | ||
- `credentials` parameter has been renamed `credential` | ||
|
||
- The `config` attribute no longer exists on a client, configuration should be passed as kwarg. Example: `MyClient(credential, subscription_id, enable_logging=True)`. For a complete set of | ||
supported options, see the [parameters accept in init documentation of azure-core](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies) | ||
- You can't import a `version` module anymore, use `__version__` instead | ||
- Operations that used to return a `msrest.polling.LROPoller` now returns a `azure.core.polling.LROPoller` and are prefixed with `begin_`. | ||
- Exceptions tree have been simplified and most exceptions are now `azure.core.exceptions.HttpResponseError` (`CloudError` has been removed). | ||
- Most of the operation kwarg have changed. Some of the most noticeable: | ||
|
||
- `raw` has been removed. Equivalent feature can be found using `cls`, a callback that will give access to internal HTTP response for advanced user | ||
- For a complete set of | ||
supported options, see the [parameters accept in Request documentation of azure-core](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies) | ||
|
||
**General new features** | ||
|
||
- Type annotations support using `typing`. SDKs are mypy ready. | ||
- This client has now stable and official support for async. Check the `aio` namespace of your package to find the async client. | ||
- This client now support natively tracing library like OpenCensus or OpenTelemetry. See this [tracing quickstart](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/core/azure-core-tracing-opentelemetry) for an overview. | ||
|
||
## 0.2.0 (2020-05-25) | ||
|
||
**Features** | ||
|
||
- Added operation SpatialAnchorsAccountsOperations.list_keys | ||
- Added operation SpatialAnchorsAccountsOperations.get | ||
- Added operation SpatialAnchorsAccountsOperations.regenerate_keys | ||
- Added operation SpatialAnchorsAccountsOperations.delete | ||
- Added operation group MixedRealityClientOperationsMixin | ||
- Added operation group RemoteRenderingAccountsOperations | ||
|
||
**Breaking changes** | ||
|
||
- Operation SpatialAnchorsAccountsOperations.create has a new signature | ||
- Operation SpatialAnchorsAccountsOperations.update has a new signature | ||
- Removed operation SpatialAnchorsAccountsOperations.get_keys | ||
|
||
**General Breaking Changes** | ||
|
||
This version uses a next-generation code generator that *might* | ||
introduce breaking changes. In summary, some modules were incorrectly | ||
visible/importable and have been renamed. This fixed several issues | ||
caused by usage of classes that were not supposed to be used in the | ||
first place. | ||
|
||
- MixedRealityClient cannot be imported from | ||
`azure.mgmt.mixedreality.mixed_reality_client` anymore (import from | ||
`azure.mgmt.mixedreality` works like before) | ||
- MixedRealityClientConfiguration import has been moved from | ||
`azure.mgmt.mixedreality.mixedreality_client` | ||
to `azure.mgmt.mixedreality` | ||
- A model `MyClass` from a "models" sub-module cannot be imported | ||
anymore using `azure.mgmt.mixedreality.models.my_class` (import from | ||
`azure.mgmt.mixedreality.models` works like before) | ||
- An operation class `MyClassOperations` from an `operations` | ||
sub-module cannot be imported anymore using | ||
`azure.mgmt.mixedreality.operations.my_class_operations` (import from | ||
`azure.mgmt.mixedreality.operations` works like before) | ||
|
||
Last but not least, HTTP connection pooling is now enabled by default. | ||
You should always use a client as a context manager, or call close(), or | ||
use no more than one client per process. | ||
|
||
## 0.1.0 (2019-02-05) | ||
|
||
- Initial Release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 10 additions & 9 deletions
19
sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
# 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. | ||
# | ||
# 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. | ||
# Changes may cause incorrect behavior and will be lost if the code is regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
from .mixed_reality_client import MixedRealityClient | ||
from .version import VERSION | ||
|
||
__all__ = ['MixedRealityClient'] | ||
from ._mixed_reality_client import MixedRealityClient | ||
from ._version import VERSION | ||
|
||
__version__ = VERSION | ||
__all__ = ['MixedRealityClient'] | ||
|
||
try: | ||
from ._patch import patch_sdk # type: ignore | ||
patch_sdk() | ||
except ImportError: | ||
pass |
70 changes: 70 additions & 0 deletions
70
sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_configuration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# 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 typing import TYPE_CHECKING | ||
|
||
from azure.core.configuration import Configuration | ||
from azure.core.pipeline import policies | ||
from azure.mgmt.core.policies import ARMHttpLoggingPolicy | ||
|
||
from ._version import VERSION | ||
|
||
if TYPE_CHECKING: | ||
# pylint: disable=unused-import,ungrouped-imports | ||
from typing import Any | ||
|
||
from azure.core.credentials import TokenCredential | ||
|
||
|
||
class MixedRealityClientConfiguration(Configuration): | ||
"""Configuration for MixedRealityClient. | ||
Note that all parameters used to create this instance are saved as instance | ||
attributes. | ||
:param credential: Credential needed for the client to connect to Azure. | ||
:type credential: ~azure.core.credentials.TokenCredential | ||
:param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). | ||
:type subscription_id: str | ||
""" | ||
|
||
def __init__( | ||
self, | ||
credential, # type: "TokenCredential" | ||
subscription_id, # type: str | ||
**kwargs # type: Any | ||
): | ||
# type: (...) -> None | ||
if credential is None: | ||
raise ValueError("Parameter 'credential' must not be None.") | ||
if subscription_id is None: | ||
raise ValueError("Parameter 'subscription_id' must not be None.") | ||
super(MixedRealityClientConfiguration, self).__init__(**kwargs) | ||
|
||
self.credential = credential | ||
self.subscription_id = subscription_id | ||
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) | ||
kwargs.setdefault('sdk_moniker', 'mgmt-mixedreality/{}'.format(VERSION)) | ||
self._configure(**kwargs) | ||
|
||
def _configure( | ||
self, | ||
**kwargs # type: Any | ||
): | ||
# type: (...) -> None | ||
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) | ||
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) | ||
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) | ||
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) | ||
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) | ||
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) | ||
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) | ||
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) | ||
self.authentication_policy = kwargs.get('authentication_policy') | ||
if self.credential and not self.authentication_policy: | ||
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) |
80 changes: 80 additions & 0 deletions
80
sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_mixed_reality_client.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# 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 typing import TYPE_CHECKING | ||
|
||
from azure.mgmt.core import ARMPipelineClient | ||
from msrest import Deserializer, Serializer | ||
|
||
if TYPE_CHECKING: | ||
# pylint: disable=unused-import,ungrouped-imports | ||
from typing import Any, Optional | ||
|
||
from azure.core.credentials import TokenCredential | ||
|
||
from ._configuration import MixedRealityClientConfiguration | ||
from .operations import Operations | ||
from .operations import MixedRealityClientOperationsMixin | ||
from .operations import SpatialAnchorsAccountsOperations | ||
from .operations import RemoteRenderingAccountsOperations | ||
from . import models | ||
|
||
|
||
class MixedRealityClient(MixedRealityClientOperationsMixin): | ||
"""Mixed Reality Client. | ||
:ivar operations: Operations operations | ||
:vartype operations: azure.mgmt.mixedreality.operations.Operations | ||
:ivar spatial_anchors_accounts: SpatialAnchorsAccountsOperations operations | ||
:vartype spatial_anchors_accounts: azure.mgmt.mixedreality.operations.SpatialAnchorsAccountsOperations | ||
:ivar remote_rendering_accounts: RemoteRenderingAccountsOperations operations | ||
:vartype remote_rendering_accounts: azure.mgmt.mixedreality.operations.RemoteRenderingAccountsOperations | ||
:param credential: Credential needed for the client to connect to Azure. | ||
:type credential: ~azure.core.credentials.TokenCredential | ||
:param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). | ||
:type subscription_id: str | ||
:param str base_url: Service URL | ||
""" | ||
|
||
def __init__( | ||
self, | ||
credential, # type: "TokenCredential" | ||
subscription_id, # type: str | ||
base_url=None, # type: Optional[str] | ||
**kwargs # type: Any | ||
): | ||
# type: (...) -> None | ||
if not base_url: | ||
base_url = 'https://management.azure.com' | ||
self._config = MixedRealityClientConfiguration(credential, subscription_id, **kwargs) | ||
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) | ||
|
||
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} | ||
self._serialize = Serializer(client_models) | ||
self._serialize.client_side_validation = False | ||
self._deserialize = Deserializer(client_models) | ||
|
||
self.operations = Operations( | ||
self._client, self._config, self._serialize, self._deserialize) | ||
self.spatial_anchors_accounts = SpatialAnchorsAccountsOperations( | ||
self._client, self._config, self._serialize, self._deserialize) | ||
self.remote_rendering_accounts = RemoteRenderingAccountsOperations( | ||
self._client, self._config, self._serialize, self._deserialize) | ||
|
||
def close(self): | ||
# type: () -> None | ||
self._client.close() | ||
|
||
def __enter__(self): | ||
# type: () -> MixedRealityClient | ||
self._client.__enter__() | ||
return self | ||
|
||
def __exit__(self, *exc_details): | ||
# type: (Any) -> None | ||
self._client.__exit__(*exc_details) |
9 changes: 3 additions & 6 deletions
9
...eality/azure/mgmt/mixedreality/version.py → ...ality/azure/mgmt/mixedreality/_version.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,10 @@ | ||
# 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. | ||
# | ||
# 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. | ||
# Changes may cause incorrect behavior and will be lost if the code is regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
VERSION = "0.1.0" | ||
VERSION = "1.0.0b1" | ||
|
22 changes: 4 additions & 18 deletions
22
...lity/models/mixed_reality_client_enums.py → ...y/azure/mgmt/mixedreality/aio/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,10 @@ | ||
# 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. | ||
# | ||
# 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. | ||
# Changes may cause incorrect behavior and will be lost if the code is regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
from enum import Enum | ||
|
||
|
||
class NameAvailability(str, Enum): | ||
|
||
true = "true" | ||
false = "false" | ||
|
||
|
||
class NameUnavailableReason(str, Enum): | ||
|
||
invalid = "Invalid" | ||
already_exists = "AlreadyExists" | ||
from ._mixed_reality_client import MixedRealityClient | ||
__all__ = ['MixedRealityClient'] |
66 changes: 66 additions & 0 deletions
66
sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/_configuration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# 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 typing import Any, TYPE_CHECKING | ||
|
||
from azure.core.configuration import Configuration | ||
from azure.core.pipeline import policies | ||
from azure.mgmt.core.policies import ARMHttpLoggingPolicy | ||
|
||
from .._version import VERSION | ||
|
||
if TYPE_CHECKING: | ||
# pylint: disable=unused-import,ungrouped-imports | ||
from azure.core.credentials_async import AsyncTokenCredential | ||
|
||
|
||
class MixedRealityClientConfiguration(Configuration): | ||
"""Configuration for MixedRealityClient. | ||
Note that all parameters used to create this instance are saved as instance | ||
attributes. | ||
:param credential: Credential needed for the client to connect to Azure. | ||
:type credential: ~azure.core.credentials_async.AsyncTokenCredential | ||
:param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). | ||
:type subscription_id: str | ||
""" | ||
|
||
def __init__( | ||
self, | ||
credential: "AsyncTokenCredential", | ||
subscription_id: str, | ||
**kwargs: Any | ||
) -> None: | ||
if credential is None: | ||
raise ValueError("Parameter 'credential' must not be None.") | ||
if subscription_id is None: | ||
raise ValueError("Parameter 'subscription_id' must not be None.") | ||
super(MixedRealityClientConfiguration, self).__init__(**kwargs) | ||
|
||
self.credential = credential | ||
self.subscription_id = subscription_id | ||
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) | ||
kwargs.setdefault('sdk_moniker', 'mgmt-mixedreality/{}'.format(VERSION)) | ||
self._configure(**kwargs) | ||
|
||
def _configure( | ||
self, | ||
**kwargs: Any | ||
) -> None: | ||
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) | ||
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) | ||
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) | ||
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) | ||
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) | ||
self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) | ||
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) | ||
self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) | ||
self.authentication_policy = kwargs.get('authentication_policy') | ||
if self.credential and not self.authentication_policy: | ||
self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) |
Oops, something went wrong.