Skip to content

Commit cd04958

Browse files
author
SDKAuto
committed
CodeGen from PR 32116 in Azure/azure-rest-api-specs
Merge ef696eb28de1ed4b3d8a2f370b6fcc2252063fe8 into aa4ba9eb0ab21268118c11052b081ff5d2e01e4d
1 parent 8c480ce commit cd04958

File tree

61 files changed

+1666
-6070
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1666
-6070
lines changed

sdk/mixedreality/azure-mgmt-mixedreality/README.md

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,61 @@
11
# Microsoft Azure SDK for Python
22

33
This is the Microsoft Azure Mixed Reality Management Client Library.
4-
This package has been tested with Python 3.7+.
4+
This package has been tested with Python 3.8+.
55
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).
66

77
## _Disclaimer_
88

99
_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_
1010

11-
# Usage
11+
## Getting started
1212

13+
### Prerequisites
1314

14-
To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt)
15-
16-
For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/)
17-
Code samples for this package can be found at [Mixed Reality Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com.
18-
Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
15+
- Python 3.8+ is required to use this package.
16+
- [Azure subscription](https://azure.microsoft.com/free/)
1917

18+
### Install the package
2019

21-
# Provide Feedback
20+
```bash
21+
pip install azure-mgmt-mixedreality
22+
pip install azure-identity
23+
```
24+
25+
### Authentication
26+
27+
By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables.
28+
29+
- `AZURE_CLIENT_ID` for Azure client ID.
30+
- `AZURE_TENANT_ID` for Azure tenant ID.
31+
- `AZURE_CLIENT_SECRET` for Azure client secret.
32+
33+
In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`.
34+
35+
With above configuration, client can be authenticated by following code:
36+
37+
```python
38+
from azure.identity import DefaultAzureCredential
39+
from azure.mgmt.mixedreality import MixedRealityClient
40+
import os
41+
42+
sub_id = os.getenv("AZURE_SUBSCRIPTION_ID")
43+
client = MixedRealityClient(credential=DefaultAzureCredential(), subscription_id=sub_id)
44+
```
45+
46+
## Examples
47+
48+
Code samples for this package can be found at:
49+
- [Search Mixed Reality Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com
50+
- [Azure Python Mgmt SDK Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
51+
52+
53+
## Troubleshooting
54+
55+
## Next steps
56+
57+
## Provide Feedback
2258

2359
If you encounter any bugs or have suggestions, please file an issue in the
2460
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
2561
section of the project.
26-
27-
28-
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-mixedreality%2FREADME.png)
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"commit": "4522e1d3fb6dcb81bc63e3414d11dd7eaf08264b",
2+
"commit": "096f9017f31a50490537e427ec714e17dba1c4d0",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4-
"autorest": "3.9.2",
4+
"autorest": "3.10.2",
55
"use": [
6-
"@autorest/python@6.2.1",
7-
"@autorest/modelerfour@4.24.3"
6+
"@autorest/python@6.27.4",
7+
"@autorest/modelerfour@4.27.0"
88
],
9-
"autorest_command": "autorest specification/mixedreality/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.1 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
9+
"autorest_command": "autorest specification/mixedreality/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.27.4 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False",
1010
"readme": "specification/mixedreality/resource-manager/readme.md"
1111
}

sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/__init__.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,28 @@
55
# Code generated by Microsoft (R) AutoRest Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
8+
# pylint: disable=wrong-import-position
89

9-
from ._mixed_reality_client import MixedRealityClient
10+
from typing import TYPE_CHECKING
11+
12+
if TYPE_CHECKING:
13+
from ._patch import * # pylint: disable=unused-wildcard-import
14+
15+
from ._mixed_reality_client import MixedRealityClient # type: ignore
1016
from ._version import VERSION
1117

1218
__version__ = VERSION
1319

1420
try:
1521
from ._patch import __all__ as _patch_all
16-
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
22+
from ._patch import *
1723
except ImportError:
1824
_patch_all = []
1925
from ._patch import patch_sdk as _patch_sdk
2026

2127
__all__ = [
2228
"MixedRealityClient",
2329
]
24-
__all__.extend([p for p in _patch_all if p not in __all__])
30+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
2531

2632
_patch_sdk()

sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_configuration.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,18 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
import sys
109
from typing import Any, TYPE_CHECKING
1110

12-
from azure.core.configuration import Configuration
1311
from azure.core.pipeline import policies
1412
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
1513

1614
from ._version import VERSION
1715

18-
if sys.version_info >= (3, 8):
19-
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
20-
else:
21-
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
22-
2316
if TYPE_CHECKING:
24-
# pylint: disable=unused-import,ungrouped-imports
2517
from azure.core.credentials import TokenCredential
2618

2719

28-
class MixedRealityClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
20+
class MixedRealityClientConfiguration: # pylint: disable=too-many-instance-attributes
2921
"""Configuration for MixedRealityClient.
3022
3123
Note that all parameters used to create this instance are saved as instance
@@ -42,8 +34,7 @@ class MixedRealityClientConfiguration(Configuration): # pylint: disable=too-man
4234
"""
4335

4436
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
45-
super(MixedRealityClientConfiguration, self).__init__(**kwargs)
46-
api_version = kwargs.pop("api_version", "2021-03-01-preview") # type: Literal["2021-03-01-preview"]
37+
api_version: str = kwargs.pop("api_version", "2021-03-01-preview")
4738

4839
if credential is None:
4940
raise ValueError("Parameter 'credential' must not be None.")
@@ -55,20 +46,18 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
5546
self.api_version = api_version
5647
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
5748
kwargs.setdefault("sdk_moniker", "mgmt-mixedreality/{}".format(VERSION))
49+
self.polling_interval = kwargs.get("polling_interval", 30)
5850
self._configure(**kwargs)
5951

60-
def _configure(
61-
self, **kwargs # type: Any
62-
):
63-
# type: (...) -> None
52+
def _configure(self, **kwargs: Any) -> None:
6453
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
6554
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
6655
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
6756
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
6857
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
69-
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
7058
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
7159
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
60+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
7261
self.authentication_policy = kwargs.get("authentication_policy")
7362
if self.credential and not self.authentication_policy:
7463
self.authentication_policy = ARMChallengeAuthenticationPolicy(

sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_mixed_reality_client.py

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,40 +8,30 @@
88

99
from copy import deepcopy
1010
from typing import Any, TYPE_CHECKING
11+
from typing_extensions import Self
1112

13+
from azure.core.pipeline import policies
1214
from azure.core.rest import HttpRequest, HttpResponse
1315
from azure.mgmt.core import ARMPipelineClient
16+
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
1417

15-
from . import models
18+
from . import models as _models
1619
from ._configuration import MixedRealityClientConfiguration
1720
from ._serialization import Deserializer, Serializer
18-
from .operations import (
19-
MixedRealityClientOperationsMixin,
20-
ObjectAnchorsAccountsOperations,
21-
Operations,
22-
RemoteRenderingAccountsOperations,
23-
SpatialAnchorsAccountsOperations,
24-
)
21+
from .operations import MixedRealityClientOperationsMixin, Operations, RemoteRenderingAccountsOperations
2522

2623
if TYPE_CHECKING:
27-
# pylint: disable=unused-import,ungrouped-imports
2824
from azure.core.credentials import TokenCredential
2925

3026

31-
class MixedRealityClient(MixedRealityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword
27+
class MixedRealityClient(MixedRealityClientOperationsMixin):
3228
"""Mixed Reality Client.
3329
3430
:ivar operations: Operations operations
3531
:vartype operations: azure.mgmt.mixedreality.operations.Operations
36-
:ivar spatial_anchors_accounts: SpatialAnchorsAccountsOperations operations
37-
:vartype spatial_anchors_accounts:
38-
azure.mgmt.mixedreality.operations.SpatialAnchorsAccountsOperations
3932
:ivar remote_rendering_accounts: RemoteRenderingAccountsOperations operations
4033
:vartype remote_rendering_accounts:
4134
azure.mgmt.mixedreality.operations.RemoteRenderingAccountsOperations
42-
:ivar object_anchors_accounts: ObjectAnchorsAccountsOperations operations
43-
:vartype object_anchors_accounts:
44-
azure.mgmt.mixedreality.operations.ObjectAnchorsAccountsOperations
4535
:param credential: Credential needed for the client to connect to Azure. Required.
4636
:type credential: ~azure.core.credentials.TokenCredential
4737
:param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g.
@@ -62,24 +52,36 @@ def __init__(
6252
**kwargs: Any
6353
) -> None:
6454
self._config = MixedRealityClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
65-
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
66-
67-
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
55+
_policies = kwargs.pop("policies", None)
56+
if _policies is None:
57+
_policies = [
58+
policies.RequestIdPolicy(**kwargs),
59+
self._config.headers_policy,
60+
self._config.user_agent_policy,
61+
self._config.proxy_policy,
62+
policies.ContentDecodePolicy(**kwargs),
63+
ARMAutoResourceProviderRegistrationPolicy(),
64+
self._config.redirect_policy,
65+
self._config.retry_policy,
66+
self._config.authentication_policy,
67+
self._config.custom_hook_policy,
68+
self._config.logging_policy,
69+
policies.DistributedTracingPolicy(**kwargs),
70+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
71+
self._config.http_logging_policy,
72+
]
73+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
74+
75+
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
6876
self._serialize = Serializer(client_models)
6977
self._deserialize = Deserializer(client_models)
7078
self._serialize.client_side_validation = False
7179
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
72-
self.spatial_anchors_accounts = SpatialAnchorsAccountsOperations(
73-
self._client, self._config, self._serialize, self._deserialize
74-
)
7580
self.remote_rendering_accounts = RemoteRenderingAccountsOperations(
7681
self._client, self._config, self._serialize, self._deserialize
7782
)
78-
self.object_anchors_accounts = ObjectAnchorsAccountsOperations(
79-
self._client, self._config, self._serialize, self._deserialize
80-
)
8183

82-
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
84+
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
8385
"""Runs the network request through the client's chained policies.
8486
8587
>>> from azure.core.rest import HttpRequest
@@ -99,17 +101,14 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
99101

100102
request_copy = deepcopy(request)
101103
request_copy.url = self._client.format_url(request_copy.url)
102-
return self._client.send_request(request_copy, **kwargs)
104+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
103105

104-
def close(self):
105-
# type: () -> None
106+
def close(self) -> None:
106107
self._client.close()
107108

108-
def __enter__(self):
109-
# type: () -> MixedRealityClient
109+
def __enter__(self) -> Self:
110110
self._client.__enter__()
111111
return self
112112

113-
def __exit__(self, *exc_details):
114-
# type: (Any) -> None
113+
def __exit__(self, *exc_details: Any) -> None:
115114
self._client.__exit__(*exc_details)

0 commit comments

Comments
 (0)