diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index a44c7593cae6..f687c3b23240 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -307,11 +307,6 @@ # PRLabel: %Maps /sdk/maps/ @dubiety @andykao1213 -# ServiceLabel: %Mixed Reality -# PRLabel: %Mixed Reality -/sdk/mixedreality/azure-mixedreality-authentication/ @RamonArguelles -/sdk/remoterendering/ @FlorianBorn71 - # ServiceLabel: %Online Experimentation # PRLabel: %Online Experimentation /sdk/onlineexperimentation/ @Azure/azure-sdk-write-onlineexperimentation diff --git a/big_argfile.json b/big_argfile.json index 73f2f50e3413..1f763a9d28ce 100644 --- a/big_argfile.json +++ b/big_argfile.json @@ -888,10 +888,6 @@ "package": "azure-mgmt-media", "version": "10.2.0" }, - { - "package": "azure-mgmt-mixedreality", - "version": "1.0.0" - }, { "package": "azure-mgmt-mobilenetwork", "version": "3.3.0" diff --git a/conda/conda-recipes/azure-mgmt/meta.yaml b/conda/conda-recipes/azure-mgmt/meta.yaml index 6b6a9d67e940..2586502ee986 100644 --- a/conda/conda-recipes/azure-mgmt/meta.yaml +++ b/conda/conda-recipes/azure-mgmt/meta.yaml @@ -595,11 +595,6 @@ test: - azure.mgmt.media.aio.operations - azure.mgmt.media.models - azure.mgmt.media.operations - - azure.mgmt.mixedreality - - azure.mgmt.mixedreality.aio - - azure.mgmt.mixedreality.aio.operations - - azure.mgmt.mixedreality.models - - azure.mgmt.mixedreality.operations - azure.mgmt.mobilenetwork - azure.mgmt.mobilenetwork.aio - azure.mgmt.mobilenetwork.aio.operations diff --git a/conda/conda-releaselogs/azure-mgmt.md b/conda/conda-releaselogs/azure-mgmt.md index 0da51cb68d27..9cd0ccb3d841 100644 --- a/conda/conda-releaselogs/azure-mgmt.md +++ b/conda/conda-releaselogs/azure-mgmt.md @@ -113,7 +113,6 @@ - azure-mgmt-maps-2.1.0 - azure-mgmt-marketplaceordering-1.1.0 - azure-mgmt-media-10.2.1 -- azure-mgmt-mixedreality-1.0.0 - azure-mgmt-mobilenetwork-3.3.0 - azure-mgmt-mongocluster-1.1.0 - azure-mgmt-mongodbatlas-1.0.0 @@ -305,7 +304,6 @@ - azure-mgmt-maps-2.1.0 - azure-mgmt-marketplaceordering-1.1.0 - azure-mgmt-media-10.2.0 -- azure-mgmt-mixedreality-1.0.0 - azure-mgmt-mobilenetwork-3.3.0 - azure-mgmt-mongocluster-1.0.0 - azure-mgmt-mongodbatlas-1.0.0 @@ -490,7 +488,6 @@ - azure-mgmt-maps-2.1.0 - azure-mgmt-marketplaceordering-1.1.0 - azure-mgmt-media-10.2.0 -- azure-mgmt-mixedreality-1.0.0 - azure-mgmt-mobilenetwork-3.3.0 - azure-mgmt-mongocluster-1.0.0 - azure-mgmt-monitor-6.0.2 @@ -670,7 +667,6 @@ - azure-mgmt-maps-2.1.0 - azure-mgmt-marketplaceordering-1.1.0 - azure-mgmt-media-10.2.0 -- azure-mgmt-mixedreality-1.0.0 - azure-mgmt-mobilenetwork-3.3.0 - azure-mgmt-mongocluster-1.0.0 - azure-mgmt-monitor-6.0.2 @@ -846,7 +842,6 @@ - azure-mgmt-maps-2.1.0 - azure-mgmt-marketplaceordering-1.1.0 - azure-mgmt-media-10.2.0 -- azure-mgmt-mixedreality-1.0.0 - azure-mgmt-mobilenetwork-3.3.0 - azure-mgmt-mongocluster-1.0.0 - azure-mgmt-monitor-6.0.2 @@ -1014,7 +1009,6 @@ - azure-mgmt-maps-2.1.0 - azure-mgmt-marketplaceordering-1.1.0 - azure-mgmt-media-10.2.0 -- azure-mgmt-mixedreality-1.0.0 - azure-mgmt-mobilenetwork-3.3.0 - azure-mgmt-monitor-6.0.2 - azure-mgmt-msi-7.0.0 @@ -1177,7 +1171,6 @@ - azure-mgmt-maps-2.1.0 - azure-mgmt-marketplaceordering-1.1.0 - azure-mgmt-media-10.2.0 -- azure-mgmt-mixedreality-1.0.0 - azure-mgmt-mobilenetwork-3.2.0 - azure-mgmt-monitor-6.0.2 - azure-mgmt-msi-7.0.0 @@ -1337,7 +1330,6 @@ - azure-mgmt-maps-2.1.0 - azure-mgmt-marketplaceordering-1.1.0 - azure-mgmt-media-10.2.0 -- azure-mgmt-mixedreality-1.0.0 - azure-mgmt-mobilenetwork-3.1.0 - azure-mgmt-monitor-6.0.2 - azure-mgmt-msi-7.0.0 @@ -1493,7 +1485,6 @@ - azure-mgmt-maps-2.1.0 - azure-mgmt-marketplaceordering-1.1.0 - azure-mgmt-media-10.2.0 -- azure-mgmt-mixedreality-1.0.0 - azure-mgmt-mobilenetwork-3.1.0 - azure-mgmt-monitor-6.0.2 - azure-mgmt-msi-7.0.0 @@ -1638,7 +1629,6 @@ - azure-mgmt-maps-2.0.0 - azure-mgmt-marketplaceordering-1.1.0 - azure-mgmt-media-10.2.0 -- azure-mgmt-mixedreality-1.0.0 - azure-mgmt-mobilenetwork-3.0.0 - azure-mgmt-monitor-6.0.2 - azure-mgmt-msi-7.0.0 @@ -1776,7 +1766,6 @@ - azure-mgmt-maps-2.0.0 - azure-mgmt-marketplaceordering-1.1.0 - azure-mgmt-media-10.2.0 -- azure-mgmt-mixedreality-1.0.0 - azure-mgmt-mobilenetwork-2.0.0 - azure-mgmt-monitor-6.0.1 - azure-mgmt-msi-7.0.0 @@ -1904,7 +1893,6 @@ - azure-mgmt-maps-2.0.0 - azure-mgmt-marketplaceordering-1.1.0 - azure-mgmt-media-10.2.0 -- azure-mgmt-mixedreality-1.0.0 - azure-mgmt-mobilenetwork-2.0.0 - azure-mgmt-monitor-5.0.1 - azure-mgmt-msi-7.0.0 @@ -2024,7 +2012,6 @@ - azure-mgmt-maps-2.0.0 - azure-mgmt-marketplaceordering-1.1.0 - azure-mgmt-media-10.1.0 -- azure-mgmt-mixedreality-1.0.0 - azure-mgmt-monitor-5.0.1 - azure-mgmt-netapp-9.0.1 - azure-mgmt-network-22.1.0 @@ -2137,7 +2124,6 @@ - azure-mgmt-maps-2.0.0 - azure-mgmt-marketplaceordering-1.1.0 - azure-mgmt-media-10.0.0 -- azure-mgmt-mixedreality-1.0.0 - azure-mgmt-monitor-4.0.1 - azure-mgmt-netapp-8.1.0 - azure-mgmt-network-21.0.1 @@ -2244,7 +2230,6 @@ - azure-mgmt-maps-2.0.0 - azure-mgmt-marketplaceordering-1.1.0 - azure-mgmt-media-9.0.0 -- azure-mgmt-mixedreality-1.0.0 - azure-mgmt-monitor-3.1.0 - azure-mgmt-netapp-7.0.0 - azure-mgmt-network-20.0.0 @@ -2341,7 +2326,6 @@ - azure-mgmt-maps-2.0.0 - azure-mgmt-marketplaceordering-1.1.0 - azure-mgmt-media-8.0.0 -- azure-mgmt-mixedreality-1.0.0 - azure-mgmt-monitor-3.0.0 - azure-mgmt-netapp-6.0.1 - azure-mgmt-network-19.3.0 @@ -2432,7 +2416,6 @@ - azure-mgmt-maps-2.0.0 - azure-mgmt-marketplaceordering-1.1.0 - azure-mgmt-media-8.0.0 -- azure-mgmt-mixedreality-1.0.0 - azure-mgmt-monitor-3.0.0 - azure-mgmt-netapp-5.1.0 - azure-mgmt-network-19.3.0 @@ -2518,7 +2501,6 @@ - azure-mgmt-maps-2.0.0 - azure-mgmt-marketplaceordering-1.1.0 - azure-mgmt-media-8.0.0 -- azure-mgmt-mixedreality-1.0.0 - azure-mgmt-monitor-2.0.0 - azure-mgmt-netapp-4.0.0 - azure-mgmt-network-19.0.0 @@ -2598,7 +2580,6 @@ - azure-mgmt-managedservices-6.0.0 - azure-mgmt-maps-2.0.0 - azure-mgmt-marketplaceordering-1.1.0 -- azure-mgmt-mixedreality-1.0.0 - azure-mgmt-monitor-2.0.0 - azure-mgmt-netapp-2.0.0 - azure-mgmt-network-19.0.0 diff --git a/doc/dev/mgmt/coverage.md b/doc/dev/mgmt/coverage.md index fc1c7dde7702..4073f346646e 100644 --- a/doc/dev/mgmt/coverage.md +++ b/doc/dev/mgmt/coverage.md @@ -81,7 +81,6 @@ | azure-mgmt-maps | - | | azure-mgmt-marketplaceordering | M | | azure-mgmt-media | M | -| azure-mgmt-mixedreality | - | | azure-mgmt-monitor | M | | azure-mgmt-msi | 100.00 | | azure-mgmt-netapp | M | diff --git a/doc/sphinx/toc_tree.rst b/doc/sphinx/toc_tree.rst index 39f2a84021e0..a184673cf27c 100644 --- a/doc/sphinx/toc_tree.rst +++ b/doc/sphinx/toc_tree.rst @@ -87,7 +87,6 @@ ./ref/azure.mgmt.maps.rst ./ref/azure.mgmt.marketplaceordering.rst ./ref/azure.mgmt.media.rst - ./ref/azure.mgmt.mixedreality.rst ./ref/azure.mgmt.monitor.rst ./ref/azure.mgmt.msi.rst ./ref/azure.mgmt.netapp.rst diff --git a/eng/.docsettings.yml b/eng/.docsettings.yml index 8289d6d95909..5aff1a282f66 100644 --- a/eng/.docsettings.yml +++ b/eng/.docsettings.yml @@ -110,7 +110,6 @@ known_content_issues: - ['sdk/core/azure-core/tests/testserver_tests/coretestserver/README.rst', '#4554'] - ['sdk/core/corehttp/tests/testserver_tests/coretestserver/README.rst', '#4554'] - ['sdk/media/azure-media-analytics-edge/README.md', '#4554'] - - ['sdk/remoterendering/azure-mixedreality-remoterendering/README.md', '#4554'] - ['sdk/modelsrepository/azure-iot-modelsrepository/README.md', '#4554'] - ['sdk/openai/azure-openai/README.md', '#4554'] - ['sdk/ai/azure-ai-generative/README.md', 'Deprecated package.'] diff --git a/eng/pipelines/templates/stages/conda-sdk-client.yml b/eng/pipelines/templates/stages/conda-sdk-client.yml index 98b6811d2600..1e3f6d40f3c3 100644 --- a/eng/pipelines/templates/stages/conda-sdk-client.yml +++ b/eng/pipelines/templates/stages/conda-sdk-client.yml @@ -747,8 +747,6 @@ extends: version: 1.1.0 - package: azure-mgmt-media version: 10.2.1 - - package: azure-mgmt-mixedreality - version: 1.0.0 - package: azure-mgmt-mobilenetwork version: 3.3.0 - package: azure-mgmt-mongocluster diff --git a/eng/pipelines/templates/stages/regression-job-matrix.json b/eng/pipelines/templates/stages/regression-job-matrix.json index 78d268932858..09aaa3f2b035 100644 --- a/eng/pipelines/templates/stages/regression-job-matrix.json +++ b/eng/pipelines/templates/stages/regression-job-matrix.json @@ -16,7 +16,6 @@ "purview", "eventgrid", "confidentialledger", - "mixedreality", "agrifood", "monitor", "attestation", diff --git a/eng/pylintrc b/eng/pylintrc index ef80940dd924..c0bbe1d67f0b 100644 --- a/eng/pylintrc +++ b/eng/pylintrc @@ -5,8 +5,6 @@ reports=no # PYLINT DIRECTORY BLACKLIST. ignore-paths= - azure\\mixedreality\\remoterendering\\_api_version.py, - azure/mixedreality/remoterendering/_api_version.py, (?:.*[/\\]|^).*[/\\](projects|agents)[/\\](models/_models.py|_model_base.py|operations/_operations.py|aio/operations/_operations.py)$, # Exclude any path that contains the following directory names (?:.*[/\\]|^)(?:_vendor|_generated|_restclient|samples|tests|test|examples|doc|\.tox)(?:[/\\]|$) diff --git a/eng/samples_pylintrc b/eng/samples_pylintrc index edab88a322f7..9e2898f246c4 100644 --- a/eng/samples_pylintrc +++ b/eng/samples_pylintrc @@ -5,8 +5,6 @@ reports=no # PYLINT DIRECTORY BLACKLIST. ignore-paths= - azure\\mixedreality\\remoterendering\\_api_version.py, - azure/mixedreality/remoterendering/_api_version.py, (?:.*[/\\]|^).*[/\\](projects|agents)[/\\](models/_models.py|_model_base.py|operations/_operations.py|aio/operations/_operations.py)$, # Exclude any path that contains the following directory names (?:.*[/\\]|^)(?:_vendor|_generated|_restclient|tests|test|examples|doc|\.tox)(?:[/\\]|$) diff --git a/eng/test_pylintrc b/eng/test_pylintrc index 08aade52866a..f1532a765f84 100644 --- a/eng/test_pylintrc +++ b/eng/test_pylintrc @@ -5,8 +5,6 @@ reports=no # PYLINT DIRECTORY BLACKLIST. ignore-paths= - azure\\mixedreality\\remoterendering\\_api_version.py, - azure/mixedreality/remoterendering/_api_version.py, (?:.*[/\\]|^).*[/\\](projects|agents)[/\\](models/_models.py|_model_base.py|operations/_operations.py|aio/operations/_operations.py)$, # Exclude any path that contains the following directory names (?:.*[/\\]|^)(?:_vendor|_generated|_restclient|examples|samples|doc|\.tox)(?:[/\\]|$) diff --git a/pylintrc b/pylintrc index 6b3ea3408928..cbfd6f9b3b27 100644 --- a/pylintrc +++ b/pylintrc @@ -5,8 +5,6 @@ reports=no # PYLINT DIRECTORY BLACKLIST. ignore-paths= - azure\\mixedreality\\remoterendering\\_api_version.py, - azure/mixedreality/remoterendering/_api_version.py, (?:.*[/\\]|^).*[/\\](projects|agents)[/\\](models/_models.py|_model_base.py|operations/_operations.py|aio/operations/_operations.py)$, # Exclude any path that contains the following directory names (?:.*[/\\]|^)(?:_vendor|_generated|_restclient|samples|examples|test|tests|doc|\.tox)(?:[/\\]|$) diff --git a/scripts/repo_type_completeness/generate_main_typescores.py b/scripts/repo_type_completeness/generate_main_typescores.py index 0c62ead0050d..714aba8d7136 100644 --- a/scripts/repo_type_completeness/generate_main_typescores.py +++ b/scripts/repo_type_completeness/generate_main_typescores.py @@ -74,7 +74,6 @@ # Format: "library_to_score": [dependencies_to_uninstall] RESOLUTION_IMPOSSIBLE_LIBRARIES = { - "azure-mixedreality-authentication": ["azure-mixedreality-remoterendering"], "azure-ai-ml": ["azure-storage-blob", "azure-storage-file-share", "azure-storage-file-datalake"], "azure-storage-blob-changefeed": ["azure-storage-blob"], "azure-storage-file-datalake": ["azure-storage-blob"], diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/CHANGELOG.md b/sdk/mixedreality/azure-mgmt-mixedreality/CHANGELOG.md deleted file mode 100644 index 93be58694238..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/CHANGELOG.md +++ /dev/null @@ -1,116 +0,0 @@ -# Release History - -## 1.1.0b1 (2022-11-01) - -### Features Added - - - Model MetricDimension has a new parameter to_be_exported_for_shoebox - - Model MetricSpecification has a new parameter category - - Model MetricSpecification has a new parameter enable_regional_mdm_account - - Model MetricSpecification has a new parameter fill_gap_with_zero - - Model MetricSpecification has a new parameter locked_aggregation_type - - Model MetricSpecification has a new parameter metric_filter_pattern - - Model MetricSpecification has a new parameter source_mdm_account - - Model MetricSpecification has a new parameter source_mdm_namespace - - Model MetricSpecification has a new parameter supported_aggregation_types - - Model MetricSpecification has a new parameter supported_time_grain_types - - Model ObjectAnchorsAccount has a new parameter kind - - Model ObjectAnchorsAccount has a new parameter plan - - Model ObjectAnchorsAccount has a new parameter sku - -## 1.0.0 (2021-04-27) - -**Features** - - - Model Operation has a new parameter properties - - Model Operation has a new parameter origin - - Model Operation has a new parameter is_data_action - - Model SpatialAnchorsAccount has a new parameter plan - - Model SpatialAnchorsAccount has a new parameter system_data - - Model SpatialAnchorsAccount has a new parameter sku - - Model SpatialAnchorsAccount has a new parameter identity - - Model SpatialAnchorsAccount has a new parameter storage_account_name - - Model SpatialAnchorsAccount has a new parameter kind - - Model RemoteRenderingAccount has a new parameter plan - - Model RemoteRenderingAccount has a new parameter system_data - - Model RemoteRenderingAccount has a new parameter sku - - Model RemoteRenderingAccount has a new parameter storage_account_name - - Model RemoteRenderingAccount has a new parameter kind - - Added operation group ObjectAnchorsAccountsOperations - -## 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/main/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/main/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/main/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 diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/LICENSE b/sdk/mixedreality/azure-mgmt-mixedreality/LICENSE deleted file mode 100644 index b2f52a2bad4e..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright (c) Microsoft Corporation. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/MANIFEST.in b/sdk/mixedreality/azure-mgmt-mixedreality/MANIFEST.in deleted file mode 100644 index bd807e3c1dd7..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/MANIFEST.in +++ /dev/null @@ -1,8 +0,0 @@ -include _meta.json -recursive-include tests *.py *.json -recursive-include samples *.py *.md -include *.md -include azure/__init__.py -include azure/mgmt/__init__.py -include LICENSE -include azure/mgmt/mixedreality/py.typed diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/README.md b/sdk/mixedreality/azure-mgmt-mixedreality/README.md deleted file mode 100644 index 4362171ab685..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# Microsoft Azure SDK for Python - -This is the Microsoft Azure Mixed Reality Management Client Library. -This package has been tested with Python 3.7+. -For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). - -## _Disclaimer_ - -_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_ - -# Usage - - -To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) - -For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) -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. -Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) - - -# Provide Feedback - -If you encounter any bugs or have suggestions, please file an issue in the -[Issues](https://github.com/Azure/azure-sdk-for-python/issues) -section of the project. - - - diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/_meta.json b/sdk/mixedreality/azure-mgmt-mixedreality/_meta.json deleted file mode 100644 index 43fb421b6fd6..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "4522e1d3fb6dcb81bc63e3414d11dd7eaf08264b", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", - "use": [ - "@autorest/python@6.2.1", - "@autorest/modelerfour@4.24.3" - ], - "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", - "readme": "specification/mixedreality/resource-manager/readme.md" -} \ No newline at end of file diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/__init__.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/__init__.py deleted file mode 100644 index 8db66d3d0f0f..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/__init__.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/__init__.py deleted file mode 100644 index 8db66d3d0f0f..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/__init__.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/__init__.py deleted file mode 100644 index 610e1857d28b..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# 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 ._mixed_reality_client import MixedRealityClient -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__ = [ - "MixedRealityClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_configuration.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_configuration.py deleted file mode 100644 index d3042efdccbc..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_configuration.py +++ /dev/null @@ -1,76 +0,0 @@ -# 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 sys -from typing import Any, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class MixedRealityClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """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. Required. - :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). Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2021-03-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(MixedRealityClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-03-01-preview") # type: Literal["2021-03-01-preview"] - - 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.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - 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 = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_mixed_reality_client.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_mixed_reality_client.py deleted file mode 100644 index 7b24aa5c899a..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_mixed_reality_client.py +++ /dev/null @@ -1,115 +0,0 @@ -# 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 copy import deepcopy -from typing import Any, TYPE_CHECKING - -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient - -from . import models -from ._configuration import MixedRealityClientConfiguration -from ._serialization import Deserializer, Serializer -from .operations import ( - MixedRealityClientOperationsMixin, - ObjectAnchorsAccountsOperations, - Operations, - RemoteRenderingAccountsOperations, - SpatialAnchorsAccountsOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class MixedRealityClient(MixedRealityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword - """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 - :ivar object_anchors_accounts: ObjectAnchorsAccountsOperations operations - :vartype object_anchors_accounts: - azure.mgmt.mixedreality.operations.ObjectAnchorsAccountsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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). Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2021-03-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = MixedRealityClientConfiguration(credential=credential, subscription_id=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._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - 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 - ) - self.object_anchors_accounts = ObjectAnchorsAccountsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - 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) diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_patch.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# 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 - """ diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_serialization.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_serialization.py deleted file mode 100644 index 7c1dedb5133d..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_serialization.py +++ /dev/null @@ -1,1970 +0,0 @@ -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# pylint: skip-file - -from base64 import b64decode, b64encode -import calendar -import datetime -import decimal -import email -from enum import Enum -import json -import logging -import re -import sys -import codecs - -try: - from urllib import quote # type: ignore -except ImportError: - from urllib.parse import quote # type: ignore -import xml.etree.ElementTree as ET - -import isodate - -from typing import Dict, Any, cast, TYPE_CHECKING - -from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback - -_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") - -if TYPE_CHECKING: - from typing import Optional, Union, AnyStr, IO, Mapping - - -class RawDeserializer: - - # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") - - # Name used in context - CONTEXT_NAME = "deserialized_data" - - @classmethod - def deserialize_from_text(cls, data, content_type=None): - # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any - """Decode data according to content-type. - - Accept a stream of data as well, but will be load at once in memory for now. - - If no content-type, will return the string version (not bytes, not stream) - - :param data: Input, could be bytes or stream (will be decoded with UTF8) or text - :type data: str or bytes or IO - :param str content_type: The content type. - """ - if hasattr(data, "read"): - # Assume a stream - data = cast(IO, data).read() - - if isinstance(data, bytes): - data_as_str = data.decode(encoding="utf-8-sig") - else: - # Explain to mypy the correct type. - data_as_str = cast(str, data) - - # Remove Byte Order Mark if present in string - data_as_str = data_as_str.lstrip(_BOM) - - if content_type is None: - return data - - if cls.JSON_REGEXP.match(content_type): - try: - return json.loads(data_as_str) - except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) - elif "xml" in (content_type or []): - try: - - try: - if isinstance(data, unicode): # type: ignore - # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string - data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore - except NameError: - pass - - return ET.fromstring(data_as_str) # nosec - except ET.ParseError: - # It might be because the server has an issue, and returned JSON with - # content-type XML.... - # So let's try a JSON load, and if it's still broken - # let's flow the initial exception - def _json_attemp(data): - try: - return True, json.loads(data) - except ValueError: - return False, None # Don't care about this one - - success, json_result = _json_attemp(data) - if success: - return json_result - # If i'm here, it's not JSON, it's not XML, let's scream - # and raise the last context in this block (the XML exception) - # The function hack is because Py2.7 messes up with exception - # context otherwise. - _LOGGER.critical("Wasn't XML not JSON, failing") - raise_with_traceback(DeserializationError, "XML is invalid") - raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) - - @classmethod - def deserialize_from_http_generics(cls, body_bytes, headers): - # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any - """Deserialize from HTTP response. - - Use bytes and headers to NOT use any requests/aiohttp or whatever - specific implementation. - Headers will tested for "content-type" - """ - # Try to use content-type from headers if available - content_type = None - if "content-type" in headers: - content_type = headers["content-type"].split(";")[0].strip().lower() - # Ouch, this server did not declare what it sent... - # Let's guess it's JSON... - # Also, since Autorest was considering that an empty body was a valid JSON, - # need that test as well.... - else: - content_type = "application/json" - - if body_bytes: - return cls.deserialize_from_text(body_bytes, content_type) - return None - - -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str # type: ignore - unicode_str = str # type: ignore - -_LOGGER = logging.getLogger(__name__) - -try: - _long_type = long # type: ignore -except NameError: - _long_type = int - - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0.""" - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation.""" - return "Z" - - def dst(self, dt): - """No daylight saving for UTC.""" - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset): - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc # type: ignore -except ImportError: - TZ_UTC = UTC() # type: ignore - -_FLATTEN = re.compile(r"(? y, - "minimum": lambda x, y: x < y, - "maximum": lambda x, y: x > y, - "minimum_ex": lambda x, y: x <= y, - "maximum_ex": lambda x, y: x >= y, - "min_items": lambda x, y: len(x) < y, - "max_items": lambda x, y: len(x) > y, - "pattern": lambda x, y: not re.match(y, x, re.UNICODE), - "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0, - } - - def __init__(self, classes=None): - self.serialize_type = { - "iso-8601": Serializer.serialize_iso, - "rfc-1123": Serializer.serialize_rfc, - "unix-time": Serializer.serialize_unix, - "duration": Serializer.serialize_duration, - "date": Serializer.serialize_date, - "time": Serializer.serialize_time, - "decimal": Serializer.serialize_decimal, - "long": Serializer.serialize_long, - "bytearray": Serializer.serialize_bytearray, - "base64": Serializer.serialize_base64, - "object": self.serialize_object, - "[]": self.serialize_iter, - "{}": self.serialize_dict, - } - self.dependencies = dict(classes) if classes else {} - self.key_transformer = full_restapi_key_transformer - self.client_side_validation = True - - def _serialize(self, target_obj, data_type=None, **kwargs): - """Serialize data into a string according to type. - - :param target_obj: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, dict - :raises: SerializationError if serialization fails. - """ - key_transformer = kwargs.get("key_transformer", self.key_transformer) - keep_readonly = kwargs.get("keep_readonly", False) - if target_obj is None: - return None - - attr_name = None - class_name = target_obj.__class__.__name__ - - if data_type: - return self.serialize_data(target_obj, data_type, **kwargs) - - if not hasattr(target_obj, "_attribute_map"): - data_type = type(target_obj).__name__ - if data_type in self.basic_types.values(): - return self.serialize_data(target_obj, data_type, **kwargs) - - # Force "is_xml" kwargs if we detect a XML model - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) - - serialized = {} - if is_xml_model_serialization: - serialized = target_obj._create_xml_node() - try: - attributes = target_obj._attribute_map - for attr, attr_desc in attributes.items(): - attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): - continue - - if attr_name == "additional_properties" and attr_desc["key"] == "": - if target_obj.additional_properties is not None: - serialized.update(target_obj.additional_properties) - continue - try: - - orig_attr = getattr(target_obj, attr) - if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON - keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) - keys = keys if isinstance(keys, list) else [keys] - - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) - - if is_xml_model_serialization: - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - xml_prefix = xml_desc.get("prefix", None) - xml_ns = xml_desc.get("ns", None) - if xml_desc.get("attr", False): - if xml_ns: - ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) - continue - if xml_desc.get("text", False): - serialized.text = new_attr - continue - if isinstance(new_attr, list): - serialized.extend(new_attr) - elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. - if "name" not in getattr(orig_attr, "_xml_map", {}): - splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace - new_attr.tag = "}".join([splitted_tag[0], xml_name]) - else: - new_attr.tag = xml_name - serialized.append(new_attr) - else: # That's a basic type - # Integrate namespace if necessary - local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = unicode_str(new_attr) - serialized.append(local_node) - else: # JSON - for k in reversed(keys): - unflattened = {k: new_attr} - new_attr = unflattened - - _new_attr = new_attr - _serialized = serialized - for k in keys: - if k not in _serialized: - _serialized.update(_new_attr) - _new_attr = _new_attr[k] - _serialized = _serialized[k] - except ValueError: - continue - - except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise_with_traceback(SerializationError, msg, err) - else: - return serialized - - def body(self, data, data_type, **kwargs): - """Serialize data intended for a request body. - - :param data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None - """ - - # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - if internal_data_type and issubclass(internal_data_type, Model): - is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) - else: - is_xml_model_serialization = False - if internal_data_type and not isinstance(internal_data_type, Enum): - try: - deserializer = Deserializer(self.dependencies) - # Since it's on serialization, it's almost sure that format is not JSON REST - # We're not able to deal with additional properties for now. - deserializer.additional_properties_detection = False - if is_xml_model_serialization: - deserializer.key_extractors = [ - attribute_key_case_insensitive_extractor, - ] - else: - deserializer.key_extractors = [ - rest_key_case_insensitive_extractor, - attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - data = deserializer._deserialize(data_type, data) - except DeserializationError as err: - raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) - - return self._serialize(data, data_type, **kwargs) - - def url(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL path. - - :param data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None - """ - try: - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - - if kwargs.get("skip_quote") is True: - output = str(output) - else: - output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return output - - def query(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL query. - - :param data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None - """ - try: - # Treat the list aside, since we don't want to encode the div separator - if data_type.startswith("["): - internal_data_type = data_type[1:-1] - data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] - if not kwargs.get("skip_quote", False): - data = [quote(str(d), safe="") for d in data] - return str(self.serialize_iter(data, internal_data_type, **kwargs)) - - # Not a list, regular serialization - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - if kwargs.get("skip_quote") is True: - output = str(output) - else: - output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) - - def header(self, name, data, data_type, **kwargs): - """Serialize data intended for a request header. - - :param data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None - """ - try: - if data_type in ["[str]"]: - data = ["" if d is None else d for d in data] - - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) - - def serialize_data(self, data, data_type, **kwargs): - """Serialize generic data according to supplied data type. - - :param data: The data to be serialized. - :param str data_type: The type to be serialized from. - :param bool required: Whether it's essential that the data not be - empty or None - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. - """ - if data is None: - raise ValueError("No value for given attribute") - - try: - if data_type in self.basic_types.values(): - return self.serialize_basic(data, data_type, **kwargs) - - elif data_type in self.serialize_type: - return self.serialize_type[data_type](data, **kwargs) - - # If dependencies is empty, try with current data class - # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, data.__class__) - if issubclass(enum_type, Enum): - return Serializer.serialize_enum(data, enum_obj=enum_type) - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.serialize_type: - return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) - - except (ValueError, TypeError) as err: - msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback(SerializationError, msg.format(data, data_type), err) - else: - return self._serialize(data, **kwargs) - - @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): - custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) - if custom_serializer: - return custom_serializer - if kwargs.get("is_xml", False): - return cls._xml_basic_types_serializers.get(data_type) - - @classmethod - def serialize_basic(cls, data, data_type, **kwargs): - """Serialize basic builting data type. - Serializes objects to str, int, float or bool. - - Possible kwargs: - - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - - is_xml bool : If set, use xml_basic_types_serializers - - :param data: Object to be serialized. - :param str data_type: Type of object in the iterable. - """ - custom_serializer = cls._get_custom_serializers(data_type, **kwargs) - if custom_serializer: - return custom_serializer(data) - if data_type == "str": - return cls.serialize_unicode(data) - return eval(data_type)(data) # nosec - - @classmethod - def serialize_unicode(cls, data): - """Special handling for serializing unicode strings in Py2. - Encode to UTF-8 if unicode, otherwise handle as a str. - - :param data: Object to be serialized. - :rtype: str - """ - try: # If I received an enum, return its value - return data.value - except AttributeError: - pass - - try: - if isinstance(data, unicode): - # Don't change it, JSON and XML ElementTree are totally able - # to serialize correctly u'' strings - return data - except NameError: - return str(data) - else: - return str(data) - - def serialize_iter(self, data, iter_type, div=None, **kwargs): - """Serialize iterable. - - Supported kwargs: - - serialization_ctxt dict : The current entry of _attribute_map, or same format. - serialization_ctxt['type'] should be same as data_type. - - is_xml bool : If set, serialize as XML - - :param list attr: Object to be serialized. - :param str iter_type: Type of object in the iterable. - :param bool required: Whether the objects in the iterable must - not be None or empty. - :param str div: If set, this str will be used to combine the elements - in the iterable into a combined string. Default is 'None'. - :rtype: list, str - """ - if isinstance(data, str): - raise SerializationError("Refuse str type as a valid iter type.") - - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - is_xml = kwargs.get("is_xml", False) - - serialized = [] - for d in data: - try: - serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError: - serialized.append(None) - - if div: - serialized = ["" if s is None else str(s) for s in serialized] - serialized = div.join(serialized) - - if "xml" in serialization_ctxt or is_xml: - # XML serialization is more complicated - xml_desc = serialization_ctxt.get("xml", {}) - xml_name = xml_desc.get("name") - if not xml_name: - xml_name = serialization_ctxt["key"] - - # Create a wrap node if necessary (use the fact that Element and list have "append") - is_wrapped = xml_desc.get("wrapped", False) - node_name = xml_desc.get("itemsName", xml_name) - if is_wrapped: - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - else: - final_result = [] - # All list elements to "local_node" - for el in serialized: - if isinstance(el, ET.Element): - el_node = el - else: - el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - if el is not None: # Otherwise it writes "None" :-p - el_node.text = str(el) - final_result.append(el_node) - return final_result - return serialized - - def serialize_dict(self, attr, dict_type, **kwargs): - """Serialize a dictionary of objects. - - :param dict attr: Object to be serialized. - :param str dict_type: Type of object in the dictionary. - :param bool required: Whether the objects in the dictionary must - not be None or empty. - :rtype: dict - """ - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError: - serialized[self.serialize_unicode(key)] = None - - if "xml" in serialization_ctxt: - # XML serialization is more complicated - xml_desc = serialization_ctxt["xml"] - xml_name = xml_desc["name"] - - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - for key, value in serialized.items(): - ET.SubElement(final_result, key).text = value - return final_result - - return serialized - - def serialize_object(self, attr, **kwargs): - """Serialize a generic object. - This will be handled as a dictionary. If object passed in is not - a basic type (str, int, float, dict, list) it will simply be - cast to str. - - :param dict attr: Object to be serialized. - :rtype: dict or str - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - return attr - obj_type = type(attr) - if obj_type in self.basic_types: - return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) - if obj_type is _long_type: - return self.serialize_long(attr) - if obj_type is unicode_str: - return self.serialize_unicode(attr) - if obj_type is datetime.datetime: - return self.serialize_iso(attr) - if obj_type is datetime.date: - return self.serialize_date(attr) - if obj_type is datetime.time: - return self.serialize_time(attr) - if obj_type is datetime.timedelta: - return self.serialize_duration(attr) - if obj_type is decimal.Decimal: - return self.serialize_decimal(attr) - - # If it's a model or I know this dependency, serialize as a Model - elif obj_type in self.dependencies.values() or isinstance(attr, Model): - return self._serialize(attr) - - if obj_type == dict: - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) - except ValueError: - serialized[self.serialize_unicode(key)] = None - return serialized - - if obj_type == list: - serialized = [] - for obj in attr: - try: - serialized.append(self.serialize_object(obj, **kwargs)) - except ValueError: - pass - return serialized - return str(attr) - - @staticmethod - def serialize_enum(attr, enum_obj=None): - try: - result = attr.value - except AttributeError: - result = attr - try: - enum_obj(result) - return result - except ValueError: - for enum_value in enum_obj: - if enum_value.value.lower() == str(attr).lower(): - return enum_value.value - error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) - - @staticmethod - def serialize_bytearray(attr, **kwargs): - """Serialize bytearray into base-64 string. - - :param attr: Object to be serialized. - :rtype: str - """ - return b64encode(attr).decode() - - @staticmethod - def serialize_base64(attr, **kwargs): - """Serialize str into base-64 string. - - :param attr: Object to be serialized. - :rtype: str - """ - encoded = b64encode(attr).decode("ascii") - return encoded.strip("=").replace("+", "-").replace("/", "_") - - @staticmethod - def serialize_decimal(attr, **kwargs): - """Serialize Decimal object to float. - - :param attr: Object to be serialized. - :rtype: float - """ - return float(attr) - - @staticmethod - def serialize_long(attr, **kwargs): - """Serialize long (Py2) or int (Py3). - - :param attr: Object to be serialized. - :rtype: int/long - """ - return _long_type(attr) - - @staticmethod - def serialize_date(attr, **kwargs): - """Serialize Date object into ISO-8601 formatted string. - - :param Date attr: Object to be serialized. - :rtype: str - """ - if isinstance(attr, str): - attr = isodate.parse_date(attr) - t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) - return t - - @staticmethod - def serialize_time(attr, **kwargs): - """Serialize Time object into ISO-8601 formatted string. - - :param datetime.time attr: Object to be serialized. - :rtype: str - """ - if isinstance(attr, str): - attr = isodate.parse_time(attr) - t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) - if attr.microsecond: - t += ".{:02}".format(attr.microsecond) - return t - - @staticmethod - def serialize_duration(attr, **kwargs): - """Serialize TimeDelta object into ISO-8601 formatted string. - - :param TimeDelta attr: Object to be serialized. - :rtype: str - """ - if isinstance(attr, str): - attr = isodate.parse_duration(attr) - return isodate.duration_isoformat(attr) - - @staticmethod - def serialize_rfc(attr, **kwargs): - """Serialize Datetime object into RFC-1123 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises: TypeError if format invalid. - """ - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - except AttributeError: - raise TypeError("RFC1123 object must be valid Datetime object.") - - return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], - utc.tm_mday, - Serializer.months[utc.tm_mon], - utc.tm_year, - utc.tm_hour, - utc.tm_min, - utc.tm_sec, - ) - - @staticmethod - def serialize_iso(attr, **kwargs): - """Serialize Datetime object into ISO-8601 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises: SerializationError if format invalid. - """ - if isinstance(attr, str): - attr = isodate.parse_datetime(attr) - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - if utc.tm_year > 9999 or utc.tm_year < 1: - raise OverflowError("Hit max or min date") - - microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") - if microseconds: - microseconds = "." + microseconds - date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec - ) - return date + microseconds + "Z" - except (ValueError, OverflowError) as err: - msg = "Unable to serialize datetime object." - raise_with_traceback(SerializationError, msg, err) - except AttributeError as err: - msg = "ISO-8601 object must be valid Datetime object." - raise_with_traceback(TypeError, msg, err) - - @staticmethod - def serialize_unix(attr, **kwargs): - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param Datetime attr: Object to be serialized. - :rtype: int - :raises: SerializationError if format invalid - """ - if isinstance(attr, int): - return attr - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - return int(calendar.timegm(attr.utctimetuple())) - except AttributeError: - raise TypeError("Unix time object must be valid Datetime object.") - - -def rest_key_extractor(attr, attr_desc, data): - key = attr_desc["key"] - working_data = data - - while "." in key: - dict_keys = _FLATTEN.split(key) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = working_data.get(working_key, data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 - return None - key = ".".join(dict_keys[1:]) - - return working_data.get(key) - - -def rest_key_case_insensitive_extractor(attr, attr_desc, data): - key = attr_desc["key"] - working_data = data - - while "." in key: - dict_keys = _FLATTEN.split(key) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 - return None - key = ".".join(dict_keys[1:]) - - if working_data: - return attribute_key_case_insensitive_extractor(key, None, working_data) - - -def last_rest_key_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key.""" - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_extractor(dict_keys[-1], None, data) - - -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key. - - This is the case insensitive version of "last_rest_key_extractor" - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) - - -def attribute_key_extractor(attr, _, data): - return data.get(attr) - - -def attribute_key_case_insensitive_extractor(attr, _, data): - found_key = None - lower_attr = attr.lower() - for key in data: - if lower_attr == key.lower(): - found_key = key - break - - return data.get(found_key) - - -def _extract_name_from_internal_type(internal_type): - """Given an internal type XML description, extract correct XML name with namespace. - - :param dict internal_type: An model type - :rtype: tuple - :returns: A tuple XML name + namespace dict - """ - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get("name", internal_type.__name__) - xml_ns = internal_type_xml_map.get("ns", None) - if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) - return xml_name - - -def xml_key_extractor(attr, attr_desc, data): - if isinstance(data, dict): - return None - - # Test if this model is XML ready first - if not isinstance(data, ET.Element): - return None - - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - - # Look for a children - is_iter_type = attr_desc["type"].startswith("[") - is_wrapped = xml_desc.get("wrapped", False) - internal_type = attr_desc.get("internalType", None) - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - - # Integrate namespace if necessary - xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) - if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) - - # If it's an attribute, that's simple - if xml_desc.get("attr", False): - return data.get(xml_name) - - # If it's x-ms-text, that's simple too - if xml_desc.get("text", False): - return data.text - - # Scenario where I take the local name: - # - Wrapped node - # - Internal type is an enum (considered basic types) - # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): - children = data.findall(xml_name) - # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and "name" in internal_type_xml_map: - xml_name = _extract_name_from_internal_type(internal_type) - children = data.findall(xml_name) - # That's an array - else: - if internal_type: # Complex type, ignore itemsName and use the complex type name - items_name = _extract_name_from_internal_type(internal_type) - else: - items_name = xml_desc.get("itemsName", xml_name) - children = data.findall(items_name) - - if len(children) == 0: - if is_iter_type: - if is_wrapped: - return None # is_wrapped no node, we want None - else: - return [] # not wrapped, assume empty list - return None # Assume it's not there, maybe an optional node. - - # If is_iter_type and not wrapped, return all found children - if is_iter_type: - if not is_wrapped: - return children - else: # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) - ) - return list(children[0]) # Might be empty list and that's ok. - - # Here it's not a itertype, we should have found one element only or empty - if len(children) > 1: - raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) - return children[0] - - -class Deserializer(object): - """Response object model deserializer. - - :param dict classes: Class type dictionary for deserializing complex types. - :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. - """ - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - - def __init__(self, classes=None): - self.deserialize_type = { - "iso-8601": Deserializer.deserialize_iso, - "rfc-1123": Deserializer.deserialize_rfc, - "unix-time": Deserializer.deserialize_unix, - "duration": Deserializer.deserialize_duration, - "date": Deserializer.deserialize_date, - "time": Deserializer.deserialize_time, - "decimal": Deserializer.deserialize_decimal, - "long": Deserializer.deserialize_long, - "bytearray": Deserializer.deserialize_bytearray, - "base64": Deserializer.deserialize_base64, - "object": self.deserialize_object, - "[]": self.deserialize_iter, - "{}": self.deserialize_dict, - } - self.deserialize_expected_types = { - "duration": (isodate.Duration, datetime.timedelta), - "iso-8601": (datetime.datetime), - } - self.dependencies = dict(classes) if classes else {} - self.key_extractors = [rest_key_extractor, xml_key_extractor] - # Additional properties only works if the "rest_key_extractor" is used to - # extract the keys. Making it to work whatever the key extractor is too much - # complicated, with no real scenario for now. - # So adding a flag to disable additional properties detection. This flag should be - # used if your expect the deserialization to NOT come from a JSON REST syntax. - # Otherwise, result are unexpected - self.additional_properties_detection = True - - def __call__(self, target_obj, response_data, content_type=None): - """Call the deserializer to process a REST response. - - :param str target_obj: Target data type to deserialize to. - :param requests.Response response_data: REST response object. - :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. - :return: Deserialized object. - """ - data = self._unpack_content(response_data, content_type) - return self._deserialize(target_obj, data) - - def _deserialize(self, target_obj, data): - """Call the deserializer on a model. - - Data needs to be already deserialized as JSON or XML ElementTree - - :param str target_obj: Target data type to deserialize to. - :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. - :return: Deserialized object. - """ - # This is already a model, go recursive just in case - if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] - try: - for attr, mapconfig in data._attribute_map.items(): - if attr in constants: - continue - value = getattr(data, attr) - if value is None: - continue - local_type = mapconfig["type"] - internal_data_type = local_type.strip("[]{}") - if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): - continue - setattr(data, attr, self._deserialize(local_type, value)) - return data - except AttributeError: - return - - response, class_name = self._classify_target(target_obj, data) - - if isinstance(response, basestring): - return self.deserialize_data(data, response) - elif isinstance(response, type) and issubclass(response, Enum): - return self.deserialize_enum(data, response) - - if data is None: - return data - try: - attributes = response._attribute_map - d_attrs = {} - for attr, attr_desc in attributes.items(): - # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == "": - continue - raw_value = None - # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip("[]{}") - if internal_data_type in self.dependencies: - attr_desc["internalType"] = self.dependencies[internal_data_type] - - for key_extractor in self.key_extractors: - found_value = key_extractor(attr, attr_desc, data) - if found_value is not None: - if raw_value is not None and raw_value != found_value: - msg = ( - "Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" - ) - _LOGGER.warning(msg, found_value, key_extractor, attr) - continue - raw_value = found_value - - value = self.deserialize_data(raw_value, attr_desc["type"]) - d_attrs[attr] = value - except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name - raise_with_traceback(DeserializationError, msg, err) - else: - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) - - def _build_additional_properties(self, attribute_map, data): - if not self.additional_properties_detection: - return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": - # Check empty string. If it's not empty, someone has a real "additionalProperties" - return None - if isinstance(data, ET.Element): - data = {el.tag: el.text for el in data} - - known_keys = { - _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) - for desc in attribute_map.values() - if desc["key"] != "" - } - present_keys = set(data.keys()) - missing_keys = present_keys - known_keys - return {key: data[key] for key in missing_keys} - - def _classify_target(self, target, data): - """Check to see whether the deserialization target object can - be classified into a subclass. - Once classification has been determined, initialize object. - - :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. - """ - if target is None: - return None, None - - if isinstance(target, basestring): - try: - target = self.dependencies[target] - except KeyError: - return target, target - - try: - target = target._classify(data, self.dependencies) - except AttributeError: - pass # Target is not a Model, no classify - return target, target.__class__.__name__ - - def failsafe_deserialize(self, target_obj, data, content_type=None): - """Ignores any errors encountered in deserialization, - and falls back to not deserializing the object. Recommended - for use in error deserialization, as we want to return the - HttpResponseError to users, and not have them deal with - a deserialization error. - - :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. - :param str content_type: Swagger "produces" if available. - """ - try: - return self(target_obj, data, content_type=content_type) - except: - _LOGGER.debug( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - @staticmethod - def _unpack_content(raw_data, content_type=None): - """Extract the correct structure for deserialization. - - If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. - if we can't, raise. Your Pipeline should have a RawDeserializer. - - If not a pipeline response and raw_data is bytes or string, use content-type - to decode it. If no content-type, try JSON. - - If raw_data is something else, bypass all logic and return it directly. - - :param raw_data: Data to be processed. - :param content_type: How to parse if raw_data is a string/bytes. - :raises JSONDecodeError: If JSON is requested and parsing is impossible. - :raises UnicodeDecodeError: If bytes is not UTF8 - """ - # Assume this is enough to detect a Pipeline Response without importing it - context = getattr(raw_data, "context", {}) - if context: - if RawDeserializer.CONTEXT_NAME in context: - return context[RawDeserializer.CONTEXT_NAME] - raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - - # Assume this is enough to recognize universal_http.ClientResponse without importing it - if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) - - # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, "_content_consumed"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) - return raw_data - - def _instantiate_model(self, response, attrs, additional_properties=None): - """Instantiate a response model passing in deserialized args. - - :param response: The response model class. - :param d_attrs: The deserialized response attributes. - """ - if callable(response): - subtype = getattr(response, "_subtype_map", {}) - try: - readonly = [k for k, v in response._validation.items() if v.get("readonly")] - const = [k for k, v in response._validation.items() if v.get("constant")] - kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} - response_obj = response(**kwargs) - for attr in readonly: - setattr(response_obj, attr, attrs.get(attr)) - if additional_properties: - response_obj.additional_properties = additional_properties - return response_obj - except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) - raise DeserializationError(msg + str(err)) - else: - try: - for attr, value in attrs.items(): - setattr(response, attr, value) - return response - except Exception as exp: - msg = "Unable to populate response model. " - msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) - - def deserialize_data(self, data, data_type): - """Process data for deserialization according to data type. - - :param str data: The response string to be deserialized. - :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. - :return: Deserialized object. - """ - if data is None: - return data - - try: - if not data_type: - return data - if data_type in self.basic_types.values(): - return self.deserialize_basic(data, data_type) - if data_type in self.deserialize_type: - if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): - return data - - is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] - if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: - return None - data_val = self.deserialize_type[data_type](data) - return data_val - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.deserialize_type: - return self.deserialize_type[iter_type](data, data_type[1:-1]) - - obj_type = self.dependencies[data_type] - if issubclass(obj_type, Enum): - if isinstance(data, ET.Element): - data = data.text - return self.deserialize_enum(data, obj_type) - - except (ValueError, TypeError, AttributeError) as err: - msg = "Unable to deserialize response data." - msg += " Data: {}, {}".format(data, data_type) - raise_with_traceback(DeserializationError, msg, err) - else: - return self._deserialize(obj_type, data) - - def deserialize_iter(self, attr, iter_type): - """Deserialize an iterable. - - :param list attr: Iterable to be deserialized. - :param str iter_type: The type of object in the iterable. - :rtype: list - """ - if attr is None: - return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children - attr = list(attr) - if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) - return [self.deserialize_data(a, iter_type) for a in attr] - - def deserialize_dict(self, attr, dict_type): - """Deserialize a dictionary. - - :param dict/list attr: Dictionary to be deserialized. Also accepts - a list of key, value pairs. - :param str dict_type: The object type of the items in the dictionary. - :rtype: dict - """ - if isinstance(attr, list): - return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} - - if isinstance(attr, ET.Element): - # Transform value into {"Key": "value"} - attr = {el.tag: el.text for el in attr} - return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - - def deserialize_object(self, attr, **kwargs): - """Deserialize a generic object. - This will be handled as a dictionary. - - :param dict attr: Dictionary to be deserialized. - :rtype: dict - :raises: TypeError if non-builtin datatype encountered. - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - # Do no recurse on XML, just return the tree as-is - return attr - if isinstance(attr, basestring): - return self.deserialize_basic(attr, "str") - obj_type = type(attr) - if obj_type in self.basic_types: - return self.deserialize_basic(attr, self.basic_types[obj_type]) - if obj_type is _long_type: - return self.deserialize_long(attr) - - if obj_type == dict: - deserialized = {} - for key, value in attr.items(): - try: - deserialized[key] = self.deserialize_object(value, **kwargs) - except ValueError: - deserialized[key] = None - return deserialized - - if obj_type == list: - deserialized = [] - for obj in attr: - try: - deserialized.append(self.deserialize_object(obj, **kwargs)) - except ValueError: - pass - return deserialized - - else: - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) - - def deserialize_basic(self, attr, data_type): - """Deserialize basic builtin data type from string. - Will attempt to convert to str, int, float and bool. - This function will also accept '1', '0', 'true' and 'false' as - valid bool values. - - :param str attr: response string to be deserialized. - :param str data_type: deserialization data type. - :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. - """ - # If we're here, data is supposed to be a basic type. - # If it's still an XML node, take the text - if isinstance(attr, ET.Element): - attr = attr.text - if not attr: - if data_type == "str": - # None or '', node is empty string. - return "" - else: - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None - - if data_type == "bool": - if attr in [True, False, 1, 0]: - return bool(attr) - elif isinstance(attr, basestring): - if attr.lower() in ["true", "1"]: - return True - elif attr.lower() in ["false", "0"]: - return False - raise TypeError("Invalid boolean value: {}".format(attr)) - - if data_type == "str": - return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec - - @staticmethod - def deserialize_unicode(data): - """Preserve unicode objects in Python 2, otherwise return data - as a string. - - :param str data: response string to be deserialized. - :rtype: str or unicode - """ - # We might be here because we have an enum modeled as string, - # and we try to deserialize a partial dict with enum inside - if isinstance(data, Enum): - return data - - # Consider this is real string - try: - if isinstance(data, unicode): - return data - except NameError: - return str(data) - else: - return str(data) - - @staticmethod - def deserialize_enum(data, enum_obj): - """Deserialize string into enum object. - - If the string is not a valid enum value it will be returned as-is - and a warning will be logged. - - :param str data: Response string to be deserialized. If this value is - None or invalid it will be returned as-is. - :param Enum enum_obj: Enum object to deserialize to. - :rtype: Enum - """ - if isinstance(data, enum_obj) or data is None: - return data - if isinstance(data, Enum): - data = data.value - if isinstance(data, int): - # Workaround. We might consider remove it in the future. - # https://github.com/Azure/azure-rest-api-specs/issues/141 - try: - return list(enum_obj.__members__.values())[data] - except IndexError: - error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) - try: - return enum_obj(str(data)) - except ValueError: - for enum_value in enum_obj: - if enum_value.value.lower() == str(data).lower(): - return enum_value - # We don't fail anymore for unknown value, we deserialize as a string - _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) - return Deserializer.deserialize_unicode(data) - - @staticmethod - def deserialize_bytearray(attr): - """Deserialize string into bytearray. - - :param str attr: response string to be deserialized. - :rtype: bytearray - :raises: TypeError if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return bytearray(b64decode(attr)) - - @staticmethod - def deserialize_base64(attr): - """Deserialize base64 encoded string into string. - - :param str attr: response string to be deserialized. - :rtype: bytearray - :raises: TypeError if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) - attr = attr + padding - encoded = attr.replace("-", "+").replace("_", "/") - return b64decode(encoded) - - @staticmethod - def deserialize_decimal(attr): - """Deserialize string into Decimal object. - - :param str attr: response string to be deserialized. - :rtype: Decimal - :raises: DeserializationError if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - return decimal.Decimal(attr) - except decimal.DecimalException as err: - msg = "Invalid decimal {}".format(attr) - raise_with_traceback(DeserializationError, msg, err) - - @staticmethod - def deserialize_long(attr): - """Deserialize string into long (Py2) or int (Py3). - - :param str attr: response string to be deserialized. - :rtype: long or int - :raises: ValueError if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return _long_type(attr) - - @staticmethod - def deserialize_duration(attr): - """Deserialize ISO-8601 formatted string into TimeDelta object. - - :param str attr: response string to be deserialized. - :rtype: TimeDelta - :raises: DeserializationError if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - duration = isodate.parse_duration(attr) - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize duration object." - raise_with_traceback(DeserializationError, msg, err) - else: - return duration - - @staticmethod - def deserialize_date(attr): - """Deserialize ISO-8601 formatted string into Date object. - - :param str attr: response string to be deserialized. - :rtype: Date - :raises: DeserializationError if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) - - @staticmethod - def deserialize_time(attr): - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :rtype: datetime.time - :raises: DeserializationError if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - return isodate.parse_time(attr) - - @staticmethod - def deserialize_rfc(attr): - """Deserialize RFC-1123 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :rtype: Datetime - :raises: DeserializationError if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - parsed_date = email.utils.parsedate_tz(attr) - date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) - ) - if not date_obj.tzinfo: - date_obj = date_obj.astimezone(tz=TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to rfc datetime object." - raise_with_traceback(DeserializationError, msg, err) - else: - return date_obj - - @staticmethod - def deserialize_iso(attr): - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :rtype: Datetime - :raises: DeserializationError if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - attr = attr.upper() - match = Deserializer.valid_date.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize datetime object." - raise_with_traceback(DeserializationError, msg, err) - else: - return date_obj - - @staticmethod - def deserialize_unix(attr): - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param int attr: Object to be serialized. - :rtype: Datetime - :raises: DeserializationError if format invalid - """ - if isinstance(attr, ET.Element): - attr = int(attr.text) - try: - date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to unix datetime object." - raise_with_traceback(DeserializationError, msg, err) - else: - return date_obj diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_vendor.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_vendor.py deleted file mode 100644 index bc12b91166ef..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_vendor.py +++ /dev/null @@ -1,47 +0,0 @@ -# -------------------------------------------------------------------------- -# 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 abc import ABC -from typing import TYPE_CHECKING - -from azure.core.pipeline.transport import HttpRequest - -from ._configuration import MixedRealityClientConfiguration - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core import PipelineClient - - from ._serialization import Deserializer, Serializer - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) - - -class MixedRealityClientMixinABC(ABC): - """DO NOT use this class. It is for internal typing use only.""" - - _client: "PipelineClient" - _config: MixedRealityClientConfiguration - _serialize: "Serializer" - _deserialize: "Deserializer" diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_version.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_version.py deleted file mode 100644 index 653b73a4a199..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -VERSION = "1.1.0b1" diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/__init__.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/__init__.py deleted file mode 100644 index 2630af764763..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# 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 ._mixed_reality_client import MixedRealityClient - -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__ = [ - "MixedRealityClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/_configuration.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/_configuration.py deleted file mode 100644 index 729654240cc6..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/_configuration.py +++ /dev/null @@ -1,73 +0,0 @@ -# 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 sys -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, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class MixedRealityClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """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. Required. - :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). Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2021-03-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(MixedRealityClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-03-01-preview") # type: Literal["2021-03-01-preview"] - - 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.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - 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 = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/_mixed_reality_client.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/_mixed_reality_client.py deleted file mode 100644 index 528d7ecdc3e9..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/_mixed_reality_client.py +++ /dev/null @@ -1,112 +0,0 @@ -# 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 copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING - -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient - -from .. import models -from .._serialization import Deserializer, Serializer -from ._configuration import MixedRealityClientConfiguration -from .operations import ( - MixedRealityClientOperationsMixin, - ObjectAnchorsAccountsOperations, - Operations, - RemoteRenderingAccountsOperations, - SpatialAnchorsAccountsOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class MixedRealityClient(MixedRealityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword - """Mixed Reality Client. - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.mixedreality.aio.operations.Operations - :ivar spatial_anchors_accounts: SpatialAnchorsAccountsOperations operations - :vartype spatial_anchors_accounts: - azure.mgmt.mixedreality.aio.operations.SpatialAnchorsAccountsOperations - :ivar remote_rendering_accounts: RemoteRenderingAccountsOperations operations - :vartype remote_rendering_accounts: - azure.mgmt.mixedreality.aio.operations.RemoteRenderingAccountsOperations - :ivar object_anchors_accounts: ObjectAnchorsAccountsOperations operations - :vartype object_anchors_accounts: - azure.mgmt.mixedreality.aio.operations.ObjectAnchorsAccountsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :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). Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2021-03-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = MixedRealityClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) - self._client = AsyncARMPipelineClient(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._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - 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 - ) - self.object_anchors_accounts = ObjectAnchorsAccountsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "MixedRealityClient": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/_patch.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# 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 - """ diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/_vendor.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/_vendor.py deleted file mode 100644 index 8c5b3560c443..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/_vendor.py +++ /dev/null @@ -1,28 +0,0 @@ -# -------------------------------------------------------------------------- -# 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 abc import ABC -from typing import TYPE_CHECKING - -from azure.core.pipeline.transport import HttpRequest - -from ._configuration import MixedRealityClientConfiguration - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core import AsyncPipelineClient - - from .._serialization import Deserializer, Serializer - - -class MixedRealityClientMixinABC(ABC): - """DO NOT use this class. It is for internal typing use only.""" - - _client: "AsyncPipelineClient" - _config: MixedRealityClientConfiguration - _serialize: "Serializer" - _deserialize: "Deserializer" diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/__init__.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/__init__.py deleted file mode 100644 index 9e3f97a21844..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/__init__.py +++ /dev/null @@ -1,27 +0,0 @@ -# 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 ._operations import Operations -from ._mixed_reality_client_operations import MixedRealityClientOperationsMixin -from ._spatial_anchors_accounts_operations import SpatialAnchorsAccountsOperations -from ._remote_rendering_accounts_operations import RemoteRenderingAccountsOperations -from ._object_anchors_accounts_operations import ObjectAnchorsAccountsOperations - -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__ = [ - "Operations", - "MixedRealityClientOperationsMixin", - "SpatialAnchorsAccountsOperations", - "RemoteRenderingAccountsOperations", - "ObjectAnchorsAccountsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_mixed_reality_client_operations.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_mixed_reality_client_operations.py deleted file mode 100644 index 6bd0cc003bfb..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_mixed_reality_client_operations.py +++ /dev/null @@ -1,160 +0,0 @@ -# pylint: disable=too-many-lines -# 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 sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - 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.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._mixed_reality_client_operations import build_check_name_availability_local_request -from .._vendor import MixedRealityClientMixinABC - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MixedRealityClientOperationsMixin(MixedRealityClientMixinABC): - @overload - async def check_name_availability_local( - self, - location: str, - check_name_availability: _models.CheckNameAvailabilityRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CheckNameAvailabilityResponse: - """Check Name Availability for local uniqueness. - - :param location: The location in which uniqueness will be verified. Required. - :type location: str - :param check_name_availability: Check Name Availability Request. Required. - :type check_name_availability: ~azure.mgmt.mixedreality.models.CheckNameAvailabilityRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResponse or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.CheckNameAvailabilityResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_name_availability_local( - self, location: str, check_name_availability: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.CheckNameAvailabilityResponse: - """Check Name Availability for local uniqueness. - - :param location: The location in which uniqueness will be verified. Required. - :type location: str - :param check_name_availability: Check Name Availability Request. Required. - :type check_name_availability: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResponse or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.CheckNameAvailabilityResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_name_availability_local( - self, location: str, check_name_availability: Union[_models.CheckNameAvailabilityRequest, IO], **kwargs: Any - ) -> _models.CheckNameAvailabilityResponse: - """Check Name Availability for local uniqueness. - - :param location: The location in which uniqueness will be verified. Required. - :type location: str - :param check_name_availability: Check Name Availability Request. Is either a model type or a IO - type. Required. - :type check_name_availability: ~azure.mgmt.mixedreality.models.CheckNameAvailabilityRequest or - IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResponse or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.CheckNameAvailabilityResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckNameAvailabilityResponse] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(check_name_availability, (IO, bytes)): - _content = check_name_availability - else: - _json = self._serialize.body(check_name_availability, "CheckNameAvailabilityRequest") - - request = build_check_name_availability_local_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.check_name_availability_local.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - check_name_availability_local.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/locations/{location}/checkNameAvailability"} # type: ignore diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_object_anchors_accounts_operations.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_object_anchors_accounts_operations.py deleted file mode 100644 index ffed13c956b9..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_object_anchors_accounts_operations.py +++ /dev/null @@ -1,836 +0,0 @@ -# pylint: disable=too-many-lines -# 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 sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - 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 import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._object_anchors_accounts_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_list_keys_request, - build_regenerate_keys_request, - build_update_request, -) -from .._vendor import MixedRealityClientMixinABC - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ObjectAnchorsAccountsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.mixedreality.aio.MixedRealityClient`'s - :attr:`object_anchors_accounts` attribute. - """ - - models = _models - - 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_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ObjectAnchorsAccount"]: - """List Object Anchors Accounts by Subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ObjectAnchorsAccount or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.mixedreality.models.ObjectAnchorsAccount] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ObjectAnchorsAccountPage] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ObjectAnchorsAccountPage", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/objectAnchorsAccounts"} # type: ignore - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ObjectAnchorsAccount"]: - """List Resources by Resource Group. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ObjectAnchorsAccount or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.mixedreality.models.ObjectAnchorsAccount] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ObjectAnchorsAccountPage] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ObjectAnchorsAccountPage", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts"} # type: ignore - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - """Delete an Object Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}"} # type: ignore - - @distributed_trace_async - async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.ObjectAnchorsAccount: - """Retrieve an Object Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ObjectAnchorsAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.ObjectAnchorsAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ObjectAnchorsAccount] - - request = build_get_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ObjectAnchorsAccount", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}"} # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - account_name: str, - object_anchors_account: _models.ObjectAnchorsAccount, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ObjectAnchorsAccount: - """Updating an Object Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param object_anchors_account: Object Anchors Account parameter. Required. - :type object_anchors_account: ~azure.mgmt.mixedreality.models.ObjectAnchorsAccount - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ObjectAnchorsAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.ObjectAnchorsAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - account_name: str, - object_anchors_account: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ObjectAnchorsAccount: - """Updating an Object Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param object_anchors_account: Object Anchors Account parameter. Required. - :type object_anchors_account: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ObjectAnchorsAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.ObjectAnchorsAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - account_name: str, - object_anchors_account: Union[_models.ObjectAnchorsAccount, IO], - **kwargs: Any - ) -> _models.ObjectAnchorsAccount: - """Updating an Object Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param object_anchors_account: Object Anchors Account parameter. Is either a model type or a IO - type. Required. - :type object_anchors_account: ~azure.mgmt.mixedreality.models.ObjectAnchorsAccount or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ObjectAnchorsAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.ObjectAnchorsAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ObjectAnchorsAccount] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(object_anchors_account, (IO, bytes)): - _content = object_anchors_account - else: - _json = self._serialize.body(object_anchors_account, "ObjectAnchorsAccount") - - request = build_update_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ObjectAnchorsAccount", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}"} # type: ignore - - @overload - async def create( - self, - resource_group_name: str, - account_name: str, - object_anchors_account: _models.ObjectAnchorsAccount, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ObjectAnchorsAccount: - """Creating or Updating an object anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param object_anchors_account: Object Anchors Account parameter. Required. - :type object_anchors_account: ~azure.mgmt.mixedreality.models.ObjectAnchorsAccount - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ObjectAnchorsAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.ObjectAnchorsAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - resource_group_name: str, - account_name: str, - object_anchors_account: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ObjectAnchorsAccount: - """Creating or Updating an object anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param object_anchors_account: Object Anchors Account parameter. Required. - :type object_anchors_account: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ObjectAnchorsAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.ObjectAnchorsAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, - resource_group_name: str, - account_name: str, - object_anchors_account: Union[_models.ObjectAnchorsAccount, IO], - **kwargs: Any - ) -> _models.ObjectAnchorsAccount: - """Creating or Updating an object anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param object_anchors_account: Object Anchors Account parameter. Is either a model type or a IO - type. Required. - :type object_anchors_account: ~azure.mgmt.mixedreality.models.ObjectAnchorsAccount or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ObjectAnchorsAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.ObjectAnchorsAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ObjectAnchorsAccount] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(object_anchors_account, (IO, bytes)): - _content = object_anchors_account - else: - _json = self._serialize.body(object_anchors_account, "ObjectAnchorsAccount") - - request = build_create_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("ObjectAnchorsAccount", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ObjectAnchorsAccount", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}"} # type: ignore - - @distributed_trace_async - async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.AccountKeys: - """List Both of the 2 Keys of an object anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccountKeys or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.AccountKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccountKeys] - - request = build_list_keys_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_keys.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AccountKeys", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}/listKeys"} # type: ignore - - @overload - async def regenerate_keys( - self, - resource_group_name: str, - account_name: str, - regenerate: _models.AccountKeyRegenerateRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AccountKeys: - """Regenerate specified Key of an object anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param regenerate: Required information for key regeneration. Required. - :type regenerate: ~azure.mgmt.mixedreality.models.AccountKeyRegenerateRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccountKeys or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.AccountKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def regenerate_keys( - self, - resource_group_name: str, - account_name: str, - regenerate: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AccountKeys: - """Regenerate specified Key of an object anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param regenerate: Required information for key regeneration. Required. - :type regenerate: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccountKeys or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.AccountKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def regenerate_keys( - self, - resource_group_name: str, - account_name: str, - regenerate: Union[_models.AccountKeyRegenerateRequest, IO], - **kwargs: Any - ) -> _models.AccountKeys: - """Regenerate specified Key of an object anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param regenerate: Required information for key regeneration. Is either a model type or a IO - type. Required. - :type regenerate: ~azure.mgmt.mixedreality.models.AccountKeyRegenerateRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccountKeys or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.AccountKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccountKeys] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate, (IO, bytes)): - _content = regenerate - else: - _json = self._serialize.body(regenerate, "AccountKeyRegenerateRequest") - - request = build_regenerate_keys_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.regenerate_keys.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AccountKeys", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - regenerate_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}/regenerateKeys"} # type: ignore diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_operations.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_operations.py deleted file mode 100644 index e4527eda1532..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_operations.py +++ /dev/null @@ -1,139 +0,0 @@ -# pylint: disable=too-many-lines -# 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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - 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 import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._operations import build_list_request -from .._vendor import MixedRealityClientMixinABC - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.mixedreality.aio.MixedRealityClient`'s - :attr:`operations` attribute. - """ - - models = _models - - 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.Operation"]: - """Exposing Available Operations. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.mixedreality.models.Operation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationPage] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - 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) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("OperationPage", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.MixedReality/operations"} # type: ignore diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_patch.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# 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 - """ diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_remote_rendering_accounts_operations.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_remote_rendering_accounts_operations.py deleted file mode 100644 index 72f2c8597c68..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_remote_rendering_accounts_operations.py +++ /dev/null @@ -1,836 +0,0 @@ -# pylint: disable=too-many-lines -# 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 sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - 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 import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._remote_rendering_accounts_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_list_keys_request, - build_regenerate_keys_request, - build_update_request, -) -from .._vendor import MixedRealityClientMixinABC - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RemoteRenderingAccountsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.mixedreality.aio.MixedRealityClient`'s - :attr:`remote_rendering_accounts` attribute. - """ - - models = _models - - 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_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.RemoteRenderingAccount"]: - """List Remote Rendering Accounts by Subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RemoteRenderingAccount or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.mixedreality.models.RemoteRenderingAccount] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RemoteRenderingAccountPage] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("RemoteRenderingAccountPage", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/remoteRenderingAccounts"} # type: ignore - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.RemoteRenderingAccount"]: - """List Resources by Resource Group. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RemoteRenderingAccount or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.mixedreality.models.RemoteRenderingAccount] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RemoteRenderingAccountPage] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("RemoteRenderingAccountPage", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts"} # type: ignore - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - """Delete a Remote Rendering Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}"} # type: ignore - - @distributed_trace_async - async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.RemoteRenderingAccount: - """Retrieve a Remote Rendering Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RemoteRenderingAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.RemoteRenderingAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RemoteRenderingAccount] - - request = build_get_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RemoteRenderingAccount", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}"} # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - account_name: str, - remote_rendering_account: _models.RemoteRenderingAccount, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RemoteRenderingAccount: - """Updating a Remote Rendering Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param remote_rendering_account: Remote Rendering Account parameter. Required. - :type remote_rendering_account: ~azure.mgmt.mixedreality.models.RemoteRenderingAccount - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RemoteRenderingAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.RemoteRenderingAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - account_name: str, - remote_rendering_account: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RemoteRenderingAccount: - """Updating a Remote Rendering Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param remote_rendering_account: Remote Rendering Account parameter. Required. - :type remote_rendering_account: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RemoteRenderingAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.RemoteRenderingAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - account_name: str, - remote_rendering_account: Union[_models.RemoteRenderingAccount, IO], - **kwargs: Any - ) -> _models.RemoteRenderingAccount: - """Updating a Remote Rendering Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param remote_rendering_account: Remote Rendering Account parameter. Is either a model type or - a IO type. Required. - :type remote_rendering_account: ~azure.mgmt.mixedreality.models.RemoteRenderingAccount or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RemoteRenderingAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.RemoteRenderingAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RemoteRenderingAccount] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(remote_rendering_account, (IO, bytes)): - _content = remote_rendering_account - else: - _json = self._serialize.body(remote_rendering_account, "RemoteRenderingAccount") - - request = build_update_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RemoteRenderingAccount", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}"} # type: ignore - - @overload - async def create( - self, - resource_group_name: str, - account_name: str, - remote_rendering_account: _models.RemoteRenderingAccount, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RemoteRenderingAccount: - """Creating or Updating a Remote Rendering Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param remote_rendering_account: Remote Rendering Account parameter. Required. - :type remote_rendering_account: ~azure.mgmt.mixedreality.models.RemoteRenderingAccount - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RemoteRenderingAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.RemoteRenderingAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - resource_group_name: str, - account_name: str, - remote_rendering_account: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RemoteRenderingAccount: - """Creating or Updating a Remote Rendering Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param remote_rendering_account: Remote Rendering Account parameter. Required. - :type remote_rendering_account: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RemoteRenderingAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.RemoteRenderingAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, - resource_group_name: str, - account_name: str, - remote_rendering_account: Union[_models.RemoteRenderingAccount, IO], - **kwargs: Any - ) -> _models.RemoteRenderingAccount: - """Creating or Updating a Remote Rendering Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param remote_rendering_account: Remote Rendering Account parameter. Is either a model type or - a IO type. Required. - :type remote_rendering_account: ~azure.mgmt.mixedreality.models.RemoteRenderingAccount or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RemoteRenderingAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.RemoteRenderingAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RemoteRenderingAccount] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(remote_rendering_account, (IO, bytes)): - _content = remote_rendering_account - else: - _json = self._serialize.body(remote_rendering_account, "RemoteRenderingAccount") - - request = build_create_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("RemoteRenderingAccount", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("RemoteRenderingAccount", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}"} # type: ignore - - @distributed_trace_async - async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.AccountKeys: - """List Both of the 2 Keys of a Remote Rendering Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccountKeys or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.AccountKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccountKeys] - - request = build_list_keys_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_keys.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AccountKeys", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}/listKeys"} # type: ignore - - @overload - async def regenerate_keys( - self, - resource_group_name: str, - account_name: str, - regenerate: _models.AccountKeyRegenerateRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AccountKeys: - """Regenerate specified Key of a Remote Rendering Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param regenerate: Required information for key regeneration. Required. - :type regenerate: ~azure.mgmt.mixedreality.models.AccountKeyRegenerateRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccountKeys or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.AccountKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def regenerate_keys( - self, - resource_group_name: str, - account_name: str, - regenerate: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AccountKeys: - """Regenerate specified Key of a Remote Rendering Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param regenerate: Required information for key regeneration. Required. - :type regenerate: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccountKeys or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.AccountKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def regenerate_keys( - self, - resource_group_name: str, - account_name: str, - regenerate: Union[_models.AccountKeyRegenerateRequest, IO], - **kwargs: Any - ) -> _models.AccountKeys: - """Regenerate specified Key of a Remote Rendering Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param regenerate: Required information for key regeneration. Is either a model type or a IO - type. Required. - :type regenerate: ~azure.mgmt.mixedreality.models.AccountKeyRegenerateRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccountKeys or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.AccountKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccountKeys] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate, (IO, bytes)): - _content = regenerate - else: - _json = self._serialize.body(regenerate, "AccountKeyRegenerateRequest") - - request = build_regenerate_keys_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.regenerate_keys.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AccountKeys", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - regenerate_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}/regenerateKeys"} # type: ignore diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_spatial_anchors_accounts_operations.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_spatial_anchors_accounts_operations.py deleted file mode 100644 index 786fe4b026c9..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/aio/operations/_spatial_anchors_accounts_operations.py +++ /dev/null @@ -1,836 +0,0 @@ -# pylint: disable=too-many-lines -# 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 sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - 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 import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._spatial_anchors_accounts_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_list_keys_request, - build_regenerate_keys_request, - build_update_request, -) -from .._vendor import MixedRealityClientMixinABC - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SpatialAnchorsAccountsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.mixedreality.aio.MixedRealityClient`'s - :attr:`spatial_anchors_accounts` attribute. - """ - - models = _models - - 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_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SpatialAnchorsAccount"]: - """List Spatial Anchors Accounts by Subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SpatialAnchorsAccount or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.mixedreality.models.SpatialAnchorsAccount] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SpatialAnchorsAccountPage] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("SpatialAnchorsAccountPage", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/spatialAnchorsAccounts"} # type: ignore - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SpatialAnchorsAccount"]: - """List Resources by Resource Group. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SpatialAnchorsAccount or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.mixedreality.models.SpatialAnchorsAccount] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SpatialAnchorsAccountPage] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("SpatialAnchorsAccountPage", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts"} # type: ignore - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - """Delete a Spatial Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}"} # type: ignore - - @distributed_trace_async - async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.SpatialAnchorsAccount: - """Retrieve a Spatial Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SpatialAnchorsAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.SpatialAnchorsAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SpatialAnchorsAccount] - - request = build_get_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SpatialAnchorsAccount", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}"} # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - account_name: str, - spatial_anchors_account: _models.SpatialAnchorsAccount, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SpatialAnchorsAccount: - """Updating a Spatial Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param spatial_anchors_account: Spatial Anchors Account parameter. Required. - :type spatial_anchors_account: ~azure.mgmt.mixedreality.models.SpatialAnchorsAccount - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SpatialAnchorsAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.SpatialAnchorsAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - account_name: str, - spatial_anchors_account: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SpatialAnchorsAccount: - """Updating a Spatial Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param spatial_anchors_account: Spatial Anchors Account parameter. Required. - :type spatial_anchors_account: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SpatialAnchorsAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.SpatialAnchorsAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - account_name: str, - spatial_anchors_account: Union[_models.SpatialAnchorsAccount, IO], - **kwargs: Any - ) -> _models.SpatialAnchorsAccount: - """Updating a Spatial Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param spatial_anchors_account: Spatial Anchors Account parameter. Is either a model type or a - IO type. Required. - :type spatial_anchors_account: ~azure.mgmt.mixedreality.models.SpatialAnchorsAccount or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SpatialAnchorsAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.SpatialAnchorsAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SpatialAnchorsAccount] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(spatial_anchors_account, (IO, bytes)): - _content = spatial_anchors_account - else: - _json = self._serialize.body(spatial_anchors_account, "SpatialAnchorsAccount") - - request = build_update_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SpatialAnchorsAccount", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}"} # type: ignore - - @overload - async def create( - self, - resource_group_name: str, - account_name: str, - spatial_anchors_account: _models.SpatialAnchorsAccount, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SpatialAnchorsAccount: - """Creating or Updating a Spatial Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param spatial_anchors_account: Spatial Anchors Account parameter. Required. - :type spatial_anchors_account: ~azure.mgmt.mixedreality.models.SpatialAnchorsAccount - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SpatialAnchorsAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.SpatialAnchorsAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - resource_group_name: str, - account_name: str, - spatial_anchors_account: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SpatialAnchorsAccount: - """Creating or Updating a Spatial Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param spatial_anchors_account: Spatial Anchors Account parameter. Required. - :type spatial_anchors_account: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SpatialAnchorsAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.SpatialAnchorsAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, - resource_group_name: str, - account_name: str, - spatial_anchors_account: Union[_models.SpatialAnchorsAccount, IO], - **kwargs: Any - ) -> _models.SpatialAnchorsAccount: - """Creating or Updating a Spatial Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param spatial_anchors_account: Spatial Anchors Account parameter. Is either a model type or a - IO type. Required. - :type spatial_anchors_account: ~azure.mgmt.mixedreality.models.SpatialAnchorsAccount or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SpatialAnchorsAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.SpatialAnchorsAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SpatialAnchorsAccount] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(spatial_anchors_account, (IO, bytes)): - _content = spatial_anchors_account - else: - _json = self._serialize.body(spatial_anchors_account, "SpatialAnchorsAccount") - - request = build_create_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("SpatialAnchorsAccount", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SpatialAnchorsAccount", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}"} # type: ignore - - @distributed_trace_async - async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.AccountKeys: - """List Both of the 2 Keys of a Spatial Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccountKeys or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.AccountKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccountKeys] - - request = build_list_keys_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_keys.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AccountKeys", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}/listKeys"} # type: ignore - - @overload - async def regenerate_keys( - self, - resource_group_name: str, - account_name: str, - regenerate: _models.AccountKeyRegenerateRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AccountKeys: - """Regenerate specified Key of a Spatial Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param regenerate: Required information for key regeneration. Required. - :type regenerate: ~azure.mgmt.mixedreality.models.AccountKeyRegenerateRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccountKeys or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.AccountKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def regenerate_keys( - self, - resource_group_name: str, - account_name: str, - regenerate: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AccountKeys: - """Regenerate specified Key of a Spatial Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param regenerate: Required information for key regeneration. Required. - :type regenerate: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccountKeys or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.AccountKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def regenerate_keys( - self, - resource_group_name: str, - account_name: str, - regenerate: Union[_models.AccountKeyRegenerateRequest, IO], - **kwargs: Any - ) -> _models.AccountKeys: - """Regenerate specified Key of a Spatial Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param regenerate: Required information for key regeneration. Is either a model type or a IO - type. Required. - :type regenerate: ~azure.mgmt.mixedreality.models.AccountKeyRegenerateRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccountKeys or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.AccountKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccountKeys] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate, (IO, bytes)): - _content = regenerate - else: - _json = self._serialize.body(regenerate, "AccountKeyRegenerateRequest") - - request = build_regenerate_keys_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.regenerate_keys.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AccountKeys", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - regenerate_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}/regenerateKeys"} # type: ignore diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/models/__init__.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/models/__init__.py deleted file mode 100644 index e0000a9e5e2b..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/models/__init__.py +++ /dev/null @@ -1,75 +0,0 @@ -# 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 ._models_py3 import AccountKeyRegenerateRequest -from ._models_py3 import AccountKeys -from ._models_py3 import CheckNameAvailabilityRequest -from ._models_py3 import CheckNameAvailabilityResponse -from ._models_py3 import CloudErrorBody -from ._models_py3 import Identity -from ._models_py3 import LogSpecification -from ._models_py3 import MetricDimension -from ._models_py3 import MetricSpecification -from ._models_py3 import ObjectAnchorsAccount -from ._models_py3 import ObjectAnchorsAccountIdentity -from ._models_py3 import ObjectAnchorsAccountPage -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationPage -from ._models_py3 import OperationProperties -from ._models_py3 import RemoteRenderingAccount -from ._models_py3 import RemoteRenderingAccountPage -from ._models_py3 import Resource -from ._models_py3 import ServiceSpecification -from ._models_py3 import Sku -from ._models_py3 import SpatialAnchorsAccount -from ._models_py3 import SpatialAnchorsAccountPage -from ._models_py3 import SystemData -from ._models_py3 import TrackedResource - -from ._mixed_reality_client_enums import CreatedByType -from ._mixed_reality_client_enums import NameUnavailableReason -from ._mixed_reality_client_enums import Serial -from ._mixed_reality_client_enums import SkuTier -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__ = [ - "AccountKeyRegenerateRequest", - "AccountKeys", - "CheckNameAvailabilityRequest", - "CheckNameAvailabilityResponse", - "CloudErrorBody", - "Identity", - "LogSpecification", - "MetricDimension", - "MetricSpecification", - "ObjectAnchorsAccount", - "ObjectAnchorsAccountIdentity", - "ObjectAnchorsAccountPage", - "Operation", - "OperationDisplay", - "OperationPage", - "OperationProperties", - "RemoteRenderingAccount", - "RemoteRenderingAccountPage", - "Resource", - "ServiceSpecification", - "Sku", - "SpatialAnchorsAccount", - "SpatialAnchorsAccountPage", - "SystemData", - "TrackedResource", - "CreatedByType", - "NameUnavailableReason", - "Serial", - "SkuTier", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/models/_mixed_reality_client_enums.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/models/_mixed_reality_client_enums.py deleted file mode 100644 index 584ff3787dd7..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/models/_mixed_reality_client_enums.py +++ /dev/null @@ -1,46 +0,0 @@ -# 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 enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class NameUnavailableReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """reason of name unavailable.""" - - INVALID = "Invalid" - ALREADY_EXISTS = "AlreadyExists" - - -class Serial(int, Enum, metaclass=CaseInsensitiveEnumMeta): - """Serial of key to be regenerated.""" - - #: The Primary Key - PRIMARY = 1 - #: The Secondary Key - SECONDARY = 2 - - -class SkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """This field is required to be implemented by the Resource Provider if the service has more than - one tier, but is not required on a PUT. - """ - - FREE = "Free" - BASIC = "Basic" - STANDARD = "Standard" - PREMIUM = "Premium" diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/models/_models_py3.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/models/_models_py3.py deleted file mode 100644 index f4209949aaad..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/models/_models_py3.py +++ /dev/null @@ -1,1284 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# 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 datetime -import sys -from typing import Dict, List, Optional, TYPE_CHECKING, Union - -from .. import _serialization - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models - - -class AccountKeyRegenerateRequest(_serialization.Model): - """Request for account key regeneration. - - :ivar serial: Serial of key to be regenerated. Known values are: 1 and 2. - :vartype serial: int or ~azure.mgmt.mixedreality.models.Serial - """ - - _attribute_map = { - "serial": {"key": "serial", "type": "int"}, - } - - def __init__(self, *, serial: Union[int, "_models.Serial"] = 1, **kwargs): - """ - :keyword serial: Serial of key to be regenerated. Known values are: 1 and 2. - :paramtype serial: int or ~azure.mgmt.mixedreality.models.Serial - """ - super().__init__(**kwargs) - self.serial = serial - - -class AccountKeys(_serialization.Model): - """Developer Keys of account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar primary_key: value of primary key. - :vartype primary_key: str - :ivar secondary_key: value of secondary key. - :vartype secondary_key: str - """ - - _validation = { - "primary_key": {"readonly": True}, - "secondary_key": {"readonly": True}, - } - - _attribute_map = { - "primary_key": {"key": "primaryKey", "type": "str"}, - "secondary_key": {"key": "secondaryKey", "type": "str"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.primary_key = None - self.secondary_key = None - - -class CheckNameAvailabilityRequest(_serialization.Model): - """Check Name Availability Request. - - All required parameters must be populated in order to send to Azure. - - :ivar name: Resource Name To Verify. Required. - :vartype name: str - :ivar type: Fully qualified resource type which includes provider namespace. Required. - :vartype type: str - """ - - _validation = { - "name": {"required": True}, - "type": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, *, name: str, type: str, **kwargs): - """ - :keyword name: Resource Name To Verify. Required. - :paramtype name: str - :keyword type: Fully qualified resource type which includes provider namespace. Required. - :paramtype type: str - """ - super().__init__(**kwargs) - self.name = name - self.type = type - - -class CheckNameAvailabilityResponse(_serialization.Model): - """Check Name Availability Response. - - All required parameters must be populated in order to send to Azure. - - :ivar name_available: if name Available. Required. - :vartype name_available: bool - :ivar reason: Resource Name To Verify. Known values are: "Invalid" and "AlreadyExists". - :vartype reason: str or ~azure.mgmt.mixedreality.models.NameUnavailableReason - :ivar message: detail message. - :vartype message: str - """ - - _validation = { - "name_available": {"required": True}, - } - - _attribute_map = { - "name_available": {"key": "nameAvailable", "type": "bool"}, - "reason": {"key": "reason", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__( - self, - *, - name_available: bool, - reason: Optional[Union[str, "_models.NameUnavailableReason"]] = None, - message: Optional[str] = None, - **kwargs - ): - """ - :keyword name_available: if name Available. Required. - :paramtype name_available: bool - :keyword reason: Resource Name To Verify. Known values are: "Invalid" and "AlreadyExists". - :paramtype reason: str or ~azure.mgmt.mixedreality.models.NameUnavailableReason - :keyword message: detail message. - :paramtype message: str - """ - super().__init__(**kwargs) - self.name_available = name_available - self.reason = reason - self.message = message - - -class CloudErrorBody(_serialization.Model): - """An error response from Azure. - - :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :vartype code: str - :ivar message: A message describing the error, intended to be suitable for displaying in a user - interface. - :vartype message: str - :ivar target: The target of the particular error. For example, the name of the property in - error. - :vartype target: str - :ivar details: A list of additional details about the error. - :vartype details: list[~azure.mgmt.mixedreality.models.CloudErrorBody] - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[CloudErrorBody]"}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["_models.CloudErrorBody"]] = None, - **kwargs - ): - """ - :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :paramtype code: str - :keyword message: A message describing the error, intended to be suitable for displaying in a - user interface. - :paramtype message: str - :keyword target: The target of the particular error. For example, the name of the property in - error. - :paramtype target: str - :keyword details: A list of additional details about the error. - :paramtype details: list[~azure.mgmt.mixedreality.models.CloudErrorBody] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class Identity(_serialization.Model): - """Identity for the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :ivar type: The identity type. Default value is "SystemAssigned". - :vartype type: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs): - """ - :keyword type: The identity type. Default value is "SystemAssigned". - :paramtype type: str - """ - super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = type - - -class LogSpecification(_serialization.Model): - """Specifications of the Log for Azure Monitoring. - - :ivar name: Name of the log. - :vartype name: str - :ivar display_name: Localized friendly display name of the log. - :vartype display_name: str - :ivar blob_duration: Blob duration of the log. - :vartype blob_duration: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "blob_duration": {"key": "blobDuration", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display_name: Optional[str] = None, - blob_duration: Optional[str] = None, - **kwargs - ): - """ - :keyword name: Name of the log. - :paramtype name: str - :keyword display_name: Localized friendly display name of the log. - :paramtype display_name: str - :keyword blob_duration: Blob duration of the log. - :paramtype blob_duration: str - """ - super().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.blob_duration = blob_duration - - -class MetricDimension(_serialization.Model): - """Specifications of the Dimension of metrics. - - :ivar name: Name of the dimension. - :vartype name: str - :ivar display_name: Localized friendly display name of the dimension. - :vartype display_name: str - :ivar internal_name: Internal name of the dimension. - :vartype internal_name: str - :ivar to_be_exported_for_shoebox: Flag to indicate export for Shoebox. - :vartype to_be_exported_for_shoebox: bool - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "internal_name": {"key": "internalName", "type": "str"}, - "to_be_exported_for_shoebox": {"key": "toBeExportedForShoebox", "type": "bool"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display_name: Optional[str] = None, - internal_name: Optional[str] = None, - to_be_exported_for_shoebox: Optional[bool] = None, - **kwargs - ): - """ - :keyword name: Name of the dimension. - :paramtype name: str - :keyword display_name: Localized friendly display name of the dimension. - :paramtype display_name: str - :keyword internal_name: Internal name of the dimension. - :paramtype internal_name: str - :keyword to_be_exported_for_shoebox: Flag to indicate export for Shoebox. - :paramtype to_be_exported_for_shoebox: bool - """ - super().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.internal_name = internal_name - self.to_be_exported_for_shoebox = to_be_exported_for_shoebox - - -class MetricSpecification(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Specifications of the Metrics for Azure Monitoring. - - :ivar name: Name of the metric. - :vartype name: str - :ivar display_name: Localized friendly display name of the metric. - :vartype display_name: str - :ivar display_description: Localized friendly description of the metric. - :vartype display_description: str - :ivar unit: Unit that makes sense for the metric. - :vartype unit: str - :ivar aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, - Maximum, Total, Count. - :vartype aggregation_type: str - :ivar supported_aggregation_types: Supported aggregation types. Valid values: Average, Minimum, - Maximum, Total, Count. - :vartype supported_aggregation_types: list[str] - :ivar supported_time_grain_types: Supported time grains. Valid values: PT1M, PT5M, PT15M, - PT30M, PT1H, PT6H, PT12H, P1D. - :vartype supported_time_grain_types: list[str] - :ivar enable_regional_mdm_account: Flag to indicate use of regional Mdm accounts. - :vartype enable_regional_mdm_account: bool - :ivar source_mdm_account: Source mdm account. - :vartype source_mdm_account: str - :ivar source_mdm_namespace: Source mdm namespace. - :vartype source_mdm_namespace: str - :ivar metric_filter_pattern: Metric filter regex pattern. - :vartype metric_filter_pattern: str - :ivar fill_gap_with_zero: Flag to determine is Zero is returned for time duration where no - metric is emitted. - :vartype fill_gap_with_zero: bool - :ivar category: Metric category. - :vartype category: str - :ivar internal_metric_name: Internal metric name. - :vartype internal_metric_name: str - :ivar dimensions: Dimensions of the metric. - :vartype dimensions: list[~azure.mgmt.mixedreality.models.MetricDimension] - :ivar locked_aggregation_type: Locked aggregation type of the metric. - :vartype locked_aggregation_type: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "display_description": {"key": "displayDescription", "type": "str"}, - "unit": {"key": "unit", "type": "str"}, - "aggregation_type": {"key": "aggregationType", "type": "str"}, - "supported_aggregation_types": {"key": "supportedAggregationTypes", "type": "[str]"}, - "supported_time_grain_types": {"key": "supportedTimeGrainTypes", "type": "[str]"}, - "enable_regional_mdm_account": {"key": "enableRegionalMdmAccount", "type": "bool"}, - "source_mdm_account": {"key": "sourceMdmAccount", "type": "str"}, - "source_mdm_namespace": {"key": "sourceMdmNamespace", "type": "str"}, - "metric_filter_pattern": {"key": "metricFilterPattern", "type": "str"}, - "fill_gap_with_zero": {"key": "fillGapWithZero", "type": "bool"}, - "category": {"key": "category", "type": "str"}, - "internal_metric_name": {"key": "internalMetricName", "type": "str"}, - "dimensions": {"key": "dimensions", "type": "[MetricDimension]"}, - "locked_aggregation_type": {"key": "lockedAggregationType", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display_name: Optional[str] = None, - display_description: Optional[str] = None, - unit: Optional[str] = None, - aggregation_type: Optional[str] = None, - supported_aggregation_types: Optional[List[str]] = None, - supported_time_grain_types: Optional[List[str]] = None, - enable_regional_mdm_account: Optional[bool] = None, - source_mdm_account: Optional[str] = None, - source_mdm_namespace: Optional[str] = None, - metric_filter_pattern: Optional[str] = None, - fill_gap_with_zero: Optional[bool] = None, - category: Optional[str] = None, - internal_metric_name: Optional[str] = None, - dimensions: Optional[List["_models.MetricDimension"]] = None, - locked_aggregation_type: Optional[str] = None, - **kwargs - ): - """ - :keyword name: Name of the metric. - :paramtype name: str - :keyword display_name: Localized friendly display name of the metric. - :paramtype display_name: str - :keyword display_description: Localized friendly description of the metric. - :paramtype display_description: str - :keyword unit: Unit that makes sense for the metric. - :paramtype unit: str - :keyword aggregation_type: Only provide one value for this field. Valid values: Average, - Minimum, Maximum, Total, Count. - :paramtype aggregation_type: str - :keyword supported_aggregation_types: Supported aggregation types. Valid values: Average, - Minimum, Maximum, Total, Count. - :paramtype supported_aggregation_types: list[str] - :keyword supported_time_grain_types: Supported time grains. Valid values: PT1M, PT5M, PT15M, - PT30M, PT1H, PT6H, PT12H, P1D. - :paramtype supported_time_grain_types: list[str] - :keyword enable_regional_mdm_account: Flag to indicate use of regional Mdm accounts. - :paramtype enable_regional_mdm_account: bool - :keyword source_mdm_account: Source mdm account. - :paramtype source_mdm_account: str - :keyword source_mdm_namespace: Source mdm namespace. - :paramtype source_mdm_namespace: str - :keyword metric_filter_pattern: Metric filter regex pattern. - :paramtype metric_filter_pattern: str - :keyword fill_gap_with_zero: Flag to determine is Zero is returned for time duration where no - metric is emitted. - :paramtype fill_gap_with_zero: bool - :keyword category: Metric category. - :paramtype category: str - :keyword internal_metric_name: Internal metric name. - :paramtype internal_metric_name: str - :keyword dimensions: Dimensions of the metric. - :paramtype dimensions: list[~azure.mgmt.mixedreality.models.MetricDimension] - :keyword locked_aggregation_type: Locked aggregation type of the metric. - :paramtype locked_aggregation_type: str - """ - super().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.display_description = display_description - self.unit = unit - self.aggregation_type = aggregation_type - self.supported_aggregation_types = supported_aggregation_types - self.supported_time_grain_types = supported_time_grain_types - self.enable_regional_mdm_account = enable_regional_mdm_account - self.source_mdm_account = source_mdm_account - self.source_mdm_namespace = source_mdm_namespace - self.metric_filter_pattern = metric_filter_pattern - self.fill_gap_with_zero = fill_gap_with_zero - self.category = category - self.internal_metric_name = internal_metric_name - self.dimensions = dimensions - self.locked_aggregation_type = locked_aggregation_type - - -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - """ - super().__init__(**kwargs) - self.tags = tags - self.location = location - - -class ObjectAnchorsAccount(TrackedResource): # pylint: disable=too-many-instance-attributes - """ObjectAnchorsAccount Response. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar identity: - :vartype identity: ~azure.mgmt.mixedreality.models.ObjectAnchorsAccountIdentity - :ivar plan: The plan associated with this account. - :vartype plan: ~azure.mgmt.mixedreality.models.Identity - :ivar sku: The sku associated with this account. - :vartype sku: ~azure.mgmt.mixedreality.models.Sku - :ivar kind: The kind of account, if supported. - :vartype kind: ~azure.mgmt.mixedreality.models.Sku - :ivar system_data: The system metadata related to an object anchors account. - :vartype system_data: ~azure.mgmt.mixedreality.models.SystemData - :ivar storage_account_name: The name of the storage account associated with this accountId. - :vartype storage_account_name: str - :ivar account_id: unique id of certain account. - :vartype account_id: str - :ivar account_domain: Correspond domain name of certain Spatial Anchors Account. - :vartype account_domain: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "system_data": {"readonly": True}, - "account_id": {"readonly": True}, - "account_domain": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "identity": {"key": "identity", "type": "ObjectAnchorsAccountIdentity"}, - "plan": {"key": "plan", "type": "Identity"}, - "sku": {"key": "sku", "type": "Sku"}, - "kind": {"key": "kind", "type": "Sku"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "storage_account_name": {"key": "properties.storageAccountName", "type": "str"}, - "account_id": {"key": "properties.accountId", "type": "str"}, - "account_domain": {"key": "properties.accountDomain", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ObjectAnchorsAccountIdentity"] = None, - plan: Optional["_models.Identity"] = None, - sku: Optional["_models.Sku"] = None, - kind: Optional["_models.Sku"] = None, - storage_account_name: Optional[str] = None, - **kwargs - ): - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword identity: - :paramtype identity: ~azure.mgmt.mixedreality.models.ObjectAnchorsAccountIdentity - :keyword plan: The plan associated with this account. - :paramtype plan: ~azure.mgmt.mixedreality.models.Identity - :keyword sku: The sku associated with this account. - :paramtype sku: ~azure.mgmt.mixedreality.models.Sku - :keyword kind: The kind of account, if supported. - :paramtype kind: ~azure.mgmt.mixedreality.models.Sku - :keyword storage_account_name: The name of the storage account associated with this accountId. - :paramtype storage_account_name: str - """ - super().__init__(tags=tags, location=location, **kwargs) - self.identity = identity - self.plan = plan - self.sku = sku - self.kind = kind - self.system_data = None - self.storage_account_name = storage_account_name - self.account_id = None - self.account_domain = None - - -class ObjectAnchorsAccountIdentity(Identity): - """ObjectAnchorsAccountIdentity. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :ivar type: The identity type. Default value is "SystemAssigned". - :vartype type: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs): - """ - :keyword type: The identity type. Default value is "SystemAssigned". - :paramtype type: str - """ - super().__init__(type=type, **kwargs) - - -class ObjectAnchorsAccountPage(_serialization.Model): - """Result of the request to get resource collection. It contains a list of resources and a URL link to get the next set of results. - - :ivar value: List of resources supported by the Resource Provider. - :vartype value: list[~azure.mgmt.mixedreality.models.ObjectAnchorsAccount] - :ivar next_link: URL to get the next set of resource list results if there are any. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ObjectAnchorsAccount]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ObjectAnchorsAccount"]] = None, next_link: Optional[str] = None, **kwargs - ): - """ - :keyword value: List of resources supported by the Resource Provider. - :paramtype value: list[~azure.mgmt.mixedreality.models.ObjectAnchorsAccount] - :keyword next_link: URL to get the next set of resource list results if there are any. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class Operation(_serialization.Model): - """REST API operation. - - :ivar name: Operation name: {provider}/{resource}/{operation}. - :vartype name: str - :ivar display: The object that represents the operation. - :vartype display: ~azure.mgmt.mixedreality.models.OperationDisplay - :ivar is_data_action: Whether or not this is a data plane operation. - :vartype is_data_action: bool - :ivar origin: The origin. - :vartype origin: str - :ivar properties: Properties of the operation. - :vartype properties: ~azure.mgmt.mixedreality.models.OperationProperties - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display": {"key": "display", "type": "OperationDisplay"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, - "origin": {"key": "origin", "type": "str"}, - "properties": {"key": "properties", "type": "OperationProperties"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display: Optional["_models.OperationDisplay"] = None, - is_data_action: Optional[bool] = None, - origin: Optional[str] = None, - properties: Optional["_models.OperationProperties"] = None, - **kwargs - ): - """ - :keyword name: Operation name: {provider}/{resource}/{operation}. - :paramtype name: str - :keyword display: The object that represents the operation. - :paramtype display: ~azure.mgmt.mixedreality.models.OperationDisplay - :keyword is_data_action: Whether or not this is a data plane operation. - :paramtype is_data_action: bool - :keyword origin: The origin. - :paramtype origin: str - :keyword properties: Properties of the operation. - :paramtype properties: ~azure.mgmt.mixedreality.models.OperationProperties - """ - super().__init__(**kwargs) - self.name = name - self.display = display - self.is_data_action = is_data_action - self.origin = origin - self.properties = properties - - -class OperationDisplay(_serialization.Model): - """The object that represents the operation. - - All required parameters must be populated in order to send to Azure. - - :ivar provider: Service provider: Microsoft.ResourceProvider. Required. - :vartype provider: str - :ivar resource: Resource on which the operation is performed: Profile, endpoint, etc. Required. - :vartype resource: str - :ivar operation: Operation type: Read, write, delete, etc. Required. - :vartype operation: str - :ivar description: Description of operation. Required. - :vartype description: str - """ - - _validation = { - "provider": {"required": True}, - "resource": {"required": True}, - "operation": {"required": True}, - "description": {"required": True}, - } - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__(self, *, provider: str, resource: str, operation: str, description: str, **kwargs): - """ - :keyword provider: Service provider: Microsoft.ResourceProvider. Required. - :paramtype provider: str - :keyword resource: Resource on which the operation is performed: Profile, endpoint, etc. - Required. - :paramtype resource: str - :keyword operation: Operation type: Read, write, delete, etc. Required. - :paramtype operation: str - :keyword description: Description of operation. Required. - :paramtype description: str - """ - super().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationPage(_serialization.Model): - """Result of the request to list Resource Provider operations. It contains a list of operations and a URL link to get the next set of results. - - :ivar value: List of operations supported by the Resource Provider. - :vartype value: list[~azure.mgmt.mixedreality.models.Operation] - :ivar next_link: URL to get the next set of operation list results if there are any. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs): - """ - :keyword value: List of operations supported by the Resource Provider. - :paramtype value: list[~azure.mgmt.mixedreality.models.Operation] - :keyword next_link: URL to get the next set of operation list results if there are any. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class OperationProperties(_serialization.Model): - """Operation properties. - - :ivar service_specification: Service specification. - :vartype service_specification: ~azure.mgmt.mixedreality.models.ServiceSpecification - """ - - _attribute_map = { - "service_specification": {"key": "serviceSpecification", "type": "ServiceSpecification"}, - } - - def __init__(self, *, service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs): - """ - :keyword service_specification: Service specification. - :paramtype service_specification: ~azure.mgmt.mixedreality.models.ServiceSpecification - """ - super().__init__(**kwargs) - self.service_specification = service_specification - - -class RemoteRenderingAccount(TrackedResource): # pylint: disable=too-many-instance-attributes - """RemoteRenderingAccount Response. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar identity: The identity associated with this account. - :vartype identity: ~azure.mgmt.mixedreality.models.Identity - :ivar plan: The plan associated with this account. - :vartype plan: ~azure.mgmt.mixedreality.models.Identity - :ivar sku: The sku associated with this account. - :vartype sku: ~azure.mgmt.mixedreality.models.Sku - :ivar kind: The kind of account, if supported. - :vartype kind: ~azure.mgmt.mixedreality.models.Sku - :ivar system_data: System metadata for this account. - :vartype system_data: ~azure.mgmt.mixedreality.models.SystemData - :ivar storage_account_name: The name of the storage account associated with this accountId. - :vartype storage_account_name: str - :ivar account_id: unique id of certain account. - :vartype account_id: str - :ivar account_domain: Correspond domain name of certain Spatial Anchors Account. - :vartype account_domain: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "system_data": {"readonly": True}, - "account_id": {"readonly": True}, - "account_domain": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "identity": {"key": "identity", "type": "Identity"}, - "plan": {"key": "plan", "type": "Identity"}, - "sku": {"key": "sku", "type": "Sku"}, - "kind": {"key": "kind", "type": "Sku"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "storage_account_name": {"key": "properties.storageAccountName", "type": "str"}, - "account_id": {"key": "properties.accountId", "type": "str"}, - "account_domain": {"key": "properties.accountDomain", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.Identity"] = None, - plan: Optional["_models.Identity"] = None, - sku: Optional["_models.Sku"] = None, - kind: Optional["_models.Sku"] = None, - storage_account_name: Optional[str] = None, - **kwargs - ): - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword identity: The identity associated with this account. - :paramtype identity: ~azure.mgmt.mixedreality.models.Identity - :keyword plan: The plan associated with this account. - :paramtype plan: ~azure.mgmt.mixedreality.models.Identity - :keyword sku: The sku associated with this account. - :paramtype sku: ~azure.mgmt.mixedreality.models.Sku - :keyword kind: The kind of account, if supported. - :paramtype kind: ~azure.mgmt.mixedreality.models.Sku - :keyword storage_account_name: The name of the storage account associated with this accountId. - :paramtype storage_account_name: str - """ - super().__init__(tags=tags, location=location, **kwargs) - self.identity = identity - self.plan = plan - self.sku = sku - self.kind = kind - self.system_data = None - self.storage_account_name = storage_account_name - self.account_id = None - self.account_domain = None - - -class RemoteRenderingAccountPage(_serialization.Model): - """Result of the request to get resource collection. It contains a list of resources and a URL link to get the next set of results. - - :ivar value: List of resources supported by the Resource Provider. - :vartype value: list[~azure.mgmt.mixedreality.models.RemoteRenderingAccount] - :ivar next_link: URL to get the next set of resource list results if there are any. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[RemoteRenderingAccount]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.RemoteRenderingAccount"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: List of resources supported by the Resource Provider. - :paramtype value: list[~azure.mgmt.mixedreality.models.RemoteRenderingAccount] - :keyword next_link: URL to get the next set of resource list results if there are any. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceSpecification(_serialization.Model): - """Service specification payload. - - :ivar log_specifications: Specifications of the Log for Azure Monitoring. - :vartype log_specifications: list[~azure.mgmt.mixedreality.models.LogSpecification] - :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. - :vartype metric_specifications: list[~azure.mgmt.mixedreality.models.MetricSpecification] - """ - - _attribute_map = { - "log_specifications": {"key": "logSpecifications", "type": "[LogSpecification]"}, - "metric_specifications": {"key": "metricSpecifications", "type": "[MetricSpecification]"}, - } - - def __init__( - self, - *, - log_specifications: Optional[List["_models.LogSpecification"]] = None, - metric_specifications: Optional[List["_models.MetricSpecification"]] = None, - **kwargs - ): - """ - :keyword log_specifications: Specifications of the Log for Azure Monitoring. - :paramtype log_specifications: list[~azure.mgmt.mixedreality.models.LogSpecification] - :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. - :paramtype metric_specifications: list[~azure.mgmt.mixedreality.models.MetricSpecification] - """ - super().__init__(**kwargs) - self.log_specifications = log_specifications - self.metric_specifications = metric_specifications - - -class Sku(_serialization.Model): - """The resource model definition representing SKU. - - All required parameters must be populated in order to send to Azure. - - :ivar name: The name of the SKU. Ex - P3. It is typically a letter+number code. Required. - :vartype name: str - :ivar tier: This field is required to be implemented by the Resource Provider if the service - has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic", - "Standard", and "Premium". - :vartype tier: str or ~azure.mgmt.mixedreality.models.SkuTier - :ivar size: The SKU size. When the name field is the combination of tier and some other value, - this would be the standalone code. - :vartype size: str - :ivar family: If the service has different generations of hardware, for the same SKU, then that - can be captured here. - :vartype family: str - :ivar capacity: If the SKU supports scale out/in then the capacity integer should be included. - If scale out/in is not possible for the resource this may be omitted. - :vartype capacity: int - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "tier": {"key": "tier", "type": "str"}, - "size": {"key": "size", "type": "str"}, - "family": {"key": "family", "type": "str"}, - "capacity": {"key": "capacity", "type": "int"}, - } - - def __init__( - self, - *, - name: str, - tier: Optional[Union[str, "_models.SkuTier"]] = None, - size: Optional[str] = None, - family: Optional[str] = None, - capacity: Optional[int] = None, - **kwargs - ): - """ - :keyword name: The name of the SKU. Ex - P3. It is typically a letter+number code. Required. - :paramtype name: str - :keyword tier: This field is required to be implemented by the Resource Provider if the service - has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic", - "Standard", and "Premium". - :paramtype tier: str or ~azure.mgmt.mixedreality.models.SkuTier - :keyword size: The SKU size. When the name field is the combination of tier and some other - value, this would be the standalone code. - :paramtype size: str - :keyword family: If the service has different generations of hardware, for the same SKU, then - that can be captured here. - :paramtype family: str - :keyword capacity: If the SKU supports scale out/in then the capacity integer should be - included. If scale out/in is not possible for the resource this may be omitted. - :paramtype capacity: int - """ - super().__init__(**kwargs) - self.name = name - self.tier = tier - self.size = size - self.family = family - self.capacity = capacity - - -class SpatialAnchorsAccount(TrackedResource): # pylint: disable=too-many-instance-attributes - """SpatialAnchorsAccount Response. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar identity: The identity associated with this account. - :vartype identity: ~azure.mgmt.mixedreality.models.Identity - :ivar plan: The plan associated with this account. - :vartype plan: ~azure.mgmt.mixedreality.models.Identity - :ivar sku: The sku associated with this account. - :vartype sku: ~azure.mgmt.mixedreality.models.Sku - :ivar kind: The kind of account, if supported. - :vartype kind: ~azure.mgmt.mixedreality.models.Sku - :ivar system_data: System metadata for this account. - :vartype system_data: ~azure.mgmt.mixedreality.models.SystemData - :ivar storage_account_name: The name of the storage account associated with this accountId. - :vartype storage_account_name: str - :ivar account_id: unique id of certain account. - :vartype account_id: str - :ivar account_domain: Correspond domain name of certain Spatial Anchors Account. - :vartype account_domain: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "system_data": {"readonly": True}, - "account_id": {"readonly": True}, - "account_domain": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "identity": {"key": "identity", "type": "Identity"}, - "plan": {"key": "plan", "type": "Identity"}, - "sku": {"key": "sku", "type": "Sku"}, - "kind": {"key": "kind", "type": "Sku"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "storage_account_name": {"key": "properties.storageAccountName", "type": "str"}, - "account_id": {"key": "properties.accountId", "type": "str"}, - "account_domain": {"key": "properties.accountDomain", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.Identity"] = None, - plan: Optional["_models.Identity"] = None, - sku: Optional["_models.Sku"] = None, - kind: Optional["_models.Sku"] = None, - storage_account_name: Optional[str] = None, - **kwargs - ): - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword identity: The identity associated with this account. - :paramtype identity: ~azure.mgmt.mixedreality.models.Identity - :keyword plan: The plan associated with this account. - :paramtype plan: ~azure.mgmt.mixedreality.models.Identity - :keyword sku: The sku associated with this account. - :paramtype sku: ~azure.mgmt.mixedreality.models.Sku - :keyword kind: The kind of account, if supported. - :paramtype kind: ~azure.mgmt.mixedreality.models.Sku - :keyword storage_account_name: The name of the storage account associated with this accountId. - :paramtype storage_account_name: str - """ - super().__init__(tags=tags, location=location, **kwargs) - self.identity = identity - self.plan = plan - self.sku = sku - self.kind = kind - self.system_data = None - self.storage_account_name = storage_account_name - self.account_id = None - self.account_domain = None - - -class SpatialAnchorsAccountPage(_serialization.Model): - """Result of the request to get resource collection. It contains a list of resources and a URL link to get the next set of results. - - :ivar value: List of resources supported by the Resource Provider. - :vartype value: list[~azure.mgmt.mixedreality.models.SpatialAnchorsAccount] - :ivar next_link: URL to get the next set of resource list results if there are any. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[SpatialAnchorsAccount]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.SpatialAnchorsAccount"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: List of resources supported by the Resource Provider. - :paramtype value: list[~azure.mgmt.mixedreality.models.SpatialAnchorsAccount] - :keyword next_link: URL to get the next set of resource list results if there are any. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or ~azure.mgmt.mixedreality.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or ~azure.mgmt.mixedreality.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or ~azure.mgmt.mixedreality.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or ~azure.mgmt.mixedreality.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__init__(**kwargs) - self.created_by = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/models/_patch.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# 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 - """ diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/__init__.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/__init__.py deleted file mode 100644 index 9e3f97a21844..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/__init__.py +++ /dev/null @@ -1,27 +0,0 @@ -# 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 ._operations import Operations -from ._mixed_reality_client_operations import MixedRealityClientOperationsMixin -from ._spatial_anchors_accounts_operations import SpatialAnchorsAccountsOperations -from ._remote_rendering_accounts_operations import RemoteRenderingAccountsOperations -from ._object_anchors_accounts_operations import ObjectAnchorsAccountsOperations - -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__ = [ - "Operations", - "MixedRealityClientOperationsMixin", - "SpatialAnchorsAccountsOperations", - "RemoteRenderingAccountsOperations", - "ObjectAnchorsAccountsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_mixed_reality_client_operations.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_mixed_reality_client_operations.py deleted file mode 100644 index db136cb4e480..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_mixed_reality_client_operations.py +++ /dev/null @@ -1,197 +0,0 @@ -# pylint: disable=too-many-lines -# 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 sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -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 -from .._serialization import Serializer -from .._vendor import MixedRealityClientMixinABC, _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_check_name_availability_local_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/locations/{location}/checkNameAvailability", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url( - "location", location, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class MixedRealityClientOperationsMixin(MixedRealityClientMixinABC): - @overload - def check_name_availability_local( - self, - location: str, - check_name_availability: _models.CheckNameAvailabilityRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CheckNameAvailabilityResponse: - """Check Name Availability for local uniqueness. - - :param location: The location in which uniqueness will be verified. Required. - :type location: str - :param check_name_availability: Check Name Availability Request. Required. - :type check_name_availability: ~azure.mgmt.mixedreality.models.CheckNameAvailabilityRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResponse or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.CheckNameAvailabilityResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_name_availability_local( - self, location: str, check_name_availability: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.CheckNameAvailabilityResponse: - """Check Name Availability for local uniqueness. - - :param location: The location in which uniqueness will be verified. Required. - :type location: str - :param check_name_availability: Check Name Availability Request. Required. - :type check_name_availability: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResponse or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.CheckNameAvailabilityResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_name_availability_local( - self, location: str, check_name_availability: Union[_models.CheckNameAvailabilityRequest, IO], **kwargs: Any - ) -> _models.CheckNameAvailabilityResponse: - """Check Name Availability for local uniqueness. - - :param location: The location in which uniqueness will be verified. Required. - :type location: str - :param check_name_availability: Check Name Availability Request. Is either a model type or a IO - type. Required. - :type check_name_availability: ~azure.mgmt.mixedreality.models.CheckNameAvailabilityRequest or - IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResponse or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.CheckNameAvailabilityResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckNameAvailabilityResponse] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(check_name_availability, (IO, bytes)): - _content = check_name_availability - else: - _json = self._serialize.body(check_name_availability, "CheckNameAvailabilityRequest") - - request = build_check_name_availability_local_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.check_name_availability_local.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - check_name_availability_local.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/locations/{location}/checkNameAvailability"} # type: ignore diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_object_anchors_accounts_operations.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_object_anchors_accounts_operations.py deleted file mode 100644 index 67109873acf4..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_object_anchors_accounts_operations.py +++ /dev/null @@ -1,1115 +0,0 @@ -# pylint: disable=too-many-lines -# 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 sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -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 -from .._serialization import Serializer -from .._vendor import MixedRealityClientMixinABC, _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/objectAnchorsAccounts" - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_keys_request( - resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}/listKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_regenerate_keys_request( - resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}/regenerateKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ObjectAnchorsAccountsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.mixedreality.MixedRealityClient`'s - :attr:`object_anchors_accounts` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - 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_by_subscription(self, **kwargs: Any) -> Iterable["_models.ObjectAnchorsAccount"]: - """List Object Anchors Accounts by Subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ObjectAnchorsAccount or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.mixedreality.models.ObjectAnchorsAccount] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ObjectAnchorsAccountPage] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ObjectAnchorsAccountPage", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/objectAnchorsAccounts"} # type: ignore - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ObjectAnchorsAccount"]: - """List Resources by Resource Group. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ObjectAnchorsAccount or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.mixedreality.models.ObjectAnchorsAccount] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ObjectAnchorsAccountPage] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ObjectAnchorsAccountPage", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts"} # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - """Delete an Object Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}"} # type: ignore - - @distributed_trace - def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.ObjectAnchorsAccount: - """Retrieve an Object Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ObjectAnchorsAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.ObjectAnchorsAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ObjectAnchorsAccount] - - request = build_get_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ObjectAnchorsAccount", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}"} # type: ignore - - @overload - def update( - self, - resource_group_name: str, - account_name: str, - object_anchors_account: _models.ObjectAnchorsAccount, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ObjectAnchorsAccount: - """Updating an Object Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param object_anchors_account: Object Anchors Account parameter. Required. - :type object_anchors_account: ~azure.mgmt.mixedreality.models.ObjectAnchorsAccount - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ObjectAnchorsAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.ObjectAnchorsAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - account_name: str, - object_anchors_account: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ObjectAnchorsAccount: - """Updating an Object Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param object_anchors_account: Object Anchors Account parameter. Required. - :type object_anchors_account: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ObjectAnchorsAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.ObjectAnchorsAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - account_name: str, - object_anchors_account: Union[_models.ObjectAnchorsAccount, IO], - **kwargs: Any - ) -> _models.ObjectAnchorsAccount: - """Updating an Object Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param object_anchors_account: Object Anchors Account parameter. Is either a model type or a IO - type. Required. - :type object_anchors_account: ~azure.mgmt.mixedreality.models.ObjectAnchorsAccount or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ObjectAnchorsAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.ObjectAnchorsAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ObjectAnchorsAccount] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(object_anchors_account, (IO, bytes)): - _content = object_anchors_account - else: - _json = self._serialize.body(object_anchors_account, "ObjectAnchorsAccount") - - request = build_update_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ObjectAnchorsAccount", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}"} # type: ignore - - @overload - def create( - self, - resource_group_name: str, - account_name: str, - object_anchors_account: _models.ObjectAnchorsAccount, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ObjectAnchorsAccount: - """Creating or Updating an object anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param object_anchors_account: Object Anchors Account parameter. Required. - :type object_anchors_account: ~azure.mgmt.mixedreality.models.ObjectAnchorsAccount - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ObjectAnchorsAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.ObjectAnchorsAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - resource_group_name: str, - account_name: str, - object_anchors_account: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ObjectAnchorsAccount: - """Creating or Updating an object anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param object_anchors_account: Object Anchors Account parameter. Required. - :type object_anchors_account: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ObjectAnchorsAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.ObjectAnchorsAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - resource_group_name: str, - account_name: str, - object_anchors_account: Union[_models.ObjectAnchorsAccount, IO], - **kwargs: Any - ) -> _models.ObjectAnchorsAccount: - """Creating or Updating an object anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param object_anchors_account: Object Anchors Account parameter. Is either a model type or a IO - type. Required. - :type object_anchors_account: ~azure.mgmt.mixedreality.models.ObjectAnchorsAccount or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ObjectAnchorsAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.ObjectAnchorsAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ObjectAnchorsAccount] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(object_anchors_account, (IO, bytes)): - _content = object_anchors_account - else: - _json = self._serialize.body(object_anchors_account, "ObjectAnchorsAccount") - - request = build_create_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("ObjectAnchorsAccount", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ObjectAnchorsAccount", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}"} # type: ignore - - @distributed_trace - def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.AccountKeys: - """List Both of the 2 Keys of an object anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccountKeys or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.AccountKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccountKeys] - - request = build_list_keys_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_keys.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AccountKeys", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}/listKeys"} # type: ignore - - @overload - def regenerate_keys( - self, - resource_group_name: str, - account_name: str, - regenerate: _models.AccountKeyRegenerateRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AccountKeys: - """Regenerate specified Key of an object anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param regenerate: Required information for key regeneration. Required. - :type regenerate: ~azure.mgmt.mixedreality.models.AccountKeyRegenerateRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccountKeys or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.AccountKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def regenerate_keys( - self, - resource_group_name: str, - account_name: str, - regenerate: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AccountKeys: - """Regenerate specified Key of an object anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param regenerate: Required information for key regeneration. Required. - :type regenerate: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccountKeys or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.AccountKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def regenerate_keys( - self, - resource_group_name: str, - account_name: str, - regenerate: Union[_models.AccountKeyRegenerateRequest, IO], - **kwargs: Any - ) -> _models.AccountKeys: - """Regenerate specified Key of an object anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param regenerate: Required information for key regeneration. Is either a model type or a IO - type. Required. - :type regenerate: ~azure.mgmt.mixedreality.models.AccountKeyRegenerateRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccountKeys or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.AccountKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccountKeys] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate, (IO, bytes)): - _content = regenerate - else: - _json = self._serialize.body(regenerate, "AccountKeyRegenerateRequest") - - request = build_regenerate_keys_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.regenerate_keys.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AccountKeys", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - regenerate_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/objectAnchorsAccounts/{accountName}/regenerateKeys"} # type: ignore diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_operations.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_operations.py deleted file mode 100644 index 160126c71500..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_operations.py +++ /dev/null @@ -1,162 +0,0 @@ -# pylint: disable=too-many-lines -# 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 sys -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -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 -from .._serialization import Serializer -from .._vendor import MixedRealityClientMixinABC, _convert_request - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.MixedReality/operations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.mixedreality.MixedRealityClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - 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) -> Iterable["_models.Operation"]: - """Exposing Available Operations. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.mixedreality.models.Operation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationPage] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - 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) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("OperationPage", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.MixedReality/operations"} # type: ignore diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_patch.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# 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 - """ diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_remote_rendering_accounts_operations.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_remote_rendering_accounts_operations.py deleted file mode 100644 index 63694ff246d6..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_remote_rendering_accounts_operations.py +++ /dev/null @@ -1,1115 +0,0 @@ -# pylint: disable=too-many-lines -# 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 sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -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 -from .._serialization import Serializer -from .._vendor import MixedRealityClientMixinABC, _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/remoteRenderingAccounts" - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_keys_request( - resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}/listKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_regenerate_keys_request( - resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}/regenerateKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class RemoteRenderingAccountsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.mixedreality.MixedRealityClient`'s - :attr:`remote_rendering_accounts` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - 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_by_subscription(self, **kwargs: Any) -> Iterable["_models.RemoteRenderingAccount"]: - """List Remote Rendering Accounts by Subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RemoteRenderingAccount or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.mixedreality.models.RemoteRenderingAccount] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RemoteRenderingAccountPage] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("RemoteRenderingAccountPage", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/remoteRenderingAccounts"} # type: ignore - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.RemoteRenderingAccount"]: - """List Resources by Resource Group. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RemoteRenderingAccount or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.mixedreality.models.RemoteRenderingAccount] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RemoteRenderingAccountPage] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("RemoteRenderingAccountPage", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts"} # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - """Delete a Remote Rendering Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}"} # type: ignore - - @distributed_trace - def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.RemoteRenderingAccount: - """Retrieve a Remote Rendering Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RemoteRenderingAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.RemoteRenderingAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RemoteRenderingAccount] - - request = build_get_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RemoteRenderingAccount", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}"} # type: ignore - - @overload - def update( - self, - resource_group_name: str, - account_name: str, - remote_rendering_account: _models.RemoteRenderingAccount, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RemoteRenderingAccount: - """Updating a Remote Rendering Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param remote_rendering_account: Remote Rendering Account parameter. Required. - :type remote_rendering_account: ~azure.mgmt.mixedreality.models.RemoteRenderingAccount - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RemoteRenderingAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.RemoteRenderingAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - account_name: str, - remote_rendering_account: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RemoteRenderingAccount: - """Updating a Remote Rendering Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param remote_rendering_account: Remote Rendering Account parameter. Required. - :type remote_rendering_account: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RemoteRenderingAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.RemoteRenderingAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - account_name: str, - remote_rendering_account: Union[_models.RemoteRenderingAccount, IO], - **kwargs: Any - ) -> _models.RemoteRenderingAccount: - """Updating a Remote Rendering Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param remote_rendering_account: Remote Rendering Account parameter. Is either a model type or - a IO type. Required. - :type remote_rendering_account: ~azure.mgmt.mixedreality.models.RemoteRenderingAccount or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RemoteRenderingAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.RemoteRenderingAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RemoteRenderingAccount] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(remote_rendering_account, (IO, bytes)): - _content = remote_rendering_account - else: - _json = self._serialize.body(remote_rendering_account, "RemoteRenderingAccount") - - request = build_update_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RemoteRenderingAccount", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}"} # type: ignore - - @overload - def create( - self, - resource_group_name: str, - account_name: str, - remote_rendering_account: _models.RemoteRenderingAccount, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RemoteRenderingAccount: - """Creating or Updating a Remote Rendering Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param remote_rendering_account: Remote Rendering Account parameter. Required. - :type remote_rendering_account: ~azure.mgmt.mixedreality.models.RemoteRenderingAccount - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RemoteRenderingAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.RemoteRenderingAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - resource_group_name: str, - account_name: str, - remote_rendering_account: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RemoteRenderingAccount: - """Creating or Updating a Remote Rendering Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param remote_rendering_account: Remote Rendering Account parameter. Required. - :type remote_rendering_account: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RemoteRenderingAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.RemoteRenderingAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - resource_group_name: str, - account_name: str, - remote_rendering_account: Union[_models.RemoteRenderingAccount, IO], - **kwargs: Any - ) -> _models.RemoteRenderingAccount: - """Creating or Updating a Remote Rendering Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param remote_rendering_account: Remote Rendering Account parameter. Is either a model type or - a IO type. Required. - :type remote_rendering_account: ~azure.mgmt.mixedreality.models.RemoteRenderingAccount or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RemoteRenderingAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.RemoteRenderingAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RemoteRenderingAccount] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(remote_rendering_account, (IO, bytes)): - _content = remote_rendering_account - else: - _json = self._serialize.body(remote_rendering_account, "RemoteRenderingAccount") - - request = build_create_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("RemoteRenderingAccount", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("RemoteRenderingAccount", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}"} # type: ignore - - @distributed_trace - def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.AccountKeys: - """List Both of the 2 Keys of a Remote Rendering Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccountKeys or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.AccountKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccountKeys] - - request = build_list_keys_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_keys.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AccountKeys", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}/listKeys"} # type: ignore - - @overload - def regenerate_keys( - self, - resource_group_name: str, - account_name: str, - regenerate: _models.AccountKeyRegenerateRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AccountKeys: - """Regenerate specified Key of a Remote Rendering Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param regenerate: Required information for key regeneration. Required. - :type regenerate: ~azure.mgmt.mixedreality.models.AccountKeyRegenerateRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccountKeys or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.AccountKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def regenerate_keys( - self, - resource_group_name: str, - account_name: str, - regenerate: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AccountKeys: - """Regenerate specified Key of a Remote Rendering Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param regenerate: Required information for key regeneration. Required. - :type regenerate: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccountKeys or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.AccountKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def regenerate_keys( - self, - resource_group_name: str, - account_name: str, - regenerate: Union[_models.AccountKeyRegenerateRequest, IO], - **kwargs: Any - ) -> _models.AccountKeys: - """Regenerate specified Key of a Remote Rendering Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param regenerate: Required information for key regeneration. Is either a model type or a IO - type. Required. - :type regenerate: ~azure.mgmt.mixedreality.models.AccountKeyRegenerateRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccountKeys or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.AccountKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccountKeys] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate, (IO, bytes)): - _content = regenerate - else: - _json = self._serialize.body(regenerate, "AccountKeyRegenerateRequest") - - request = build_regenerate_keys_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.regenerate_keys.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AccountKeys", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - regenerate_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}/regenerateKeys"} # type: ignore diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_spatial_anchors_accounts_operations.py b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_spatial_anchors_accounts_operations.py deleted file mode 100644 index 6dcfb9e59514..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/operations/_spatial_anchors_accounts_operations.py +++ /dev/null @@ -1,1115 +0,0 @@ -# pylint: disable=too-many-lines -# 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 sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -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 -from .._serialization import Serializer -from .._vendor import MixedRealityClientMixinABC, _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/spatialAnchorsAccounts" - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_keys_request( - resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}/listKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_regenerate_keys_request( - resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2021-03-01-preview") - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}/regenerateKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "accountName": _SERIALIZER.url( - "account_name", account_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class SpatialAnchorsAccountsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.mixedreality.MixedRealityClient`'s - :attr:`spatial_anchors_accounts` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - 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_by_subscription(self, **kwargs: Any) -> Iterable["_models.SpatialAnchorsAccount"]: - """List Spatial Anchors Accounts by Subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SpatialAnchorsAccount or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.mixedreality.models.SpatialAnchorsAccount] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SpatialAnchorsAccountPage] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("SpatialAnchorsAccountPage", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/spatialAnchorsAccounts"} # type: ignore - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.SpatialAnchorsAccount"]: - """List Resources by Resource Group. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SpatialAnchorsAccount or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.mixedreality.models.SpatialAnchorsAccount] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SpatialAnchorsAccountPage] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("SpatialAnchorsAccountPage", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts"} # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - """Delete a Spatial Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}"} # type: ignore - - @distributed_trace - def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.SpatialAnchorsAccount: - """Retrieve a Spatial Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SpatialAnchorsAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.SpatialAnchorsAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SpatialAnchorsAccount] - - request = build_get_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SpatialAnchorsAccount", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}"} # type: ignore - - @overload - def update( - self, - resource_group_name: str, - account_name: str, - spatial_anchors_account: _models.SpatialAnchorsAccount, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SpatialAnchorsAccount: - """Updating a Spatial Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param spatial_anchors_account: Spatial Anchors Account parameter. Required. - :type spatial_anchors_account: ~azure.mgmt.mixedreality.models.SpatialAnchorsAccount - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SpatialAnchorsAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.SpatialAnchorsAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - account_name: str, - spatial_anchors_account: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SpatialAnchorsAccount: - """Updating a Spatial Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param spatial_anchors_account: Spatial Anchors Account parameter. Required. - :type spatial_anchors_account: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SpatialAnchorsAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.SpatialAnchorsAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - account_name: str, - spatial_anchors_account: Union[_models.SpatialAnchorsAccount, IO], - **kwargs: Any - ) -> _models.SpatialAnchorsAccount: - """Updating a Spatial Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param spatial_anchors_account: Spatial Anchors Account parameter. Is either a model type or a - IO type. Required. - :type spatial_anchors_account: ~azure.mgmt.mixedreality.models.SpatialAnchorsAccount or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SpatialAnchorsAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.SpatialAnchorsAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SpatialAnchorsAccount] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(spatial_anchors_account, (IO, bytes)): - _content = spatial_anchors_account - else: - _json = self._serialize.body(spatial_anchors_account, "SpatialAnchorsAccount") - - request = build_update_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SpatialAnchorsAccount", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}"} # type: ignore - - @overload - def create( - self, - resource_group_name: str, - account_name: str, - spatial_anchors_account: _models.SpatialAnchorsAccount, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SpatialAnchorsAccount: - """Creating or Updating a Spatial Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param spatial_anchors_account: Spatial Anchors Account parameter. Required. - :type spatial_anchors_account: ~azure.mgmt.mixedreality.models.SpatialAnchorsAccount - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SpatialAnchorsAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.SpatialAnchorsAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - resource_group_name: str, - account_name: str, - spatial_anchors_account: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SpatialAnchorsAccount: - """Creating or Updating a Spatial Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param spatial_anchors_account: Spatial Anchors Account parameter. Required. - :type spatial_anchors_account: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SpatialAnchorsAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.SpatialAnchorsAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - resource_group_name: str, - account_name: str, - spatial_anchors_account: Union[_models.SpatialAnchorsAccount, IO], - **kwargs: Any - ) -> _models.SpatialAnchorsAccount: - """Creating or Updating a Spatial Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param spatial_anchors_account: Spatial Anchors Account parameter. Is either a model type or a - IO type. Required. - :type spatial_anchors_account: ~azure.mgmt.mixedreality.models.SpatialAnchorsAccount or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SpatialAnchorsAccount or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.SpatialAnchorsAccount - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SpatialAnchorsAccount] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(spatial_anchors_account, (IO, bytes)): - _content = spatial_anchors_account - else: - _json = self._serialize.body(spatial_anchors_account, "SpatialAnchorsAccount") - - request = build_create_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("SpatialAnchorsAccount", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SpatialAnchorsAccount", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}"} # type: ignore - - @distributed_trace - def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.AccountKeys: - """List Both of the 2 Keys of a Spatial Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccountKeys or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.AccountKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccountKeys] - - request = build_list_keys_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_keys.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AccountKeys", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}/listKeys"} # type: ignore - - @overload - def regenerate_keys( - self, - resource_group_name: str, - account_name: str, - regenerate: _models.AccountKeyRegenerateRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AccountKeys: - """Regenerate specified Key of a Spatial Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param regenerate: Required information for key regeneration. Required. - :type regenerate: ~azure.mgmt.mixedreality.models.AccountKeyRegenerateRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccountKeys or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.AccountKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def regenerate_keys( - self, - resource_group_name: str, - account_name: str, - regenerate: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AccountKeys: - """Regenerate specified Key of a Spatial Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param regenerate: Required information for key regeneration. Required. - :type regenerate: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccountKeys or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.AccountKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def regenerate_keys( - self, - resource_group_name: str, - account_name: str, - regenerate: Union[_models.AccountKeyRegenerateRequest, IO], - **kwargs: Any - ) -> _models.AccountKeys: - """Regenerate specified Key of a Spatial Anchors Account. - - :param resource_group_name: Name of an Azure resource group. Required. - :type resource_group_name: str - :param account_name: Name of an Mixed Reality Account. Required. - :type account_name: str - :param regenerate: Required information for key regeneration. Is either a model type or a IO - type. Required. - :type regenerate: ~azure.mgmt.mixedreality.models.AccountKeyRegenerateRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AccountKeys or the result of cls(response) - :rtype: ~azure.mgmt.mixedreality.models.AccountKeys - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-03-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccountKeys] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate, (IO, bytes)): - _content = regenerate - else: - _json = self._serialize.body(regenerate, "AccountKeyRegenerateRequest") - - request = build_regenerate_keys_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.regenerate_keys.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AccountKeys", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - regenerate_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}/regenerateKeys"} # type: ignore diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/py.typed b/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/azure/mgmt/mixedreality/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/dev_requirements.txt b/sdk/mixedreality/azure-mgmt-mixedreality/dev_requirements.txt deleted file mode 100644 index 7d496b4d1cc1..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/dev_requirements.txt +++ /dev/null @@ -1 +0,0 @@ --e ../../../eng/tools/azure-sdk-tools diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/check_local_name_availability.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/check_local_name_availability.py deleted file mode 100644 index 80fe1cf0c6ce..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/check_local_name_availability.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.mixedreality import MixedRealityClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-mixedreality -# USAGE - python check_local_name_availability.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MixedRealityClient( - credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - ) - - response = client.check_name_availability_local( - location="eastus2euap", - check_name_availability={"name": "MyAccount", "type": "Microsoft.MixedReality/spatialAnchorsAccounts"}, - ) - print(response) - - -# x-ms-original-file: specification/mixedreality/resource-manager/Microsoft.MixedReality/preview/2021-03-01-preview/examples/proxy/CheckNameAvailabilityForLocalUniqueness.json -if __name__ == "__main__": - main() diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/create_object_anchors_account.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/create_object_anchors_account.py deleted file mode 100644 index b17ad3f371f4..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/create_object_anchors_account.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.mixedreality import MixedRealityClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-mixedreality -# USAGE - python create_object_anchors_account.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MixedRealityClient( - credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - ) - - response = client.object_anchors_accounts.create( - resource_group_name="MyResourceGroup", - account_name="MyAccount", - object_anchors_account={"identity": {"type": "SystemAssigned"}, "location": "eastus2euap"}, - ) - print(response) - - -# x-ms-original-file: specification/mixedreality/resource-manager/Microsoft.MixedReality/preview/2021-03-01-preview/examples/object-anchors/Put.json -if __name__ == "__main__": - main() diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/create_remote_rendering_account.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/create_remote_rendering_account.py deleted file mode 100644 index 8ca3d282b860..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/create_remote_rendering_account.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.mixedreality import MixedRealityClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-mixedreality -# USAGE - python create_remote_rendering_account.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MixedRealityClient( - credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - ) - - response = client.remote_rendering_accounts.create( - resource_group_name="MyResourceGroup", - account_name="MyAccount", - remote_rendering_account={"identity": {"type": "SystemAssigned"}, "location": "eastus2euap"}, - ) - print(response) - - -# x-ms-original-file: specification/mixedreality/resource-manager/Microsoft.MixedReality/preview/2021-03-01-preview/examples/remote-rendering/Put.json -if __name__ == "__main__": - main() diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/create_spatial_anchor_account.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/create_spatial_anchor_account.py deleted file mode 100644 index 1e541a37b16d..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/create_spatial_anchor_account.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.mixedreality import MixedRealityClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-mixedreality -# USAGE - python create_spatial_anchor_account.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MixedRealityClient( - credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - ) - - response = client.spatial_anchors_accounts.create( - resource_group_name="MyResourceGroup", - account_name="MyAccount", - spatial_anchors_account={"location": "eastus2euap"}, - ) - print(response) - - -# x-ms-original-file: specification/mixedreality/resource-manager/Microsoft.MixedReality/preview/2021-03-01-preview/examples/spatial-anchors/Put.json -if __name__ == "__main__": - main() diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/delete_object_anchors_account.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/delete_object_anchors_account.py deleted file mode 100644 index 9deb2f6501ad..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/delete_object_anchors_account.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.mixedreality import MixedRealityClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-mixedreality -# USAGE - python delete_object_anchors_account.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MixedRealityClient( - credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - ) - - response = client.object_anchors_accounts.delete( - resource_group_name="MyResourceGroup", - account_name="MyAccount", - ) - print(response) - - -# x-ms-original-file: specification/mixedreality/resource-manager/Microsoft.MixedReality/preview/2021-03-01-preview/examples/object-anchors/Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/delete_remote_rendering_account.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/delete_remote_rendering_account.py deleted file mode 100644 index a19e224f291c..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/delete_remote_rendering_account.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.mixedreality import MixedRealityClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-mixedreality -# USAGE - python delete_remote_rendering_account.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MixedRealityClient( - credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - ) - - response = client.remote_rendering_accounts.delete( - resource_group_name="MyResourceGroup", - account_name="MyAccount", - ) - print(response) - - -# x-ms-original-file: specification/mixedreality/resource-manager/Microsoft.MixedReality/preview/2021-03-01-preview/examples/remote-rendering/Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/delete_spatial_anchors_account.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/delete_spatial_anchors_account.py deleted file mode 100644 index 1c3db073ca22..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/delete_spatial_anchors_account.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.mixedreality import MixedRealityClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-mixedreality -# USAGE - python delete_spatial_anchors_account.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MixedRealityClient( - credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - ) - - response = client.spatial_anchors_accounts.delete( - resource_group_name="MyResourceGroup", - account_name="MyAccount", - ) - print(response) - - -# x-ms-original-file: specification/mixedreality/resource-manager/Microsoft.MixedReality/preview/2021-03-01-preview/examples/spatial-anchors/Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/get_object_anchors_account.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/get_object_anchors_account.py deleted file mode 100644 index 1dd5d4ba12f4..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/get_object_anchors_account.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.mixedreality import MixedRealityClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-mixedreality -# USAGE - python get_object_anchors_account.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MixedRealityClient( - credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - ) - - response = client.object_anchors_accounts.get( - resource_group_name="MyResourceGroup", - account_name="MyAccount", - ) - print(response) - - -# x-ms-original-file: specification/mixedreality/resource-manager/Microsoft.MixedReality/preview/2021-03-01-preview/examples/object-anchors/Get.json -if __name__ == "__main__": - main() diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/get_remote_rendering_account.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/get_remote_rendering_account.py deleted file mode 100644 index 764e7ee9da3b..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/get_remote_rendering_account.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.mixedreality import MixedRealityClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-mixedreality -# USAGE - python get_remote_rendering_account.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MixedRealityClient( - credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - ) - - response = client.remote_rendering_accounts.get( - resource_group_name="MyResourceGroup", - account_name="MyAccount", - ) - print(response) - - -# x-ms-original-file: specification/mixedreality/resource-manager/Microsoft.MixedReality/preview/2021-03-01-preview/examples/remote-rendering/Get.json -if __name__ == "__main__": - main() diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/get_spatial_anchors_account.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/get_spatial_anchors_account.py deleted file mode 100644 index e6d7483274c6..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/get_spatial_anchors_account.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.mixedreality import MixedRealityClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-mixedreality -# USAGE - python get_spatial_anchors_account.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MixedRealityClient( - credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - ) - - response = client.spatial_anchors_accounts.get( - resource_group_name="MyResourceGroup", - account_name="MyAccount", - ) - print(response) - - -# x-ms-original-file: specification/mixedreality/resource-manager/Microsoft.MixedReality/preview/2021-03-01-preview/examples/spatial-anchors/Get.json -if __name__ == "__main__": - main() diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_available_operations.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_available_operations.py deleted file mode 100644 index 938dd15334e3..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_available_operations.py +++ /dev/null @@ -1,39 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.mixedreality import MixedRealityClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-mixedreality -# USAGE - python list_available_operations.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MixedRealityClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.operations.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/mixedreality/resource-manager/Microsoft.MixedReality/preview/2021-03-01-preview/examples/proxy/ExposingAvailableOperations.json -if __name__ == "__main__": - main() diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_object_anchors_account_key.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_object_anchors_account_key.py deleted file mode 100644 index 93ba692dfb18..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_object_anchors_account_key.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.mixedreality import MixedRealityClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-mixedreality -# USAGE - python list_object_anchors_account_key.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MixedRealityClient( - credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - ) - - response = client.object_anchors_accounts.list_keys( - resource_group_name="MyResourceGroup", - account_name="MyAccount", - ) - print(response) - - -# x-ms-original-file: specification/mixedreality/resource-manager/Microsoft.MixedReality/preview/2021-03-01-preview/examples/object-anchors/ListKeys.json -if __name__ == "__main__": - main() diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_object_anchors_accounts_by_resource_group.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_object_anchors_accounts_by_resource_group.py deleted file mode 100644 index 2d7d38012730..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_object_anchors_accounts_by_resource_group.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.mixedreality import MixedRealityClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-mixedreality -# USAGE - python list_object_anchors_accounts_by_resource_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MixedRealityClient( - credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - ) - - response = client.object_anchors_accounts.list_by_resource_group( - resource_group_name="MyResourceGroup", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/mixedreality/resource-manager/Microsoft.MixedReality/preview/2021-03-01-preview/examples/object-anchors/GetByResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_object_anchors_accounts_by_subscription.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_object_anchors_accounts_by_subscription.py deleted file mode 100644 index a1ffd007ccde..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_object_anchors_accounts_by_subscription.py +++ /dev/null @@ -1,39 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.mixedreality import MixedRealityClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-mixedreality -# USAGE - python list_object_anchors_accounts_by_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MixedRealityClient( - credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - ) - - response = client.object_anchors_accounts.list_by_subscription() - for item in response: - print(item) - - -# x-ms-original-file: specification/mixedreality/resource-manager/Microsoft.MixedReality/preview/2021-03-01-preview/examples/object-anchors/GetBySubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_remote_rendering_account_key.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_remote_rendering_account_key.py deleted file mode 100644 index e9630b503040..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_remote_rendering_account_key.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.mixedreality import MixedRealityClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-mixedreality -# USAGE - python list_remote_rendering_account_key.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MixedRealityClient( - credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - ) - - response = client.remote_rendering_accounts.list_keys( - resource_group_name="MyResourceGroup", - account_name="MyAccount", - ) - print(response) - - -# x-ms-original-file: specification/mixedreality/resource-manager/Microsoft.MixedReality/preview/2021-03-01-preview/examples/remote-rendering/ListKeys.json -if __name__ == "__main__": - main() diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_remote_rendering_accounts_by_resource_group.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_remote_rendering_accounts_by_resource_group.py deleted file mode 100644 index 8c2c8e473fc6..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_remote_rendering_accounts_by_resource_group.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.mixedreality import MixedRealityClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-mixedreality -# USAGE - python list_remote_rendering_accounts_by_resource_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MixedRealityClient( - credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - ) - - response = client.remote_rendering_accounts.list_by_resource_group( - resource_group_name="MyResourceGroup", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/mixedreality/resource-manager/Microsoft.MixedReality/preview/2021-03-01-preview/examples/remote-rendering/GetByResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_remote_rendering_accounts_by_subscription.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_remote_rendering_accounts_by_subscription.py deleted file mode 100644 index f0d03bdad725..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_remote_rendering_accounts_by_subscription.py +++ /dev/null @@ -1,39 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.mixedreality import MixedRealityClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-mixedreality -# USAGE - python list_remote_rendering_accounts_by_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MixedRealityClient( - credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - ) - - response = client.remote_rendering_accounts.list_by_subscription() - for item in response: - print(item) - - -# x-ms-original-file: specification/mixedreality/resource-manager/Microsoft.MixedReality/preview/2021-03-01-preview/examples/remote-rendering/GetBySubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_spatial_anchor_account_key.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_spatial_anchor_account_key.py deleted file mode 100644 index 796ce7b546a1..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_spatial_anchor_account_key.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.mixedreality import MixedRealityClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-mixedreality -# USAGE - python list_spatial_anchor_account_key.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MixedRealityClient( - credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - ) - - response = client.spatial_anchors_accounts.list_keys( - resource_group_name="MyResourceGroup", - account_name="MyAccount", - ) - print(response) - - -# x-ms-original-file: specification/mixedreality/resource-manager/Microsoft.MixedReality/preview/2021-03-01-preview/examples/spatial-anchors/ListKeys.json -if __name__ == "__main__": - main() diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_spatial_anchor_accounts_by_resource_group.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_spatial_anchor_accounts_by_resource_group.py deleted file mode 100644 index 6fa05209a844..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_spatial_anchor_accounts_by_resource_group.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.mixedreality import MixedRealityClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-mixedreality -# USAGE - python list_spatial_anchor_accounts_by_resource_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MixedRealityClient( - credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - ) - - response = client.spatial_anchors_accounts.list_by_resource_group( - resource_group_name="MyResourceGroup", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/mixedreality/resource-manager/Microsoft.MixedReality/preview/2021-03-01-preview/examples/spatial-anchors/GetByResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_spatial_anchors_accounts_by_subscription.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_spatial_anchors_accounts_by_subscription.py deleted file mode 100644 index 7c6827784ef5..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/list_spatial_anchors_accounts_by_subscription.py +++ /dev/null @@ -1,39 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.mixedreality import MixedRealityClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-mixedreality -# USAGE - python list_spatial_anchors_accounts_by_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MixedRealityClient( - credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - ) - - response = client.spatial_anchors_accounts.list_by_subscription() - for item in response: - print(item) - - -# x-ms-original-file: specification/mixedreality/resource-manager/Microsoft.MixedReality/preview/2021-03-01-preview/examples/spatial-anchors/GetBySubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/regenerate_object_anchors_account_keys.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/regenerate_object_anchors_account_keys.py deleted file mode 100644 index b21b26583770..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/regenerate_object_anchors_account_keys.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.mixedreality import MixedRealityClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-mixedreality -# USAGE - python regenerate_object_anchors_account_keys.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MixedRealityClient( - credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - ) - - response = client.object_anchors_accounts.regenerate_keys( - resource_group_name="MyResourceGroup", - account_name="MyAccount", - regenerate={"serial": 1}, - ) - print(response) - - -# x-ms-original-file: specification/mixedreality/resource-manager/Microsoft.MixedReality/preview/2021-03-01-preview/examples/object-anchors/RegenerateKey.json -if __name__ == "__main__": - main() diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/regenerate_remote_rendering_account_keys.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/regenerate_remote_rendering_account_keys.py deleted file mode 100644 index ddc7495cac8a..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/regenerate_remote_rendering_account_keys.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.mixedreality import MixedRealityClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-mixedreality -# USAGE - python regenerate_remote_rendering_account_keys.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MixedRealityClient( - credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - ) - - response = client.remote_rendering_accounts.regenerate_keys( - resource_group_name="MyResourceGroup", - account_name="MyAccount", - regenerate={"serial": 1}, - ) - print(response) - - -# x-ms-original-file: specification/mixedreality/resource-manager/Microsoft.MixedReality/preview/2021-03-01-preview/examples/remote-rendering/RegenerateKey.json -if __name__ == "__main__": - main() diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/regenerate_spatial_anchors_account_keys.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/regenerate_spatial_anchors_account_keys.py deleted file mode 100644 index 712f7a52a7bf..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/regenerate_spatial_anchors_account_keys.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.mixedreality import MixedRealityClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-mixedreality -# USAGE - python regenerate_spatial_anchors_account_keys.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MixedRealityClient( - credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - ) - - response = client.spatial_anchors_accounts.regenerate_keys( - resource_group_name="MyResourceGroup", - account_name="MyAccount", - regenerate={"serial": 1}, - ) - print(response) - - -# x-ms-original-file: specification/mixedreality/resource-manager/Microsoft.MixedReality/preview/2021-03-01-preview/examples/spatial-anchors/RegenerateKey.json -if __name__ == "__main__": - main() diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/update_object_anchors_account.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/update_object_anchors_account.py deleted file mode 100644 index 99fe799d2548..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/update_object_anchors_account.py +++ /dev/null @@ -1,46 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.mixedreality import MixedRealityClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-mixedreality -# USAGE - python update_object_anchors_account.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MixedRealityClient( - credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - ) - - response = client.object_anchors_accounts.update( - resource_group_name="MyResourceGroup", - account_name="MyAccount", - object_anchors_account={ - "identity": {"type": "SystemAssigned"}, - "location": "eastus2euap", - "tags": {"hero": "romeo", "heroine": "juliet"}, - }, - ) - print(response) - - -# x-ms-original-file: specification/mixedreality/resource-manager/Microsoft.MixedReality/preview/2021-03-01-preview/examples/object-anchors/Patch.json -if __name__ == "__main__": - main() diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/update_remote_rendering_account.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/update_remote_rendering_account.py deleted file mode 100644 index fc8f069d1107..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/update_remote_rendering_account.py +++ /dev/null @@ -1,46 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.mixedreality import MixedRealityClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-mixedreality -# USAGE - python update_remote_rendering_account.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MixedRealityClient( - credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - ) - - response = client.remote_rendering_accounts.update( - resource_group_name="MyResourceGroup", - account_name="MyAccount", - remote_rendering_account={ - "identity": {"type": "SystemAssigned"}, - "location": "eastus2euap", - "tags": {"hero": "romeo", "heroine": "juliet"}, - }, - ) - print(response) - - -# x-ms-original-file: specification/mixedreality/resource-manager/Microsoft.MixedReality/preview/2021-03-01-preview/examples/remote-rendering/Patch.json -if __name__ == "__main__": - main() diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/update_spatial_anchors_account.py b/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/update_spatial_anchors_account.py deleted file mode 100644 index 99c7dcc523b0..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/generated_samples/update_spatial_anchors_account.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential -from azure.mgmt.mixedreality import MixedRealityClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-mixedreality -# USAGE - python update_spatial_anchors_account.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = MixedRealityClient( - credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - ) - - response = client.spatial_anchors_accounts.update( - resource_group_name="MyResourceGroup", - account_name="MyAccount", - spatial_anchors_account={"location": "eastus2euap", "tags": {"hero": "romeo", "heroine": "juliet"}}, - ) - print(response) - - -# x-ms-original-file: specification/mixedreality/resource-manager/Microsoft.MixedReality/preview/2021-03-01-preview/examples/spatial-anchors/Patch.json -if __name__ == "__main__": - main() diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/pyproject.toml b/sdk/mixedreality/azure-mgmt-mixedreality/pyproject.toml deleted file mode 100644 index 540da07d41af..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/pyproject.toml +++ /dev/null @@ -1,6 +0,0 @@ -[tool.azure-sdk-build] -breaking = false -mypy = false -pyright = false -type_check_samples = false -verifytypes = false diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/sdk_packaging.toml b/sdk/mixedreality/azure-mgmt-mixedreality/sdk_packaging.toml deleted file mode 100644 index 61456eb222fa..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/sdk_packaging.toml +++ /dev/null @@ -1,8 +0,0 @@ -[packaging] -package_name = "azure-mgmt-mixedreality" -package_nspkg = "azure-mgmt-nspkg" -package_pprint_name = "Mixed Reality Management" -package_doc_id = "" -is_stable = false -is_arm = true -title = "MixedRealityClient" diff --git a/sdk/mixedreality/azure-mgmt-mixedreality/setup.py b/sdk/mixedreality/azure-mgmt-mixedreality/setup.py deleted file mode 100644 index 1a1f06fb789a..000000000000 --- a/sdk/mixedreality/azure-mgmt-mixedreality/setup.py +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env python - -#------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -#-------------------------------------------------------------------------- - -import re -import os.path -from io import open -from setuptools import find_packages, setup - -# Change the PACKAGE_NAME only to change folder and different name -PACKAGE_NAME = "azure-mgmt-mixedreality" -PACKAGE_PPRINT_NAME = "Mixed Reality Management" - -# a-b-c => a/b/c -package_folder_path = PACKAGE_NAME.replace('-', '/') -# a-b-c => a.b.c -namespace_name = PACKAGE_NAME.replace('-', '.') - -# Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, 'version.py') - if os.path.exists(os.path.join(package_folder_path, 'version.py')) - else os.path.join(package_folder_path, '_version.py'), 'r') as fd: - version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', - fd.read(), re.MULTILINE).group(1) - -if not version: - raise RuntimeError('Cannot find version information') - -with open('README.md', encoding='utf-8') as f: - readme = f.read() -with open('CHANGELOG.md', encoding='utf-8') as f: - changelog = f.read() - -setup( - name=PACKAGE_NAME, - version=version, - description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), - long_description=readme + '\n\n' + changelog, - long_description_content_type='text/markdown', - license='MIT License', - author='Microsoft Corporation', - author_email='azpysdkhelp@microsoft.com', - url='https://github.com/Azure/azure-sdk-for-python', - keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product - classifiers=[ - 'Development Status :: 4 - Beta', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'License :: OSI Approved :: MIT License', - ], - zip_safe=False, - packages=find_packages(exclude=[ - 'tests', - # Exclude packages that will be covered by PEP420 or nspkg - 'azure', - 'azure.mgmt', - ]), - include_package_data=True, - package_data={ - 'pytyped': ['py.typed'], - }, - install_requires=[ - "msrest>=0.7.1", - "azure-common~=1.1", - "azure-mgmt-core>=1.3.2,<2.0.0", - "typing-extensions>=4.3.0; python_version<'3.8.0'", - ], - python_requires=">=3.7" -) diff --git a/sdk/mixedreality/azure-mixedreality-authentication/CHANGELOG.md b/sdk/mixedreality/azure-mixedreality-authentication/CHANGELOG.md deleted file mode 100644 index a6212e593184..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/CHANGELOG.md +++ /dev/null @@ -1,19 +0,0 @@ -# Release History - -## 1.0.0b2 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - -- Python 2.7 is no longer supported. Please use Python version 3.7 or later. - -## 1.0.0b1 (2021-11-12) - -### Features Added - -- Initial release with support for authenticating with Mixed Reality services. diff --git a/sdk/mixedreality/azure-mixedreality-authentication/LICENSE.txt b/sdk/mixedreality/azure-mixedreality-authentication/LICENSE.txt deleted file mode 100644 index 0313a903d76c..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2017 Microsoft - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/sdk/mixedreality/azure-mixedreality-authentication/MANIFEST.in b/sdk/mixedreality/azure-mixedreality-authentication/MANIFEST.in deleted file mode 100644 index 32cef2d569d3..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/MANIFEST.in +++ /dev/null @@ -1,7 +0,0 @@ -include *.md -include azure/__init__.py -include azure/mixedreality/__init__.py -include LICENSE.txt -recursive-include tests *.py -recursive-include samples *.py *.md -include azure/mixedreality/authentication/py.typed diff --git a/sdk/mixedreality/azure-mixedreality-authentication/README.md b/sdk/mixedreality/azure-mixedreality-authentication/README.md deleted file mode 100644 index f938b0ea2681..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/README.md +++ /dev/null @@ -1,195 +0,0 @@ -[![Build Status](https://dev.azure.com/azure-sdk/public/_apis/build/status/azure-sdk-for-python.client?branchName=master)](https://dev.azure.com/azure-sdk/public/_build/latest?definitionId=46?branchName=master) - -# Azure Mixed Reality Authentication Package client library for Python - -Mixed Reality services, like Azure Remote Rendering use the Mixed Reality security -token service (STS) for authentication. This package supports exchanging Mixed Reality account credentials for an access -token from the STS that can be used to access Mixed Reality services. - -# Getting started - -## Currently supported environments - -This package has been tested with Python 3.7+. - -## Prerequisites - -- An [Azure subscription][azure_sub]. -- You must have an account with an [Azure Mixed Reality service](https://azure.microsoft.com/topic/mixed-reality/): - - [Azure Remote Rendering](https://docs.microsoft.com/azure/remote-rendering/) -- Familiarity with the authentication and credential concepts from the [Azure Identity library][azure_identity]. -- Python 3.7 or later is required to use this package. - -## Install the package - -Install the Azure Mixed Reality Authentication SDK. - -```bash -pip install --pre azure-mixedreality-authentication -``` - -## Create and authenticate the client - -To create a client object to request an access token for a Mixed Reality service, you will need the `account identifier` -and `account domain` of your Mixed Reality service resource and a `credential`. - -Mixed Reality services support a few different forms of authentication: - -- Account Key authentication - - Account keys enable you to get started quickly with using Mixed Reality services. But before you deploy your application - to production, we recommend that you update your app to use Azure AD authentication. -- Azure Active Directory (AD) token authentication - - If you're building an enterprise application and your company is using Azure AD as its identity system, you can use - user-based Azure AD authentication in your app. You then grant access to your Mixed Reality accounts by using your - existing Azure AD security groups. You can also grant access directly to users in your organization. - - Otherwise, we recommend that you obtain Azure AD tokens from a web service that supports your app. We recommend this - method for production applications because it allows you to avoid embedding the credentials for access to a Mixed - Reality service in your client application. - -See [here][register_aad_app] for detailed instructions and information. - -### Using account key authentication - -Use the [Azure Portal][azure_portal] to browse to your Mixed Reality service resource and retrieve an `account key`. - -Once you have an account key, you can use the `AzureKeyCredential` class to authenticate the client as follows: - -```python -from azure.core.credentials import AzureKeyCredential -from azure.mixedreality.authentication import MixedRealityStsClient - -account_id = "" -account_domain = "" -account_key = "" -key_credential = AzureKeyCredential(account_key) - -client = MixedRealityStsClient(account_id, account_domain, key_credential) -``` - -> Note: Account key authentication is **not recommended** for production applications. - -### Using an Azure Active Directory Credential - -Account key authentication is used in most of the examples, but you can also authenticate with Azure Active Directory -using the [Azure Identity library][azure_identity]. This is the recommended method for production applications. To use -the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with -the Azure SDK, please install the `@azure/identity` package: - -You will also need to [register a new AAD application][register_aad_app] and grant access to your Mixed Reality resource -by assigning the appropriate role for your Mixed Reality service to your service principal. - -```python -from azure.identity import DefaultAzureCredential -from azure.mixedreality.authentication import MixedRealityStsClient - -account_id = "" -account_domain = "" -default_credential = DefaultAzureCredential() - -client = MixedRealityStsClient(account_id, account_domain, default_credential) -``` - -# Key concepts - -## MixedRealityStsClient - -The `MixedRealityStsClient` is the client library used to access the Mixed Reality STS to get an access token. An access -token can be retrieved by calling `get_token()` on an `MixedRealityStsClient` instance. - -Tokens obtained from the Mixed Reality STS have a lifetime of **24 hours**. - -### Token result value - -The return value for a successful call to `get_token` is an `azure.core.credentials.AccessToken`. - -See the authentication examples [above](#create-and-authenticate-the-client) or [Azure Identity][azure_identity] for more complex -authentication scenarios. - -## Retrieve an access token synchronously - -```python -from azure.core.credentials import AzureKeyCredential -from azure.mixedreality.authentication import MixedRealityStsClient - -account_id = "" -account_domain = "" -account_key = "" -key_credential = AzureKeyCredential(account_key) - -client = MixedRealityStsClient(account_id, account_domain, key_credential) - -token = client.get_token() -``` - -## Retrieve an access token asynchronously - -```python -from azure.core.credentials import AzureKeyCredential -from azure.mixedreality.authentication.aio import MixedRealityStsClient - -account_id = "" -account_domain = "" -account_key = "" -key_credential = AzureKeyCredential(account_key) - -client = MixedRealityStsClient(account_id, account_domain, key_credential) - -token = await client.get_token() -``` - -# Examples - -These are code samples that show common scenario operations with the Azure Mixed Reality Authentication client library. -The async versions of the samples (the python sample files appended with `_async`) show asynchronous operations, -and require Python 3.5 or later. -Before running the sample code, refer to Prerequisites - -to create a resource, then set some Environment Variables - -```bash -set MIXEDREALITY_ACCOUNT_DOMAIN="" -set MIXEDREALITY_ACCOUNT_ID="" -set MIXEDREALITY_ACCOUNT_KEY="" - -pip install azure-mixedreality-authentication - -python samples\client_sample.py -python samples\client_sample_async.py -``` - -# Troubleshooting - -The [troubleshooting](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#troubleshooting) -section for Azure Identity can be helpful when troubleshooting authentication issues. - -# Next steps - -## Mixed Reality client libraries - -- Coming soon - -## Contributing - -This project welcomes contributions and suggestions. Most contributions require you to agree to a -Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us -the rights to use your contribution. For details, visit https://cla.microsoft.com. - -When you submit a pull request, a CLA-bot will automatically determine whether you need to provide -a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions -provided by the bot. You will only need to do this once across all repos using our CLA. - -This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). -For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or -contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. - -If you'd like to contribute to this library, please read the -[contributing guide](https://github.com/Azure/azure-sdk-for-python/blob/main/CONTRIBUTING.md) to learn more about how to -build and test the code. - - - -[azure_cli]: https://docs.microsoft.com/cli/azure -[azure_sub]: https://azure.microsoft.com/free/ -[azure_portal]: https://portal.azure.com -[azure_identity]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity -[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential diff --git a/sdk/mixedreality/azure-mixedreality-authentication/assets.json b/sdk/mixedreality/azure-mixedreality-authentication/assets.json deleted file mode 100644 index 888c9f29c997..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/assets.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "AssetsRepo": "Azure/azure-sdk-assets", - "AssetsRepoPrefixPath": "python", - "TagPrefix": "python/mixedreality/azure-mixedreality-authentication", - "Tag": "python/mixedreality/azure-mixedreality-authentication_538332f610" -} diff --git a/sdk/mixedreality/azure-mixedreality-authentication/azure/__init__.py b/sdk/mixedreality/azure-mixedreality-authentication/azure/__init__.py deleted file mode 100644 index 431ed648086a..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/azure/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore diff --git a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/__init__.py b/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/__init__.py deleted file mode 100644 index 431ed648086a..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore diff --git a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/__init__.py b/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/__init__.py deleted file mode 100644 index 2996cdaaeb4c..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/__init__.py +++ /dev/null @@ -1,11 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -from ._version import VERSION -from ._client import MixedRealityStsClient - -__version__ = VERSION -__all__ = ['MixedRealityStsClient'] diff --git a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_client.py b/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_client.py deleted file mode 100644 index fbbe3ac3a9af..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_client.py +++ /dev/null @@ -1,113 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING - -try: - from urllib.parse import urlparse -except ImportError: - from urlparse import urlparse # type: ignore - -from azure.core.credentials import AzureKeyCredential -from azure.core.tracing.decorator import distributed_trace -from azure.core.pipeline.policies import BearerTokenCredentialPolicy - -from ._generated import MixedRealityStsRestClient -from ._generated.models import TokenRequestOptions -from ._version import SDK_MONIKER -from ._shared.authentication_endpoint import construct_endpoint_url -from ._shared.mixedreality_account_key_credential import MixedRealityAccountKeyCredential -from ._utils import convert_to_access_token, generate_cv_base - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Union - from azure.core.credentials import TokenCredential - from azure.core.credentials import AccessToken - - -class MixedRealityStsClient(object): # pylint: disable=client-accepts-api-version-keyword - """ A client to interact with the Mixed Reality STS service. - - :param str account_id: - The Mixed Reality service account identifier. - :param str account_domain: - The Mixed Reality service account domain. - :param Union[TokenCredential, AzureKeyCredential] credential: - The credential used to access the Mixed Reality service. - :keyword str custom_endpoint_url: - Override the Mixed Reality STS service endpoint. - """ - - def __init__(self, account_id, account_domain, credential, **kwargs): - # type: (str, str, Union[TokenCredential, AzureKeyCredential], Any) -> None - if not account_id: - raise ValueError("account_id must be a non-empty string.") - - if not account_domain: - raise ValueError("account_domain must be a non-empty string.") - - if not credential: - raise ValueError("credential can not be None.") - - self._account_id = account_id - self._account_domain = account_domain - - if isinstance(credential, AzureKeyCredential): - credential = MixedRealityAccountKeyCredential(account_id, credential) - - self._credential = credential - - endpoint_url = kwargs.pop('custom_endpoint_url', construct_endpoint_url(account_domain)) - - try: - if not endpoint_url.lower().startswith('http'): - endpoint_url = "https://" + endpoint_url - except AttributeError as e: - raise ValueError("Host URL must be a string.") from e - - parsed_url = urlparse(endpoint_url.rstrip('/')) - if not parsed_url.netloc: - raise ValueError("Invalid URL: {}".format(endpoint_url)) - - self._endpoint_url = endpoint_url - - authentication_policy = BearerTokenCredentialPolicy(credential, endpoint_url + '/.default') - - self._client = MixedRealityStsRestClient( - base_url=endpoint_url, - authentication_policy=authentication_policy, - sdk_moniker=SDK_MONIKER, - **kwargs) - - @distributed_trace - def get_token(self, **kwargs): - # type: (Any) -> AccessToken - """ - Retrieve a token from the STS service for the specified account identifier asynchronously. - :return: Instance of azure.core.credentials.AccessToken - token and expiry date of it - :rtype: ~azure.core.credentials.AccessToken - """ - token_request_options = TokenRequestOptions() - token_request_options.client_request_id = generate_cv_base() - - response = self._client.get_token( - self._account_id, - token_request_options=token_request_options, - **kwargs) - return convert_to_access_token(response) - - def close(self): - # type: () -> None - self._client.close() - - def __enter__(self): - # type: () -> MixedRealityStsClient - self._client.__enter__() # pylint:disable=no-member - return self - - def __exit__(self, *args): - # type: (*Any) -> None - self._client.__exit__(*args) # pylint:disable=no-member diff --git a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/__init__.py b/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/__init__.py deleted file mode 100644 index 86838c6b621e..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# 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 ._mixed_reality_sts_rest_client import MixedRealityStsRestClient -__all__ = ['MixedRealityStsRestClient'] - -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass diff --git a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/_configuration.py b/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/_configuration.py deleted file mode 100644 index 9a762cc1fa5c..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/_configuration.py +++ /dev/null @@ -1,51 +0,0 @@ -# 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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - -VERSION = "unknown" - -class MixedRealityStsRestClientConfiguration(Configuration): - """Configuration for MixedRealityStsRestClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - """ - - def __init__( - self, - **kwargs # type: Any - ): - # type: (...) -> None - super(MixedRealityStsRestClientConfiguration, self).__init__(**kwargs) - - kwargs.setdefault('sdk_moniker', 'mixedrealitystsrestclient/{}'.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 policies.HttpLoggingPolicy(**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') diff --git a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/_mixed_reality_sts_rest_client.py b/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/_mixed_reality_sts_rest_client.py deleted file mode 100644 index 53973ea0933f..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/_mixed_reality_sts_rest_client.py +++ /dev/null @@ -1,57 +0,0 @@ -# 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 import PipelineClient -from msrest import Deserializer, Serializer - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - -from ._configuration import MixedRealityStsRestClientConfiguration -from .operations import MixedRealityStsRestClientOperationsMixin -from . import models - - -class MixedRealityStsRestClient(MixedRealityStsRestClientOperationsMixin): - """Definition for the Mixed Reality Cloud STS service APIs. - - :param str base_url: Service URL - """ - - def __init__( - self, - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://sts.mixedreality.azure.com' - self._config = MixedRealityStsRestClientConfiguration(**kwargs) - self._client = PipelineClient(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) - - - def close(self): - # type: () -> None - self._client.close() - - def __enter__(self): - # type: () -> MixedRealityStsRestClient - self._client.__enter__() - return self - - def __exit__(self, *exc_details): - # type: (Any) -> None - self._client.__exit__(*exc_details) diff --git a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/aio/__init__.py b/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/aio/__init__.py deleted file mode 100644 index 17251fcb2dbf..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/aio/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -# 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 ._mixed_reality_sts_rest_client import MixedRealityStsRestClient -__all__ = ['MixedRealityStsRestClient'] diff --git a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/aio/_configuration.py b/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/aio/_configuration.py deleted file mode 100644 index 6045303ca6c1..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/aio/_configuration.py +++ /dev/null @@ -1,45 +0,0 @@ -# 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, Optional - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies - -VERSION = "unknown" - -class MixedRealityStsRestClientConfiguration(Configuration): - """Configuration for MixedRealityStsRestClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - """ - - def __init__( - self, - **kwargs: Any - ) -> None: - super(MixedRealityStsRestClientConfiguration, self).__init__(**kwargs) - - kwargs.setdefault('sdk_moniker', 'mixedrealitystsrestclient/{}'.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 policies.HttpLoggingPolicy(**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') diff --git a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/aio/_mixed_reality_sts_rest_client.py b/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/aio/_mixed_reality_sts_rest_client.py deleted file mode 100644 index 593e47542967..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/aio/_mixed_reality_sts_rest_client.py +++ /dev/null @@ -1,49 +0,0 @@ -# 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, Optional - -from azure.core import AsyncPipelineClient -from msrest import Deserializer, Serializer - -from ._configuration import MixedRealityStsRestClientConfiguration -from .operations import MixedRealityStsRestClientOperationsMixin -from .. import models - - -class MixedRealityStsRestClient(MixedRealityStsRestClientOperationsMixin): - """Definition for the Mixed Reality Cloud STS service APIs. - - :param str base_url: Service URL - """ - - def __init__( - self, - base_url: Optional[str] = None, - **kwargs: Any - ) -> None: - if not base_url: - base_url = 'https://sts.mixedreality.azure.com' - self._config = MixedRealityStsRestClientConfiguration(**kwargs) - self._client = AsyncPipelineClient(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) - - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "MixedRealityStsRestClient": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/aio/operations/__init__.py b/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/aio/operations/__init__.py deleted file mode 100644 index 56b55f918c06..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/aio/operations/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -# 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 ._mixed_reality_sts_rest_client_operations import MixedRealityStsRestClientOperationsMixin - -__all__ = [ - 'MixedRealityStsRestClientOperationsMixin', -] diff --git a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/aio/operations/_mixed_reality_sts_rest_client_operations.py b/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/aio/operations/_mixed_reality_sts_rest_client_operations.py deleted file mode 100644 index 90031d443396..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/aio/operations/_mixed_reality_sts_rest_client_operations.py +++ /dev/null @@ -1,89 +0,0 @@ -# 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, 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, HttpRequest - -from ... import models as _models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class MixedRealityStsRestClientOperationsMixin: - - async def get_token( - self, - account_id: str, - api_version: Optional[str] = "2019-02-28-preview", - token_request_options: Optional["_models.TokenRequestOptions"] = None, - **kwargs - ) -> "_models.StsTokenResponseMessage": - """Gets an access token to be used with Mixed Reality services. - - Gets an access token to be used with Mixed Reality services. - - :param account_id: The Mixed Reality account identifier. - :type account_id: str - :param api_version: Api Version. - :type api_version: str - :param token_request_options: Parameter group. - :type token_request_options: ~azure.mixedreality.authentication._generated.models.TokenRequestOptions - :keyword callable cls: A custom type or function that will be passed the direct response - :return: StsTokenResponseMessage, or the result of cls(response) - :rtype: ~azure.mixedreality.authentication._generated.models.StsTokenResponseMessage - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StsTokenResponseMessage"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - _client_request_id = None - if token_request_options is not None: - _client_request_id = token_request_options.client_request_id - accept = "application/json" - - # Construct URL - url = self.get_token.metadata['url'] # type: ignore - path_format_arguments = { - 'accountId': self._serialize.url("account_id", account_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if api_version is not None: - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if _client_request_id is not None: - header_parameters['X-MRC-CV'] = self._serialize.header("client_request_id", _client_request_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - 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) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers['MS-CV']=self._deserialize('str', response.headers.get('MS-CV')) - deserialized = self._deserialize('StsTokenResponseMessage', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - get_token.metadata = {'url': '/Accounts/{accountId}/token'} # type: ignore diff --git a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/models/__init__.py b/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/models/__init__.py deleted file mode 100644 index 6e706bc24cdc..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/models/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -try: - from ._models_py3 import StsTokenResponseMessage - from ._models_py3 import TokenRequestOptions -except (SyntaxError, ImportError): - from ._models import StsTokenResponseMessage # type: ignore - from ._models import TokenRequestOptions # type: ignore - -__all__ = [ - 'StsTokenResponseMessage', - 'TokenRequestOptions', -] diff --git a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/models/_models.py b/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/models/_models.py deleted file mode 100644 index 2b8d812be323..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/models/_models.py +++ /dev/null @@ -1,54 +0,0 @@ -# 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 msrest.serialization - - -class StsTokenResponseMessage(msrest.serialization.Model): - """Represents a token response message from the STS service. - - All required parameters must be populated in order to send to Azure. - - :param access_token: Required. An access token for the account. - :type access_token: str - """ - - _validation = { - 'access_token': {'required': True}, - } - - _attribute_map = { - 'access_token': {'key': 'AccessToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StsTokenResponseMessage, self).__init__(**kwargs) - self.access_token = kwargs['access_token'] - - -class TokenRequestOptions(msrest.serialization.Model): - """Parameter group. - - :param client_request_id: The client request correlation vector, which should be set to a new - value for each request. Useful when debugging with Microsoft. - :type client_request_id: str - """ - - _attribute_map = { - 'client_request_id': {'key': 'clientRequestId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TokenRequestOptions, self).__init__(**kwargs) - self.client_request_id = kwargs.get('client_request_id', None) diff --git a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/models/_models_py3.py b/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/models/_models_py3.py deleted file mode 100644 index 5ecff28c8992..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/models/_models_py3.py +++ /dev/null @@ -1,60 +0,0 @@ -# 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 Optional - -import msrest.serialization - - -class StsTokenResponseMessage(msrest.serialization.Model): - """Represents a token response message from the STS service. - - All required parameters must be populated in order to send to Azure. - - :param access_token: Required. An access token for the account. - :type access_token: str - """ - - _validation = { - 'access_token': {'required': True}, - } - - _attribute_map = { - 'access_token': {'key': 'AccessToken', 'type': 'str'}, - } - - def __init__( - self, - *, - access_token: str, - **kwargs - ): - super(StsTokenResponseMessage, self).__init__(**kwargs) - self.access_token = access_token - - -class TokenRequestOptions(msrest.serialization.Model): - """Parameter group. - - :param client_request_id: The client request correlation vector, which should be set to a new - value for each request. Useful when debugging with Microsoft. - :type client_request_id: str - """ - - _attribute_map = { - 'client_request_id': {'key': 'clientRequestId', 'type': 'str'}, - } - - def __init__( - self, - *, - client_request_id: Optional[str] = None, - **kwargs - ): - super(TokenRequestOptions, self).__init__(**kwargs) - self.client_request_id = client_request_id diff --git a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/operations/__init__.py b/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/operations/__init__.py deleted file mode 100644 index 56b55f918c06..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/operations/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -# 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 ._mixed_reality_sts_rest_client_operations import MixedRealityStsRestClientOperationsMixin - -__all__ = [ - 'MixedRealityStsRestClientOperationsMixin', -] diff --git a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/operations/_mixed_reality_sts_rest_client_operations.py b/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/operations/_mixed_reality_sts_rest_client_operations.py deleted file mode 100644 index 8b8628e0c285..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/operations/_mixed_reality_sts_rest_client_operations.py +++ /dev/null @@ -1,94 +0,0 @@ -# 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 -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 HttpRequest, HttpResponse - -from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class MixedRealityStsRestClientOperationsMixin(object): - - def get_token( - self, - account_id, # type: str - api_version="2019-02-28-preview", # type: Optional[str] - token_request_options=None, # type: Optional["_models.TokenRequestOptions"] - **kwargs # type: Any - ): - # type: (...) -> "_models.StsTokenResponseMessage" - """Gets an access token to be used with Mixed Reality services. - - Gets an access token to be used with Mixed Reality services. - - :param account_id: The Mixed Reality account identifier. - :type account_id: str - :param api_version: Api Version. - :type api_version: str - :param token_request_options: Parameter group. - :type token_request_options: ~azure.mixedreality.authentication._generated.models.TokenRequestOptions - :keyword callable cls: A custom type or function that will be passed the direct response - :return: StsTokenResponseMessage, or the result of cls(response) - :rtype: ~azure.mixedreality.authentication._generated.models.StsTokenResponseMessage - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StsTokenResponseMessage"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - _client_request_id = None - if token_request_options is not None: - _client_request_id = token_request_options.client_request_id - accept = "application/json" - - # Construct URL - url = self.get_token.metadata['url'] # type: ignore - path_format_arguments = { - 'accountId': self._serialize.url("account_id", account_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if api_version is not None: - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if _client_request_id is not None: - header_parameters['X-MRC-CV'] = self._serialize.header("client_request_id", _client_request_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = 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) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers['MS-CV']=self._deserialize('str', response.headers.get('MS-CV')) - deserialized = self._deserialize('StsTokenResponseMessage', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - get_token.metadata = {'url': '/Accounts/{accountId}/token'} # type: ignore diff --git a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/py.typed b/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_generated/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_shared/__init__.py b/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_shared/__init__.py deleted file mode 100644 index 5b396cd202e8..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_shared/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- diff --git a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_shared/aio/__init__.py b/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_shared/aio/__init__.py deleted file mode 100644 index 5b396cd202e8..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_shared/aio/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- diff --git a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_shared/aio/mixed_reality_token_credential.py b/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_shared/aio/mixed_reality_token_credential.py deleted file mode 100644 index 7cc4e98d8bc6..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_shared/aio/mixed_reality_token_credential.py +++ /dev/null @@ -1,67 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING - -from azure.mixedreality.authentication.aio import MixedRealityStsClient -from .static_access_token_credential import StaticAccessTokenCredential - -if TYPE_CHECKING: - from typing import Any - from azure.core.credentials import AccessToken - from azure.core.credentials_async import AsyncTokenCredential - -def get_mixedreality_credential( - account_id: str, - account_domain: str, - endpoint_url: str, - credential: "AsyncTokenCredential", - **kwargs): - if isinstance(credential, StaticAccessTokenCredential): - return credential - - return MixedRealityTokenCredential( - account_id=account_id, - account_domain=account_domain, - endpoint_url=endpoint_url, - credential=credential, - **kwargs) - - -class MixedRealityTokenCredential(object): - """ Represents a token credential that can be used to access a Mixed Reality service. - This implements the TokenCredential protocol. - - :param str account_id: The Mixed Reality service account identifier. - :param str endpoint_url: The Mixed Reality STS service endpoint. - :param TokenCredential credential: The credential used to access the Mixed Reality service. - """ - - def __init__( - self, - account_id: str, - account_domain: str, - endpoint_url: str, - credential: "AsyncTokenCredential", - **kwargs): - self.stsClient = MixedRealityStsClient( - account_id=account_id, - account_domain=account_domain, - endpoint_url=endpoint_url, - credential=credential, - **kwargs) - - async def get_token(self, *scopes: str, **kwargs: "Any") -> "AccessToken": #pylint: disable=unused-argument - return await self.stsClient.get_token(**kwargs) - - async def close(self) -> None: - self.stsClient.close() - - async def __aenter__(self): - await self.stsClient.__aenter__() - return self - - async def __aexit__(self, exc_type, exc_value, traceback) -> None: - await self.stsClient.__aexit__() diff --git a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_shared/aio/mixedreality_account_key_credential.py b/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_shared/aio/mixedreality_account_key_credential.py deleted file mode 100644 index 2f9efb559a53..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_shared/aio/mixedreality_account_key_credential.py +++ /dev/null @@ -1,54 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING - -from datetime import date, datetime - -from azure.core.credentials import AccessToken - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import AzureKeyCredential - -ACCOUNT_KEY_VALID_YEARS = 10 - -class MixedRealityAccountKeyCredential(object): - """ Represents an object used for Mixed Reality account key authentication. - - :param str account_id: The Mixed Reality service account identifier. - :param AzureKeyCredential account_key: The Mixed Reality service account primary or secondary key credential. - """ - - def __init__(self, account_id, account_key): - # type: (str, AzureKeyCredential) -> None - self.account_id = account_id - self.account_key = account_key - - async def get_token(self, *scopes: str, **kwargs: "Any") -> "AccessToken": #pylint: disable=unused-argument - token = self.account_id + ":" + self.account_key.key - - # No way to know when an account key might expire, so we'll set the - # access token wrapping it to expire 10 years in the future. - expiration_date = _add_years(datetime.now(), ACCOUNT_KEY_VALID_YEARS) - expiration_timestamp = int(expiration_date.timestamp()) - - return AccessToken(token, expiration_timestamp) - - async def close(self) -> None: - pass - - async def __aenter__(self): - pass - - async def __aexit__(self, exc_type, exc_value, traceback) -> None: - pass - -def _add_years(date_to_update, years): - try: - return date_to_update.replace(year=date_to_update.year + years) - except ValueError: - return date_to_update + (date(date_to_update.year + years, 1, 1) - date(date_to_update.year, 1, 1)) diff --git a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_shared/aio/static_access_token_credential.py b/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_shared/aio/static_access_token_credential.py deleted file mode 100644 index fccbd6f1a2b0..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_shared/aio/static_access_token_credential.py +++ /dev/null @@ -1,38 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials_async import AsyncTokenCredential - from azure.core.credentials import AccessToken - -class StaticAccessTokenCredential(object): - """ Represents a static access token credential. - This implements the AsyncTokenCredential protocol. - - :param AccessToken access_token: An access token. - """ - - def __init__(self, access_token: "AccessToken"): - self._access_token = access_token - - async def get_token( - self, - #pylint: disable=unused-argument - *scopes: str, - **kwargs: "Any") -> "AccessToken": - return self._access_token - - async def close(self) -> None: - pass - - async def __aenter__(self): - pass - - async def __aexit__(self, exc_type, exc_value, traceback) -> None: - pass diff --git a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_shared/authentication_endpoint.py b/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_shared/authentication_endpoint.py deleted file mode 100644 index 72bdcc70fd96..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_shared/authentication_endpoint.py +++ /dev/null @@ -1,9 +0,0 @@ -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -def construct_endpoint_url(account_domain): - # type: (str) -> str - return 'https://sts.' + account_domain diff --git a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_shared/mixed_reality_token_credential.py b/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_shared/mixed_reality_token_credential.py deleted file mode 100644 index e0bb1dda3627..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_shared/mixed_reality_token_credential.py +++ /dev/null @@ -1,50 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING - -from azure.mixedreality.authentication import MixedRealityStsClient -from .static_access_token_credential import StaticAccessTokenCredential - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Union - from azure.core.credentials import AccessToken, TokenCredential - - -def get_mixedreality_credential(account_id, account_domain, endpoint_url, credential, **kwargs): - # type: (str, str, str, TokenCredential, Any) -> TokenCredential - if isinstance(credential, StaticAccessTokenCredential): - return credential - - return MixedRealityTokenCredential( - account_id=account_id, - account_domain=account_domain, - endpoint_url=endpoint_url, - credential=credential, - **kwargs) - - -class MixedRealityTokenCredential(object): - """ Represents a token credential that can be used to access a Mixed Reality service. - This implements the TokenCredential protocol. - - :param str account_id: The Mixed Reality service account identifier. - :param str endpoint_url: The Mixed Reality STS service endpoint. - :param TokenCredential credential: The credential used to access the Mixed Reality service. - """ - - def __init__(self, account_id, account_domain, endpoint_url, credential, **kwargs): - # type: (str, str, str, TokenCredential, Any) -> None - self.stsClient = MixedRealityStsClient( - account_id=account_id, - account_domain=account_domain, - endpoint_url=endpoint_url, - credential=credential, - **kwargs) - - def get_token(self, *scopes, **kwargs): #pylint: disable=unused-argument - # type: (*str, **Any) -> AccessToken - return self.stsClient.get_token(**kwargs) diff --git a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_shared/mixedreality_account_key_credential.py b/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_shared/mixedreality_account_key_credential.py deleted file mode 100644 index 75ac965d9c6f..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_shared/mixedreality_account_key_credential.py +++ /dev/null @@ -1,47 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -from datetime import date, datetime -import time - -from azure.core.credentials import AzureKeyCredential, AccessToken - - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any - -ACCOUNT_KEY_VALID_YEARS = 10 - -class MixedRealityAccountKeyCredential(object): - """ Represents an object used for Mixed Reality account key authentication. - - :param str account_id: The Mixed Reality service account identifier. - :param AzureKeyCredential account_key: The Mixed Reality service account primary or secondary key credential. - """ - - def __init__(self, account_id, account_key): - # type: (str, AzureKeyCredential) -> None - self.account_id = account_id - self.account_key = account_key - - def get_token(self, *scopes, **kwargs): #pylint: disable=unused-argument - # type: (*str, **Any) -> AccessToken - - token = self.account_id + ":" + self.account_key.key - - # No way to know when an account key might expire, so we'll set the - # access token wrapping it to expire 10 years in the future. - expiration_date = _add_years(datetime.now(), ACCOUNT_KEY_VALID_YEARS) - expiration_timestamp = int(time.mktime(expiration_date.timetuple())) - - return AccessToken(token, expiration_timestamp) - -def _add_years(date_to_update, years): - try: - return date_to_update.replace(year=date_to_update.year + years) - except ValueError: - return date_to_update + (date(date_to_update.year + years, 1, 1) - date(date_to_update.year, 1, 1)) diff --git a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_shared/static_access_token_credential.py b/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_shared/static_access_token_credential.py deleted file mode 100644 index 712f4e20738f..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_shared/static_access_token_credential.py +++ /dev/null @@ -1,27 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential - from azure.core.credentials import AccessToken - -class StaticAccessTokenCredential(object): - """ Represents a static access token credential. - This implements the TokenCredential protocol. - - :param AccessToken access_token: An access token. - """ - - def __init__(self, access_token): - # type: (AccessToken) -> None - self._access_token = access_token - - def get_token(self, *scopes, **kwargs): #pylint: disable=unused-argument - # type: (*str, **Any) -> AccessToken - return self._access_token diff --git a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_utils.py b/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_utils.py deleted file mode 100644 index 8cf512736233..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_utils.py +++ /dev/null @@ -1,85 +0,0 @@ -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -import base64 -import json -import random - -from azure.core.credentials import AccessToken - -from ._generated.models import StsTokenResponseMessage - - -def convert_to_access_token(token_response_message): - # type: (StsTokenResponseMessage) -> AccessToken - """Converts the specified token response message to an AccessToken. - - :param token_response_message: the token response message to be converted. - :type token_response_message: str - :returns: AccessToken - :rtype: ~azure.core.credentials.AccessToken - """ - if not token_response_message: - raise ValueError("token_response_message must be a non-empty string.") - - expiration_timestamp = retrieve_jwt_expiration_timestamp(token_response_message.access_token) - - return AccessToken(token_response_message.access_token, expiration_timestamp) - -def retrieve_jwt_expiration_timestamp(jwt_value): - # type: (str) -> int - """ - Retrieves the expiration value from the JWT. - - :param str jwt_value: The JWT value. - :returns: int - :rtype: int - """ - if not jwt_value: - raise ValueError("jwt_value must be a non-empty string.") - - parts = jwt_value.split(".") - - if len(parts) < 3: - raise ValueError("Invalid JWT structure. Expected a JWS Compact Serialization formatted value.") - - try: - # JWT prefers no padding (see https://tools.ietf.org/id/draft-jones-json-web-token-02.html#base64urlnotes). - # We pad the value with the max padding of === to keep our logic simple and allow the base64 decoder to handle - # the value properly. b64decode will properly trim the padding appropriately, but apparently doesn't want to - # handle the addition of padding. - padded_base64_payload = base64.b64decode(parts[1] + "===").decode('utf-8') - payload = json.loads(padded_base64_payload) - except ValueError as e: - raise ValueError("Unable to decode the JWT.") from e - - try: - exp = payload['exp'] - except KeyError as e: - raise ValueError("Invalid JWT payload structure. No expiration.") from e - - return int(exp) - -BASE_64_CHAR_SET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" -CV_BASE_LENGTH = 22 - -def generate_cv_base(): - # type: () -> str - """ - Seed function to randomly generate a 16 character base64 encoded string for - the Correlation Vector's base value. - - :returns: str - :rtype: str - """ - result = '' - - #pylint: disable=unused-variable - for i in range(CV_BASE_LENGTH): - random_index = random.randint(0, len(BASE_64_CHAR_SET) - 1) - result += BASE_64_CHAR_SET[random_index] - - return result diff --git a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_version.py b/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_version.py deleted file mode 100644 index ac484776e6fb..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/_version.py +++ /dev/null @@ -1,10 +0,0 @@ -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -# matches SEMVER -VERSION = "1.0.0b2" - -SDK_MONIKER = "mixedreality-authentication/{}".format(VERSION) # type: str diff --git a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/aio/__init__.py b/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/aio/__init__.py deleted file mode 100644 index 736dc1c08fe4..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/aio/__init__.py +++ /dev/null @@ -1,11 +0,0 @@ -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -from ._client_async import MixedRealityStsClient - -__all__ = [ - 'MixedRealityStsClient' -] diff --git a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/aio/_client_async.py b/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/aio/_client_async.py deleted file mode 100644 index c73aa1b341e7..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/aio/_client_async.py +++ /dev/null @@ -1,112 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -# pylint: disable=unused-import,ungrouped-imports -from typing import Any, TYPE_CHECKING, Union - -try: - from urllib.parse import urlparse -except ImportError: - from urlparse import urlparse # type: ignore - -from azure.core.credentials import AzureKeyCredential -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.pipeline.policies import AsyncBearerTokenCredentialPolicy - -from .._generated.aio import MixedRealityStsRestClient -from .._generated.models import TokenRequestOptions -from .._version import SDK_MONIKER -from .._shared.authentication_endpoint import construct_endpoint_url -from .._shared.aio.mixedreality_account_key_credential import MixedRealityAccountKeyCredential -from .._utils import convert_to_access_token, generate_cv_base - -if TYPE_CHECKING: - from azure.core.credentials import AccessToken - from azure.core.credentials_async import AsyncTokenCredential - - -class MixedRealityStsClient(object): # pylint: disable=client-accepts-api-version-keyword - """ A client to interact with the Mixed Reality STS service. - - :param str account_id: - The Mixed Reality service account identifier. - :param str account_domain: - The Mixed Reality service account domain. - :param Union[TokenCredential, AzureKeyCredential] credential: - The credential used to access the Mixed Reality service. - :keyword str custom_endpoint_url: - Override the Mixed Reality STS service endpoint. - """ - - def __init__(self, - account_id: str, - account_domain: str, - credential: Union[AzureKeyCredential, "AsyncTokenCredential"], #pylint: disable=unsubscriptable-object - **kwargs) -> None: - if not account_id: - raise ValueError("account_id must be a non-empty string.") - - if not account_domain: - raise ValueError("account_domain must be a non-empty string.") - - if not credential: - raise ValueError("credential can not be None.") - - self._account_id = account_id - self._account_domain = account_domain - - if isinstance(credential, AzureKeyCredential): - credential = MixedRealityAccountKeyCredential(account_id, credential) - - self._credential = credential - - endpoint_url = kwargs.pop('custom_endpoint_url', construct_endpoint_url(account_domain)) - - try: - if not endpoint_url.lower().startswith('http'): - endpoint_url = "https://" + endpoint_url - except AttributeError as ex: - raise ValueError("Host URL must be a string.") from ex - - parsed_url = urlparse(endpoint_url.rstrip('/')) - if not parsed_url.netloc: - raise ValueError("Invalid URL: {}".format(endpoint_url)) - - self._endpoint_url = endpoint_url - - authentication_policy = AsyncBearerTokenCredentialPolicy(credential, [endpoint_url + '/.default']) - - self._client = MixedRealityStsRestClient( - base_url=endpoint_url, - authentication_policy=authentication_policy, - sdk_moniker=SDK_MONIKER, - **kwargs) - - @distributed_trace_async - async def get_token(self, **kwargs) -> "AccessToken": - """ - Retrieve a token from the STS service for the specified account identifier asynchronously. - :return: Instance of azure.core.credentials.AccessToken - token and expiry date of it - :rtype: :class:`azure.core.credentials.AccessToken` - """ - token_request_options = TokenRequestOptions() - token_request_options.client_request_id = generate_cv_base() - - response = await self._client.get_token( - self._account_id, - token_request_options=token_request_options, - **kwargs) - return convert_to_access_token(response) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "MixedRealityStsClient": - await self._client.__aenter__() - return self - - async def __aexit__(self, *args) -> None: - await self._client.__aexit__(*args) diff --git a/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/py.typed b/sdk/mixedreality/azure-mixedreality-authentication/azure/mixedreality/authentication/py.typed deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/sdk/mixedreality/azure-mixedreality-authentication/dev_requirements.txt b/sdk/mixedreality/azure-mixedreality-authentication/dev_requirements.txt deleted file mode 100644 index 0f91829e988c..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/dev_requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ --e ../../../eng/tools/azure-sdk-tools -../../core/azure-core -aiohttp>=3.0 diff --git a/sdk/mixedreality/azure-mixedreality-authentication/pyproject.toml b/sdk/mixedreality/azure-mixedreality-authentication/pyproject.toml deleted file mode 100644 index 1ea1e48c18ff..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/pyproject.toml +++ /dev/null @@ -1,3 +0,0 @@ -[tool.azure-sdk-build] -pyright = false -ci_enabled = false diff --git a/sdk/mixedreality/azure-mixedreality-authentication/samples/client_sample async.py b/sdk/mixedreality/azure-mixedreality-authentication/samples/client_sample async.py deleted file mode 100644 index 52ff3dddf0a4..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/samples/client_sample async.py +++ /dev/null @@ -1,69 +0,0 @@ - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: client_sample_async.py -DESCRIPTION: - These samples demonstrate creating a client and requesting a token. - -USAGE: - python client_sample_async.py - Set the environment variables with your own values before running the sample: - 1) MIXEDREALITY_ACCOUNT_DOMAIN - the Mixed Reality account domain. - 2) MIXEDREALITY_ACCOUNT_ID - the Mixed Reality account identifier. - 3) MIXEDREALITY_ACCOUNT_KEY - the Mixed Reality account primary or secondary key. -""" - - -import os -import asyncio - - -class ClientSamplesAsync(object): - from azure.core.credentials import AzureKeyCredential - - account_domain = os.environ.get("MIXEDREALITY_ACCOUNT_DOMAIN", None) - if not account_domain: - raise ValueError("Set MIXEDREALITY_ACCOUNT_DOMAIN env before run this sample.") - - account_id = os.environ.get("MIXEDREALITY_ACCOUNT_ID", None) - if not account_id: - raise ValueError("Set MIXEDREALITY_ACCOUNT_ID env before run this sample.") - - account_key = os.environ.get("MIXEDREALITY_ACCOUNT_KEY", None) - if not account_key: - raise ValueError("Set MIXEDREALITY_ACCOUNT_KEY env before run this sample.") - - key_credential = AzureKeyCredential(account_key) - - def create_client(self): - # [START create_client] - from azure.mixedreality.authentication.aio import MixedRealityStsClient - client = MixedRealityStsClient(self.account_id, self.account_domain, self.key_credential) - # [END create_client] - - print("client created") - - async def get_token(self): - from azure.mixedreality.authentication.aio import MixedRealityStsClient - client = MixedRealityStsClient(self.account_id, self.account_domain, self.key_credential) - - async with client: - # [START get_token] - access_token = await client.get_token() - # [END get_token] - - print("token retrieved: " + access_token.token) - - -async def main(): - sample = ClientSamplesAsync() - sample.create_client() - await sample.get_token() - -if __name__ == '__main__': - asyncio.run(main()) diff --git a/sdk/mixedreality/azure-mixedreality-authentication/samples/client_sample.py b/sdk/mixedreality/azure-mixedreality-authentication/samples/client_sample.py deleted file mode 100644 index 0de0e21a39de..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/samples/client_sample.py +++ /dev/null @@ -1,63 +0,0 @@ - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: client_sample.py -DESCRIPTION: - These samples demonstrate creating a client and requesting a token. - -USAGE: - python client_sample.py - Set the environment variables with your own values before running the sample: - 1) MIXEDREALITY_ACCOUNT_DOMAIN - the Mixed Reality account domain. - 2) MIXEDREALITY_ACCOUNT_ID - the Mixed Reality account identifier. - 3) MIXEDREALITY_ACCOUNT_KEY - the Mixed Reality account primary or secondary key. -""" - - -import os - - -class ClientSamples(object): - from azure.core.credentials import AzureKeyCredential - - account_domain = os.environ.get("MIXEDREALITY_ACCOUNT_DOMAIN", None) - if not account_domain: - raise ValueError("Set MIXEDREALITY_ACCOUNT_DOMAIN env before run this sample.") - - account_id = os.environ.get("MIXEDREALITY_ACCOUNT_ID", None) - if not account_id: - raise ValueError("Set MIXEDREALITY_ACCOUNT_ID env before run this sample.") - - account_key = os.environ.get("MIXEDREALITY_ACCOUNT_KEY", None) - if not account_key: - raise ValueError("Set MIXEDREALITY_ACCOUNT_KEY env before run this sample.") - - key_credential = AzureKeyCredential(account_key) - - def create_client(self): - # [START create_client] - from azure.mixedreality.authentication import MixedRealityStsClient - client = MixedRealityStsClient(self.account_id, self.account_domain, self.key_credential) - # [END create_client] - - print("client created") - - def get_token(self): - # [START get_token] - from azure.mixedreality.authentication import MixedRealityStsClient - client = MixedRealityStsClient(self.account_id, self.account_domain, self.key_credential) - access_token = client.get_token() - # [END get_token] - - print("token retrieved: " + access_token.token) - - -if __name__ == '__main__': - sample = ClientSamples() - sample.create_client() - sample.get_token() diff --git a/sdk/mixedreality/azure-mixedreality-authentication/sdk_packaging.toml b/sdk/mixedreality/azure-mixedreality-authentication/sdk_packaging.toml deleted file mode 100644 index 2684d587e162..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/sdk_packaging.toml +++ /dev/null @@ -1,7 +0,0 @@ -[packaging] -auto_update = false -package_name = "azure-mixedreality-authentication" -package_pprint_name = "Mixed Reality Authentication" -package_doc_id = "" -is_stable = false -is_arm = false diff --git a/sdk/mixedreality/azure-mixedreality-authentication/setup.py b/sdk/mixedreality/azure-mixedreality-authentication/setup.py deleted file mode 100644 index de2ff250d121..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/setup.py +++ /dev/null @@ -1,76 +0,0 @@ -from setuptools import setup, find_packages -import os -from io import open -import re - -# example setup.py Feel free to copy the entire "azure-template" folder into a package folder named -# with "azure-". Ensure that the below arguments to setup() are updated to reflect -# your package. - -PACKAGE_NAME = "azure-mixedreality-authentication" -PACKAGE_PPRINT_NAME = "Mixed Reality Authentication" - -# a-b-c => a/b/c -package_folder_path = PACKAGE_NAME.replace('-', '/') -# a-b-c => a.b.c -namespace_name = PACKAGE_NAME.replace('-', '.') - -# Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, '_version.py'), 'r') as fd: - version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', - fd.read(), re.MULTILINE).group(1) -if not version: - raise RuntimeError('Cannot find version information') - -with open('README.md', encoding='utf-8') as f: - readme = f.read() - -with open('CHANGELOG.md', encoding='utf-8') as f: - changelog = f.read() - -setup( - name=PACKAGE_NAME, - version=version, - description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), - - # ensure that these are updated to reflect the package owners' information - long_description=readme + "\n\n" + changelog, - long_description_content_type='text/markdown', - url='https://github.com/Azure/azure-sdk-for-python', - keywords="azure, azure sdk", - author='Microsoft Corporation', - author_email='azuresdkengsysadmins@microsoft.com', - - license='MIT License', - # ensure that the development status reflects the status of your package - classifiers=[ - "Development Status :: 4 - Beta", - 'Programming Language :: Python', - 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'License :: OSI Approved :: MIT License', - ], - packages=find_packages(exclude=[ - 'tests', - # Exclude packages that will be covered by PEP420 or nspkg - 'azure', - 'azure.mixedreality' - ]), - include_package_data=True, - package_data={ - 'pytyped': ['py.typed'], - }, - python_requires=">=3.7", - install_requires=[ - 'azure-core<2.0.0,>=1.4.0', - 'msrest>=0.6.21' - ], - project_urls={ - 'Bug Reports': 'https://github.com/Azure/azure-sdk-for-python/issues', - 'Source': 'https://github.com/Azure/azure-sdk-for-python', - } -) diff --git a/sdk/mixedreality/azure-mixedreality-authentication/swagger/SWAGGER.md b/sdk/mixedreality/azure-mixedreality-authentication/swagger/SWAGGER.md deleted file mode 100644 index 40af809e4840..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/swagger/SWAGGER.md +++ /dev/null @@ -1,30 +0,0 @@ -# Azure Mixed Reality Authentication Service client library for Python - -## Setup - -```ps -npm install -g autorest -``` - -## Generation - -```ps -cd -autorest SWAGGER.md -``` - -### Code generation settings - -```yaml -title: MixedRealityStsRestClient -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/aa19725fe79aea2a9dc580f3c66f77f89cc34563/specification/mixedreality/data-plane/Microsoft.MixedReality/preview/2019-02-28-preview/mr-sts.json -output-folder: ../azure/mixedreality/authentication/_generated -namespace: azure.mixedreality.authentication._generated -no-namespace-folders: true -license-header: MICROSOFT_MIT_NO_VERSION -enable-xml: false -clear-output-folder: true -python: true -v3: true -add-credentials: false -``` diff --git a/sdk/mixedreality/azure-mixedreality-authentication/swagger/update.ps1 b/sdk/mixedreality/azure-mixedreality-authentication/swagger/update.ps1 deleted file mode 100644 index a7490a9848d1..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/swagger/update.ps1 +++ /dev/null @@ -1,6 +0,0 @@ -Push-Location $PSScriptRoot -try { - & autorest SWAGGER.md -} finally { - Pop-Location -} diff --git a/sdk/mixedreality/azure-mixedreality-authentication/tests/conftest.py b/sdk/mixedreality/azure-mixedreality-authentication/tests/conftest.py deleted file mode 100644 index 256d20a1365c..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/tests/conftest.py +++ /dev/null @@ -1,42 +0,0 @@ -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- -import pytest - -from azure.core.credentials import AzureKeyCredential -from devtools_testutils.sanitizers import add_body_key_sanitizer, add_remove_header_sanitizer - - -# Environment variable keys -ENV_ACCOUNT_DOMAIN = "MIXEDREALITY_ACCOUNT_DOMAIN" -ENV_ACCOUNT_ID = "MIXEDREALITY_ACCOUNT_ID" -ENV_ACCOUNT_KEY = "MIXEDREALITY_ACCOUNT_KEY" - -# Fake values -TEST_ACCOUNT_DOMAIN = "mixedreality.azure.com" -TEST_ACCOUNT_ID = "00000000-0000-0000-0000-000000000000" -TEST_ACCOUNT_KEY = "fakekey" - - -@pytest.fixture(scope="session", autouse=True) -def add_sanitizers(test_proxy, environment_variables): - sanitization_mapping = { - ENV_ACCOUNT_DOMAIN: TEST_ACCOUNT_DOMAIN, - ENV_ACCOUNT_ID: TEST_ACCOUNT_ID, - ENV_ACCOUNT_KEY: TEST_ACCOUNT_KEY - } - environment_variables.sanitize_batch(sanitization_mapping) - add_remove_header_sanitizer(headers="X-MRC-CV") - # Replace AccessToken with fake JWT. - add_body_key_sanitizer(json_path="AccessToken", value="fake.eyJleHAiOjIxNDc0ODM2NDd9.fake") - - -@pytest.fixture(scope="session") -def account_info(environment_variables): - yield { - "account_domain": environment_variables.get(ENV_ACCOUNT_DOMAIN), - "account_id": environment_variables.get(ENV_ACCOUNT_ID), - "key_credential": AzureKeyCredential(environment_variables.get(ENV_ACCOUNT_KEY)) - } diff --git a/sdk/mixedreality/azure-mixedreality-authentication/tests/test_client.py b/sdk/mixedreality/azure-mixedreality-authentication/tests/test_client.py deleted file mode 100644 index 8aa9859d6666..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/tests/test_client.py +++ /dev/null @@ -1,79 +0,0 @@ -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- -import pytest - -from devtools_testutils import AzureRecordedTestCase - -from azure.mixedreality.authentication import MixedRealityStsClient -from azure.mixedreality.authentication._shared.mixedreality_account_key_credential import MixedRealityAccountKeyCredential - -class TestClient(AzureRecordedTestCase): - - def test_create_client(self, account_info): - client = MixedRealityStsClient( - account_id=account_info["account_id"], - account_domain=account_info["account_domain"], - credential=account_info["key_credential"]) - - assert client is not None - - def test_create_client_custom_with_endpoint(self, account_info): - custom_endpoint_url = "https://my.custom.endpoint" - client = MixedRealityStsClient( - account_id=account_info["account_id"], - account_domain=account_info["account_domain"], - credential=account_info["key_credential"], - custom_endpoint_url=custom_endpoint_url) - - assert client._endpoint_url == custom_endpoint_url - - def test_create_client_with_credential(self, account_info): - token_credential = MixedRealityAccountKeyCredential( - account_info["account_id"], account_info["key_credential"]) - client = MixedRealityStsClient( - account_id=account_info["account_id"], - account_domain=account_info["account_domain"], - credential=token_credential) - - assert client._credential == token_credential - - def test_create_client_with_invalid_arguments(self, account_info): - with pytest.raises(ValueError): - MixedRealityStsClient( - account_id=None, - account_domain=account_info["account_domain"], - credential=account_info["key_credential"]) - - with pytest.raises(ValueError): - MixedRealityStsClient( - account_id=account_info["account_id"], - account_domain=None, - credential=account_info["key_credential"]) - - with pytest.raises(ValueError): - MixedRealityStsClient( - account_id=account_info["account_id"], - account_domain=account_info["account_domain"], - credential=None) - - with pytest.raises(ValueError): - MixedRealityStsClient( - account_id=account_info["account_id"], - account_domain=account_info["account_domain"], - credential=account_info["key_credential"], - custom_endpoint_url="#") - - def test_get_token(self, recorded_test, account_info): - client = MixedRealityStsClient( - account_id=account_info["account_id"], - account_domain=account_info["account_domain"], - credential=account_info["key_credential"]) - - token = client.get_token() - - assert token is not None - assert token.token is not None - assert token.expires_on is not None diff --git a/sdk/mixedreality/azure-mixedreality-authentication/tests/test_client_async.py b/sdk/mixedreality/azure-mixedreality-authentication/tests/test_client_async.py deleted file mode 100644 index 888166c8669b..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/tests/test_client_async.py +++ /dev/null @@ -1,81 +0,0 @@ -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- -import pytest - -from devtools_testutils import AzureRecordedTestCase - -from azure.mixedreality.authentication.aio import MixedRealityStsClient -from azure.mixedreality.authentication._shared.aio.mixedreality_account_key_credential import MixedRealityAccountKeyCredential - - -class TestAsyncClient(AzureRecordedTestCase): - - def test_create_client(self, account_info): - client = MixedRealityStsClient( - account_id=account_info["account_id"], - account_domain=account_info["account_domain"], - credential=account_info["key_credential"]) - - assert client is not None - - def test_create_client_custom_with_endpoint(self, account_info): - custom_endpoint_url = "https://my.custom.endpoint" - client = MixedRealityStsClient( - account_id=account_info["account_id"], - account_domain=account_info["account_domain"], - credential=account_info["key_credential"], - custom_endpoint_url=custom_endpoint_url) - - assert client._endpoint_url == custom_endpoint_url - - def test_create_client_with_credential(self, account_info): - token_credential = MixedRealityAccountKeyCredential( - account_info["account_id"], account_info["key_credential"]) - client = MixedRealityStsClient( - account_id=account_info["account_id"], - account_domain=account_info["account_domain"], - credential=token_credential) - - assert client._credential == token_credential - - def test_create_client_with_invalid_arguments(self, account_info): - with pytest.raises(ValueError): - MixedRealityStsClient( - account_id=None, - account_domain=account_info["account_domain"], - credential=account_info["key_credential"]) - - with pytest.raises(ValueError): - MixedRealityStsClient( - account_id=account_info["account_id"], - account_domain=None, - credential=account_info["key_credential"]) - - with pytest.raises(ValueError): - MixedRealityStsClient( - account_id=account_info["account_id"], - account_domain=account_info["account_domain"], - credential=None) - - with pytest.raises(ValueError): - MixedRealityStsClient( - account_id=account_info["account_id"], - account_domain=account_info["account_domain"], - credential=account_info["key_credential"], - custom_endpoint_url="#") - - @pytest.mark.asyncio - async def test_get_token(self, recorded_test, account_info): - client = MixedRealityStsClient( - account_id=account_info["account_id"], - account_domain=account_info["account_domain"], - credential=account_info["key_credential"]) - - token = await client.get_token() - - assert token is not None - assert token.token is not None - assert token.expires_on is not None diff --git a/sdk/mixedreality/azure-mixedreality-authentication/tests/test_mixed_reality_token_credential.py b/sdk/mixedreality/azure-mixedreality-authentication/tests/test_mixed_reality_token_credential.py deleted file mode 100644 index 65cd309b33b9..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/tests/test_mixed_reality_token_credential.py +++ /dev/null @@ -1,37 +0,0 @@ -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -from azure.core.credentials import AccessToken, AzureKeyCredential - -from azure.mixedreality.authentication._shared.mixed_reality_token_credential import get_mixedreality_credential, MixedRealityTokenCredential -from azure.mixedreality.authentication._shared.static_access_token_credential import StaticAccessTokenCredential -from azure.mixedreality.authentication._shared.mixedreality_account_key_credential import MixedRealityAccountKeyCredential - -class TestMixedRealityTokenCredential: - def test_get_mixedreality_credential_static_credential(self): - access_token = AccessToken("My access token", 0) - credential = StaticAccessTokenCredential(access_token) - - actual_credential = get_mixedreality_credential( - account_id="account_id", - account_domain="account_domain", - endpoint_url="http://my.endpoint.url", - credential=credential) - - assert credential == actual_credential - - def test_get_mixedreality_credential_other_credential(self): - keyCredential = AzureKeyCredential("my_account_key") - credential = MixedRealityAccountKeyCredential("account_id", keyCredential) - - actual_credential = get_mixedreality_credential( - account_id="account_id", - account_domain="account_domain", - endpoint_url="http://my.endpoint.url", - credential=credential) - - assert credential != actual_credential - assert isinstance(actual_credential, MixedRealityTokenCredential) diff --git a/sdk/mixedreality/azure-mixedreality-authentication/tests/test_mixed_reality_token_credential_async.py b/sdk/mixedreality/azure-mixedreality-authentication/tests/test_mixed_reality_token_credential_async.py deleted file mode 100644 index f38218a23938..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/tests/test_mixed_reality_token_credential_async.py +++ /dev/null @@ -1,37 +0,0 @@ -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -from azure.core.credentials import AccessToken, AzureKeyCredential - -from azure.mixedreality.authentication._shared.aio.mixed_reality_token_credential import get_mixedreality_credential, MixedRealityTokenCredential -from azure.mixedreality.authentication._shared.aio.static_access_token_credential import StaticAccessTokenCredential -from azure.mixedreality.authentication._shared.aio.mixedreality_account_key_credential import MixedRealityAccountKeyCredential - -class TestMixedRealityTokenCredential: - def test_get_mixedreality_credential_static_credential(self): - access_token = AccessToken("My access token", 0) - credential = StaticAccessTokenCredential(access_token) - - actual_credential = get_mixedreality_credential( - account_id="account_id", - account_domain="account_domain", - endpoint_url="http://my.endpoint.url", - credential=credential) - - assert credential == actual_credential - - def test_get_mixedreality_credential_other_credential(self): - keyCredential = AzureKeyCredential("my_account_key") - credential = MixedRealityAccountKeyCredential("account_id", keyCredential) - - actual_credential = get_mixedreality_credential( - account_id="account_id", - account_domain="account_domain", - endpoint_url="http://my.endpoint.url", - credential=credential) - - assert credential != actual_credential - assert isinstance(actual_credential, MixedRealityTokenCredential) diff --git a/sdk/mixedreality/azure-mixedreality-authentication/tests/test_static_access_token_credential.py b/sdk/mixedreality/azure-mixedreality-authentication/tests/test_static_access_token_credential.py deleted file mode 100644 index 45b8c702fcfe..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/tests/test_static_access_token_credential.py +++ /dev/null @@ -1,21 +0,0 @@ -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -from azure.core.credentials import AccessToken - -from azure.mixedreality.authentication._shared.static_access_token_credential import StaticAccessTokenCredential - -class TestStaticAccessTokenCredential: - def test_get_token(self): - token = "My access token" - expiration = 0 - - access_token = AccessToken(token=token, expires_on=expiration) - static_access_token = StaticAccessTokenCredential(access_token) - - actual = static_access_token.get_token() - - assert access_token == actual diff --git a/sdk/mixedreality/azure-mixedreality-authentication/tests/test_static_access_token_credential_async.py b/sdk/mixedreality/azure-mixedreality-authentication/tests/test_static_access_token_credential_async.py deleted file mode 100644 index 38c2a5bb9110..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/tests/test_static_access_token_credential_async.py +++ /dev/null @@ -1,24 +0,0 @@ -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- -import pytest - -from azure.core.credentials import AccessToken - -from azure.mixedreality.authentication._shared.aio.static_access_token_credential import StaticAccessTokenCredential - -class TestAsyncStaticAccessTokenCredential: - - @pytest.mark.asyncio - async def test_get_token(self): - token = "My access token" - expiration = 0 - - access_token = AccessToken(token=token, expires_on=expiration) - static_access_token = StaticAccessTokenCredential(access_token) - - actual = await static_access_token.get_token() - - assert access_token == actual diff --git a/sdk/mixedreality/azure-mixedreality-authentication/tests/test_utils.py b/sdk/mixedreality/azure-mixedreality-authentication/tests/test_utils.py deleted file mode 100644 index 223bc7873433..000000000000 --- a/sdk/mixedreality/azure-mixedreality-authentication/tests/test_utils.py +++ /dev/null @@ -1,71 +0,0 @@ -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -import pytest - -from azure.mixedreality.authentication._utils import generate_cv_base, retrieve_jwt_expiration_timestamp - - -class TestUtils: - def test_generate_cv_base(self): - cv = generate_cv_base() - - assert cv is not None - assert len(cv) == 22 - - def test_generate_cv_base_are_random(self): - cv1 = generate_cv_base() - cv2 = generate_cv_base() - - assert cv1 is not None - assert cv2 is not None - assert cv1 != cv2 - - def test_retrieve_jwt_expiration_timestamp_with_padding(self): - # Note: The trailing "." on the end indicates an empty signature indicating that this JWT is not signed. - jwt_value = "eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJlbWFpbCI6IkJvYkBjb250b3NvLmNvbSIsImdpdmVuX25hbWUiOiJCb2IiLCJpc3MiOiJodHRwOi8vRGVmYXVsdC5Jc3N1ZXIuY29tIiwiYXVkIjoiaHR0cDovL0RlZmF1bHQuQXVkaWVuY2UuY29tIiwiaWF0IjoiMTYxMDgxMjI1MCIsIm5iZiI6IjE2MTA4MTI1NTAiLCJleHAiOiIxNjEwODk4NjUwIn0=." - expected_expiration_timestamp = 1610898650 # 1/17/2021 3:50:50 PM UTC - - actual = retrieve_jwt_expiration_timestamp(jwt_value) - - assert actual is not None - assert actual == expected_expiration_timestamp - - def test_retrieve_jwt_expiration_timestamp_no_padding(self): - # Note: The trailing "." on the end indicates an empty signature indicating that this JWT is not signed. - # The trailing "=" has been removed to test without base64 padding, which is apparently expected for JWT. - jwt_value = "eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJlbWFpbCI6IkJvYkBjb250b3NvLmNvbSIsImdpdmVuX25hbWUiOiJCb2IiLCJpc3MiOiJodHRwOi8vRGVmYXVsdC5Jc3N1ZXIuY29tIiwiYXVkIjoiaHR0cDovL0RlZmF1bHQuQXVkaWVuY2UuY29tIiwiaWF0IjoiMTYxMDgxMjI1MCIsIm5iZiI6IjE2MTA4MTI1NTAiLCJleHAiOiIxNjEwODk4NjUwIn0." - expected_expiration_timestamp = 1610898650 # 1/17/2021 3:50:50 PM UTC - - actual = retrieve_jwt_expiration_timestamp(jwt_value) - - assert actual is not None - assert actual == expected_expiration_timestamp - - def test_retrieve_jwt_expiration_timestamp_invalid_parameter(self): - with pytest.raises(ValueError): - retrieve_jwt_expiration_timestamp(None) - - def test_retrieve_jwt_expiration_timestamp_invalid_structure(self): - # JWT value with missing signature section on the end. - jwt_value = "eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJlbWFpbCI6IkJvYkBjb250b3NvLmNvbSIsImdpdmVuX25hbWUiOiJCb2IiLCJpc3MiOiJodHRwOi8vRGVmYXVsdC5Jc3N1ZXIuY29tIiwiYXVkIjoiaHR0cDovL0RlZmF1bHQuQXVkaWVuY2UuY29tIiwiaWF0IjoiMTYxMDgxMjI1MCIsIm5iZiI6IjE2MTA4MTI1NTAiLCJleHAiOiIxNjEwODk4NjUwIn0=" - - with pytest.raises(ValueError): - retrieve_jwt_expiration_timestamp(jwt_value) - - def test_retrieve_jwt_expiration_timestamp_invalid_payload(self): - # JWT value with missing payload. - jwt_value = "eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.." - - with pytest.raises(ValueError): - retrieve_jwt_expiration_timestamp(jwt_value) - - def test_retrieve_jwt_expiration_timestamp_invalid_exp(self): - # JWT value with missing expiration field. - jwt_value = "eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJlbWFpbCI6IkJvYkBjb250b3NvLmNvbSIsImdpdmVuX25hbWUiOiJCb2IiLCJpc3MiOiJodHRwOi8vRGVmYXVsdC5Jc3N1ZXIuY29tIiwiYXVkIjoiaHR0cDovL0RlZmF1bHQuQXVkaWVuY2UuY29tIiwiaWF0IjoiMTYxMDgxMjI1MCIsIm5iZiI6IjE2MTA4MTI1NTAifQ==." - - with pytest.raises(ValueError): - retrieve_jwt_expiration_timestamp(jwt_value) diff --git a/sdk/mixedreality/ci.yml b/sdk/mixedreality/ci.yml deleted file mode 100644 index 9b44c80a0a25..000000000000 --- a/sdk/mixedreality/ci.yml +++ /dev/null @@ -1,35 +0,0 @@ -# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. - -trigger: - branches: - include: - - main - - hotfix/* - - release/* - - restapi* - paths: - include: - - sdk/mixedreality/ - -pr: - branches: - include: - - main - - feature/* - - hotfix/* - - release/* - - restapi* - paths: - include: - - sdk/mixedreality/ - -extends: - template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml - parameters: - ServiceDirectory: mixedreality - TestProxy: true - Artifacts: - - name: azure-mgmt-mixedreality - safeName: azuremgmtmixedreality - - name: azure-mixedreality-authentication - safeName: azuremixedrealityauthentication diff --git a/sdk/mixedreality/test-resources.json b/sdk/mixedreality/test-resources.json deleted file mode 100644 index 744fd91fd3d7..000000000000 --- a/sdk/mixedreality/test-resources.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "baseName": { - "type": "string", - "defaultValue": "[resourceGroup().name]", - "metadata": { - "description": "The base resource name." - } - }, - "tenantId": { - "type": "string", - "defaultValue": "72f988bf-86f1-41af-91ab-2d7cd011db47", - "metadata": { - "description": "The tenant ID to which the application and resources belong." - } - }, - "location": { - "type": "string", - "defaultValue": "[resourceGroup().location]", - "metadata": { - "description": "The location of the resource. By default, this is the same as the resource group." - } - } - }, - "variables": { - "apiVersion": "2020-05-01", - "asaAccountName": "[concat(parameters('baseName'), '-asa-account')]" - }, - "resources": [ - { - "type": "Microsoft.MixedReality/spatialAnchorsAccounts", - "name": "[variables('asaAccountName')]", - "apiVersion": "[variables('apiVersion')]", - "location": "[parameters('location')]", - "properties": {} - } - ], - "outputs": { - "MIXEDREALITY_ACCOUNT_ID": { - "type": "string", - "value": "[reference(variables('asaAccountName')).accountId]" - }, - "MIXEDREALITY_ACCOUNT_DOMAIN": { - "type": "string", - "value": "[reference(variables('asaAccountName')).accountDomain]" - }, - "MIXEDREALITY_ACCOUNT_KEY": { - "type": "string", - "value": "[listKeys(resourceId('Microsoft.MixedReality/spatialAnchorsAccounts', variables('asaAccountName')), variables('apiVersion')).primaryKey]" - } - } -} \ No newline at end of file diff --git a/sdk/mixedreality/tests.yml b/sdk/mixedreality/tests.yml deleted file mode 100644 index 3ba3704240aa..000000000000 --- a/sdk/mixedreality/tests.yml +++ /dev/null @@ -1,14 +0,0 @@ -trigger: none - -extends: - template: ../../eng/pipelines/templates/stages/archetype-sdk-tests.yml - parameters: - ServiceDirectory: mixedreality - Location: eastus2 - EnvVars: - AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id) - AZURE_CLIENT_SECRET: $(aad-azure-sdk-test-client-secret) - AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id) - TEST_MODE: 'RunLiveNoRecord' - AZURE_SKIP_LIVE_RECORDING: 'true' - AZURE_TEST_RUN_LIVE: 'true' diff --git a/sdk/remoterendering/TestResources/testBox.fbx b/sdk/remoterendering/TestResources/testBox.fbx deleted file mode 100644 index 13b967f33315..000000000000 --- a/sdk/remoterendering/TestResources/testBox.fbx +++ /dev/null @@ -1,346 +0,0 @@ -; FBX 7.5.0 project file -; ---------------------------------------------------- - -FBXHeaderExtension: { - FBXHeaderVersion: 1003 - FBXVersion: 7500 - CreationTimeStamp: { - Version: 1000 - Year: 2021 - Month: 1 - Day: 24 - Hour: 10 - Minute: 15 - Second: 0 - Millisecond: 529 - } - Creator: "FBX SDK/FBX Plugins version 2018.1.1" - SceneInfo: "SceneInfo::GlobalInfo", "UserData" { - Type: "UserData" - Version: 100 - MetaData: { - Version: 100 - Title: "Exported .fbx from Lift" - Subject: "fbx" - Author: "" - Keywords: "Microsoft Community Paint" - Revision: "rev. 1.0" - Comment: "" - } - Properties70: { - P: "DocumentUrl", "KString", "Url", "", "testBox.fbx" - P: "SrcDocumentUrl", "KString", "Url", "", "testBox.fbx" - P: "Original", "Compound", "", "" - P: "Original|ApplicationVendor", "KString", "", "", "" - P: "Original|ApplicationName", "KString", "", "", "" - P: "Original|ApplicationVersion", "KString", "", "", "" - P: "Original|DateTime_GMT", "DateTime", "", "", "" - P: "Original|FileName", "KString", "", "", "" - P: "LastSaved", "Compound", "", "" - P: "LastSaved|ApplicationVendor", "KString", "", "", "" - P: "LastSaved|ApplicationName", "KString", "", "", "" - P: "LastSaved|ApplicationVersion", "KString", "", "", "" - P: "LastSaved|DateTime_GMT", "DateTime", "", "", "" - } - } -} -GlobalSettings: { - Version: 1000 - Properties70: { - P: "UpAxis", "int", "Integer", "",1 - P: "UpAxisSign", "int", "Integer", "",1 - P: "FrontAxis", "int", "Integer", "",2 - P: "FrontAxisSign", "int", "Integer", "",1 - P: "CoordAxis", "int", "Integer", "",0 - P: "CoordAxisSign", "int", "Integer", "",1 - P: "OriginalUpAxis", "int", "Integer", "",-1 - P: "OriginalUpAxisSign", "int", "Integer", "",1 - P: "UnitScaleFactor", "double", "Number", "",100 - P: "OriginalUnitScaleFactor", "double", "Number", "",1 - P: "AmbientColor", "ColorRGB", "Color", "",0,0,0 - P: "DefaultCamera", "KString", "", "", "Producer Perspective" - P: "TimeMode", "enum", "", "",0 - P: "TimeProtocol", "enum", "", "",2 - P: "SnapOnFrameMode", "enum", "", "",0 - P: "TimeSpanStart", "KTime", "Time", "",0 - P: "TimeSpanStop", "KTime", "Time", "",46186158000 - P: "CustomFrameRate", "double", "Number", "",-1 - P: "TimeMarker", "Compound", "", "" - P: "CurrentTimeMarker", "int", "Integer", "",-1 - } -} - -; Documents Description -;------------------------------------------------------------------ - -Documents: { - Count: 1 - Document: 2520542649728, "Scene", "Scene" { - Properties70: { - P: "SourceObject", "object", "", "" - P: "ActiveAnimStackName", "KString", "", "", "" - } - RootNode: 0 - } -} - -; Document References -;------------------------------------------------------------------ - -References: { -} - -; Object definitions -;------------------------------------------------------------------ - -Definitions: { - Version: 100 - Count: 4 - ObjectType: "GlobalSettings" { - Count: 1 - } - ObjectType: "Model" { - Count: 1 - PropertyTemplate: "FbxNode" { - Properties70: { - P: "QuaternionInterpolate", "enum", "", "",0 - P: "RotationOffset", "Vector3D", "Vector", "",0,0,0 - P: "RotationPivot", "Vector3D", "Vector", "",0,0,0 - P: "ScalingOffset", "Vector3D", "Vector", "",0,0,0 - P: "ScalingPivot", "Vector3D", "Vector", "",0,0,0 - P: "TranslationActive", "bool", "", "",0 - P: "TranslationMin", "Vector3D", "Vector", "",0,0,0 - P: "TranslationMax", "Vector3D", "Vector", "",0,0,0 - P: "TranslationMinX", "bool", "", "",0 - P: "TranslationMinY", "bool", "", "",0 - P: "TranslationMinZ", "bool", "", "",0 - P: "TranslationMaxX", "bool", "", "",0 - P: "TranslationMaxY", "bool", "", "",0 - P: "TranslationMaxZ", "bool", "", "",0 - P: "RotationOrder", "enum", "", "",0 - P: "RotationSpaceForLimitOnly", "bool", "", "",0 - P: "RotationStiffnessX", "double", "Number", "",0 - P: "RotationStiffnessY", "double", "Number", "",0 - P: "RotationStiffnessZ", "double", "Number", "",0 - P: "AxisLen", "double", "Number", "",10 - P: "PreRotation", "Vector3D", "Vector", "",0,0,0 - P: "PostRotation", "Vector3D", "Vector", "",0,0,0 - P: "RotationActive", "bool", "", "",0 - P: "RotationMin", "Vector3D", "Vector", "",0,0,0 - P: "RotationMax", "Vector3D", "Vector", "",0,0,0 - P: "RotationMinX", "bool", "", "",0 - P: "RotationMinY", "bool", "", "",0 - P: "RotationMinZ", "bool", "", "",0 - P: "RotationMaxX", "bool", "", "",0 - P: "RotationMaxY", "bool", "", "",0 - P: "RotationMaxZ", "bool", "", "",0 - P: "InheritType", "enum", "", "",0 - P: "ScalingActive", "bool", "", "",0 - P: "ScalingMin", "Vector3D", "Vector", "",0,0,0 - P: "ScalingMax", "Vector3D", "Vector", "",1,1,1 - P: "ScalingMinX", "bool", "", "",0 - P: "ScalingMinY", "bool", "", "",0 - P: "ScalingMinZ", "bool", "", "",0 - P: "ScalingMaxX", "bool", "", "",0 - P: "ScalingMaxY", "bool", "", "",0 - P: "ScalingMaxZ", "bool", "", "",0 - P: "GeometricTranslation", "Vector3D", "Vector", "",0,0,0 - P: "GeometricRotation", "Vector3D", "Vector", "",0,0,0 - P: "GeometricScaling", "Vector3D", "Vector", "",1,1,1 - P: "MinDampRangeX", "double", "Number", "",0 - P: "MinDampRangeY", "double", "Number", "",0 - P: "MinDampRangeZ", "double", "Number", "",0 - P: "MaxDampRangeX", "double", "Number", "",0 - P: "MaxDampRangeY", "double", "Number", "",0 - P: "MaxDampRangeZ", "double", "Number", "",0 - P: "MinDampStrengthX", "double", "Number", "",0 - P: "MinDampStrengthY", "double", "Number", "",0 - P: "MinDampStrengthZ", "double", "Number", "",0 - P: "MaxDampStrengthX", "double", "Number", "",0 - P: "MaxDampStrengthY", "double", "Number", "",0 - P: "MaxDampStrengthZ", "double", "Number", "",0 - P: "PreferedAngleX", "double", "Number", "",0 - P: "PreferedAngleY", "double", "Number", "",0 - P: "PreferedAngleZ", "double", "Number", "",0 - P: "LookAtProperty", "object", "", "" - P: "UpVectorProperty", "object", "", "" - P: "Show", "bool", "", "",1 - P: "NegativePercentShapeSupport", "bool", "", "",1 - P: "DefaultAttributeIndex", "int", "Integer", "",-1 - P: "Freeze", "bool", "", "",0 - P: "LODBox", "bool", "", "",0 - P: "Lcl Translation", "Lcl Translation", "", "A",0,0,0 - P: "Lcl Rotation", "Lcl Rotation", "", "A",0,0,0 - P: "Lcl Scaling", "Lcl Scaling", "", "A",1,1,1 - P: "Visibility", "Visibility", "", "A",1 - P: "Visibility Inheritance", "Visibility Inheritance", "", "",1 - } - } - } - ObjectType: "Material" { - Count: 1 - PropertyTemplate: "FbxSurfacePhong" { - Properties70: { - P: "ShadingModel", "KString", "", "", "Phong" - P: "MultiLayer", "bool", "", "",0 - P: "EmissiveColor", "Color", "", "A",0,0,0 - P: "EmissiveFactor", "Number", "", "A",1 - P: "AmbientColor", "Color", "", "A",0.2,0.2,0.2 - P: "AmbientFactor", "Number", "", "A",1 - P: "DiffuseColor", "Color", "", "A",0.8,0.8,0.8 - P: "DiffuseFactor", "Number", "", "A",1 - P: "Bump", "Vector3D", "Vector", "",0,0,0 - P: "NormalMap", "Vector3D", "Vector", "",0,0,0 - P: "BumpFactor", "double", "Number", "",1 - P: "TransparentColor", "Color", "", "A",0,0,0 - P: "TransparencyFactor", "Number", "", "A",0 - P: "DisplacementColor", "ColorRGB", "Color", "",0,0,0 - P: "DisplacementFactor", "double", "Number", "",1 - P: "VectorDisplacementColor", "ColorRGB", "Color", "",0,0,0 - P: "VectorDisplacementFactor", "double", "Number", "",1 - P: "SpecularColor", "Color", "", "A",0.2,0.2,0.2 - P: "SpecularFactor", "Number", "", "A",1 - P: "ShininessExponent", "Number", "", "A",20 - P: "ReflectionColor", "Color", "", "A",0,0,0 - P: "ReflectionFactor", "Number", "", "A",1 - } - } - } - ObjectType: "Geometry" { - Count: 1 - PropertyTemplate: "FbxMesh" { - Properties70: { - P: "Color", "ColorRGB", "Color", "",0.8,0.8,0.8 - P: "BBoxMin", "Vector3D", "Vector", "",0,0,0 - P: "BBoxMax", "Vector3D", "Vector", "",0,0,0 - P: "Primary Visibility", "bool", "", "",1 - P: "Casts Shadows", "bool", "", "",1 - P: "Receive Shadows", "bool", "", "",1 - } - } - } -} - -; Object properties -;------------------------------------------------------------------ - -Objects: { - Geometry: 2520544655040, "Geometry::mesh_id43", "Mesh" { - Properties70: { - P: "BBoxMin", "Vector3D", "Vector", "",-100,-100,-100 - P: "BBoxMax", "Vector3D", "Vector", "",100,100,100 - } - Vertices: *72 { - a: 100,100,-100,-100,-100,-100,-100,100,-100,100,-100,-100,-100,100,100,100,-100,100,100,100,100,-100,-100,100,100,100,100,100,-100,-100,100,100,-100,100,-100,100,-100,100,-100,-100,-100,100,-100,100,100,-100,-100,-100,-100,100,-100,100,100,100,100,100,-100,-100,100,100,-100,-100,100,100,-100,-100,100,-100,100,-100,-100,-100 - } - PolygonVertexIndex: *36 { - a: 0,1,-3,0,3,-2,4,5,-7,4,7,-6,8,9,-11,8,11,-10,12,13,-15,12,15,-14,16,17,-19,16,19,-18,20,21,-23,20,23,-22 - } - GeometryVersion: 124 - LayerElementNormal: 0 { - Version: 102 - Name: "" - MappingInformationType: "ByVertice" - ReferenceInformationType: "Direct" - Normals: *72 { - a: 0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0 - } - NormalsW: *24 { - a: 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 - } - } - LayerElementColor: 0 { - Version: 101 - Name: "VertexColors" - MappingInformationType: "ByVertice" - ReferenceInformationType: "IndexToDirect" - Colors: *96 { - a: 0.980392156862745,0.843137254901961,0.388235294117647,1,0.980392156862745,0.843137254901961,0.388235294117647,1,0.980392156862745,0.843137254901961,0.388235294117647,1,0.980392156862745,0.843137254901961,0.388235294117647,1,0.980392156862745,0.843137254901961,0.388235294117647,1,0.980392156862745,0.843137254901961,0.388235294117647,1,0.980392156862745,0.843137254901961,0.388235294117647,1,0.980392156862745,0.843137254901961,0.388235294117647,1,0.980392156862745,0.843137254901961,0.388235294117647,1,0.980392156862745,0.843137254901961,0.388235294117647,1,0.980392156862745,0.843137254901961,0.388235294117647,1,0.980392156862745,0.843137254901961,0.388235294117647,1,0.980392156862745,0.843137254901961,0.388235294117647,1,0.980392156862745,0.843137254901961,0.388235294117647,1,0.980392156862745,0.843137254901961,0.388235294117647,1,0.980392156862745,0.843137254901961,0.388235294117647,1,0.980392156862745,0.843137254901961,0.388235294117647,1,0.980392156862745,0.843137254901961,0.388235294117647,1,0.980392156862745,0.843137254901961,0.388235294117647,1,0.980392156862745,0.843137254901961,0.388235294117647,1,0.980392156862745,0.843137254901961,0.388235294117647,1,0.980392156862745,0.843137254901961,0.388235294117647,1,0.980392156862745,0.843137254901961,0.388235294117647,1,0.980392156862745,0.843137254901961,0.388235294117647,1 - } - } - LayerElementUV: 0 { - Version: 101 - Name: "" - MappingInformationType: "ByVertice" - ReferenceInformationType: "Direct" - } - LayerElementMaterial: 0 { - Version: 101 - Name: "" - MappingInformationType: "AllSame" - ReferenceInformationType: "IndexToDirect" - Materials: *1 { - a: 0 - } - } - Layer: 0 { - Version: 100 - LayerElement: { - Type: "LayerElementNormal" - TypedIndex: 0 - } - LayerElement: { - Type: "LayerElementMaterial" - TypedIndex: 0 - } - LayerElement: { - Type: "LayerElementColor" - TypedIndex: 0 - } - LayerElement: { - Type: "LayerElementUV" - TypedIndex: 0 - } - } - } - Model: 2520544652560, "Model::root", "Mesh" { - Version: 232 - Properties70: { - P: "ScalingMax", "Vector3D", "Vector", "",0,0,0 - P: "GeometricTranslation", "Vector3D", "Vector", "",0.029182942584157,0.0412420704960823,0.200006887316704 - P: "GeometricRotation", "Vector3D", "Vector", "",19.5286376895952,-30.3983310953995,0 - P: "GeometricScaling", "Vector3D", "Vector", "",0.00176811746427344,0.00159080407945701,0.00159080401671689 - P: "DefaultAttributeIndex", "int", "Integer", "",0 - } - Shading: T - Culling: "CullingOff" - } - Material: 2520544654560, "Material::Material_50", "" { - Version: 102 - ShadingModel: "phong" - MultiLayer: 0 - Properties70: { - P: "DiffuseColor", "Color", "", "A",0.992156862745098,0.925490196078431,0.650980392156863 - P: "SpecularColor", "Color", "", "A",0.0352941176470588,0.0352941176470588,0.0352941176470588 - P: "ShininessExponent", "Number", "", "A",62.8694496154785 - P: "Emissive", "Vector3D", "Vector", "",0,0,0 - P: "Ambient", "Vector3D", "Vector", "",0.2,0.2,0.2 - P: "Diffuse", "Vector3D", "Vector", "",0.992156862745098,0.925490196078431,0.650980392156863 - P: "Specular", "Vector3D", "Vector", "",0.0352941176470588,0.0352941176470588,0.0352941176470588 - P: "Shininess", "double", "Number", "",62.8694496154785 - P: "Opacity", "double", "Number", "",1 - P: "Reflectivity", "double", "Number", "",0 - } - } -} - -; Object connections -;------------------------------------------------------------------ - -Connections: { - - ;Model::root, Model::RootNode - C: "OO",2520544652560,0 - - ;Geometry::mesh_id43, Model::root - C: "OO",2520544655040,2520544652560 - - ;Material::Material_50, Model::root - C: "OO",2520544654560,2520544652560 -} -;Takes section -;---------------------------------------------------- - -Takes: { - Current: "" -} diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/CHANGELOG.md b/sdk/remoterendering/azure-mixedreality-remoterendering/CHANGELOG.md deleted file mode 100644 index ca53034310b5..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/CHANGELOG.md +++ /dev/null @@ -1,18 +0,0 @@ -# Release History - -## 1.0.0b3 (2025-10-01) - -### Other Changes - -- This package has been deprecated and will no longer be maintained after 10-01-2025. This package will only receive security fixes until 10-01-2025. - -## 1.0.0b2 (2023-07-03) - -### Other Changes - -- Added case-insensitive support for enums. -- Python 2.7 is no longer supported. Please use Python version 3.7 or later. - -## 1.0.0b1 (2021-11-15) - -- Initial release. diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/MANIFEST.in b/sdk/remoterendering/azure-mixedreality-remoterendering/MANIFEST.in deleted file mode 100644 index 303853147b07..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/MANIFEST.in +++ /dev/null @@ -1,7 +0,0 @@ -include *.md -include azure/__init__.py -include azure/mixedreality/__init__.py -include LICENSE.txt -recursive-include tests *.py -recursive-include samples *.py *.md -include azure/mixedreality/remoterendering/py.typed diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/README.md b/sdk/remoterendering/azure-mixedreality-remoterendering/README.md deleted file mode 100644 index d7eb6c0c787e..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/README.md +++ /dev/null @@ -1 +0,0 @@ -This package has been deprecated and will no longer be maintained after 10-01-2025. This package will only receive security fixes until 10-01-2025. \ No newline at end of file diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/assets.json b/sdk/remoterendering/azure-mixedreality-remoterendering/assets.json deleted file mode 100644 index 7fb0d6b40d10..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/assets.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "AssetsRepo": "Azure/azure-sdk-assets", - "AssetsRepoPrefixPath": "python", - "TagPrefix": "python/remoterendering/azure-mixedreality-remoterendering", - "Tag": "python/remoterendering/azure-mixedreality-remoterendering_6bae7ecb42" -} diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/__init__.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/__init__.py deleted file mode 100644 index fd0c3846b033..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -__path__ = __import__('pkgutil').extend_path( - __path__, __name__) # type: ignore diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/__init__.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/__init__.py deleted file mode 100644 index fd0c3846b033..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -__path__ = __import__('pkgutil').extend_path( - __path__, __name__) # type: ignore diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/__init__.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/__init__.py deleted file mode 100644 index e7f330b6ef57..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -from ._remote_rendering_client import RemoteRenderingClient -from ._version import VERSION - -from ._generated.models import (AssetConversion, AssetConversionInputSettings, - AssetConversionOutput, AssetConversionOutputSettings, - AssetConversionSettings, AssetConversionStatus, RemoteRenderingError, - RenderingSession, RenderingSessionSize, RenderingSessionStatus) - -__all__ = [ - "RemoteRenderingClient", - "AssetConversion", - "AssetConversionSettings", - "AssetConversionInputSettings", - "AssetConversionOutputSettings", - "AssetConversionStatus", - "AssetConversionOutput", - "RenderingSession", - "RenderingSessionSize", - "RenderingSessionStatus", - "RemoteRenderingError" -] - -__version__ = VERSION diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_api_version.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_api_version.py deleted file mode 100644 index 14e9ad16b56c..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_api_version.py +++ /dev/null @@ -1,38 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -from enum import Enum - -from azure.core import CaseInsensitiveEnumMeta - -class RemoteRenderingApiVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Remote Rendering API versions supported by this package""" - - #: This is the default version - V2021_01_01 = "2021-01-01" - - -DEFAULT_VERSION = RemoteRenderingApiVersion.V2021_01_01 - -def validate_api_version(api_version): - # type: (str) -> None - """Raise ValueError if api_version is invalid - - :param api_version: The api version - :type api_version: str - - """ - if not api_version: - return - - try: - api_version = RemoteRenderingApiVersion(api_version) - except ValueError as exc: - raise ValueError( - "Unsupported API version '{}'. Please select from:\n{}".format( - api_version, ", ".join(v.value for v in RemoteRenderingApiVersion) - ) - ) from exc diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/__init__.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/__init__.py deleted file mode 100644 index 0aa283066ae0..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# 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 ._remote_rendering_rest_client import RemoteRenderingRestClient -__all__ = ['RemoteRenderingRestClient'] - -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/_configuration.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/_configuration.py deleted file mode 100644 index 64d03c4681ff..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/_configuration.py +++ /dev/null @@ -1,58 +0,0 @@ -# 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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any - -VERSION = "unknown" - -class RemoteRenderingRestClientConfiguration(Configuration): - """Configuration for RemoteRenderingRestClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param endpoint: The endpoint to use e.g. https://remoterendering.eastus.mixedreality.azure.com. A list can be found at https://docs.microsoft.com/azure/remote-rendering/reference/regions. - :type endpoint: str - """ - - def __init__( - self, - endpoint, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - if endpoint is None: - raise ValueError("Parameter 'endpoint' must not be None.") - super(RemoteRenderingRestClientConfiguration, self).__init__(**kwargs) - - self.endpoint = endpoint - self.api_version = "2021-01-01" - kwargs.setdefault('sdk_moniker', 'remoterenderingrestclient/{}'.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 policies.HttpLoggingPolicy(**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') diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/_remote_rendering_rest_client.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/_remote_rendering_rest_client.py deleted file mode 100644 index 98b3b278f7e1..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/_remote_rendering_rest_client.py +++ /dev/null @@ -1,62 +0,0 @@ -# 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 import PipelineClient -from msrest import Deserializer, Serializer - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any - -from ._configuration import RemoteRenderingRestClientConfiguration -from .operations import RemoteRenderingOperations -from . import models - - -class RemoteRenderingRestClient(object): - """Describing the `Azure Remote Rendering `_ REST API for rendering sessions and asset conversions. - -All requests to these APIs must be authenticated using the Secure Token Service as described in the `Azure Remote rendering documentation chapter about authentication `_. - - :ivar remote_rendering: RemoteRenderingOperations operations - :vartype remote_rendering: azure.mixedreality.remoterendering._generated.operations.RemoteRenderingOperations - :param endpoint: The endpoint to use e.g. https://remoterendering.eastus.mixedreality.azure.com. A list can be found at https://docs.microsoft.com/azure/remote-rendering/reference/regions. - :type endpoint: str - """ - - def __init__( - self, - endpoint, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - base_url = '{endpoint}' - self._config = RemoteRenderingRestClientConfiguration(endpoint, **kwargs) - self._client = PipelineClient(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._deserialize = Deserializer(client_models) - - self.remote_rendering = RemoteRenderingOperations( - self._client, self._config, self._serialize, self._deserialize) - - def close(self): - # type: () -> None - self._client.close() - - def __enter__(self): - # type: () -> RemoteRenderingRestClient - self._client.__enter__() - return self - - def __exit__(self, *exc_details): - # type: (Any) -> None - self._client.__exit__(*exc_details) diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/aio/__init__.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/aio/__init__.py deleted file mode 100644 index 4e2cceac54f5..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/aio/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -# 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 ._remote_rendering_rest_client_async import RemoteRenderingRestClient -__all__ = ['RemoteRenderingRestClient'] diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/aio/_configuration_async.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/aio/_configuration_async.py deleted file mode 100644 index f2a43ad51f82..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/aio/_configuration_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# 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 - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies - -VERSION = "unknown" - -class RemoteRenderingRestClientConfiguration(Configuration): - """Configuration for RemoteRenderingRestClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param endpoint: The endpoint to use e.g. https://remoterendering.eastus.mixedreality.azure.com. A list can be found at https://docs.microsoft.com/azure/remote-rendering/reference/regions. - :type endpoint: str - """ - - def __init__( - self, - endpoint: str, - **kwargs: Any - ) -> None: - if endpoint is None: - raise ValueError("Parameter 'endpoint' must not be None.") - super(RemoteRenderingRestClientConfiguration, self).__init__(**kwargs) - - self.endpoint = endpoint - self.api_version = "2021-01-01" - kwargs.setdefault('sdk_moniker', 'remoterenderingrestclient/{}'.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 policies.HttpLoggingPolicy(**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') diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/aio/_remote_rendering_rest_client_async.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/aio/_remote_rendering_rest_client_async.py deleted file mode 100644 index 1c14b1e231d9..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/aio/_remote_rendering_rest_client_async.py +++ /dev/null @@ -1,54 +0,0 @@ -# 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 - -from azure.core import AsyncPipelineClient -from msrest import Deserializer, Serializer - -from ._configuration_async import RemoteRenderingRestClientConfiguration -from .operations_async import RemoteRenderingOperations -from .. import models - - -class RemoteRenderingRestClient(object): - """Describing the `Azure Remote Rendering `_ REST API for rendering sessions and asset conversions. - -All requests to these APIs must be authenticated using the Secure Token Service as described in the `Azure Remote rendering documentation chapter about authentication `_. - - :ivar remote_rendering: RemoteRenderingOperations operations - :vartype remote_rendering: azure.mixedreality.remoterendering._generated.aio.operations_async.RemoteRenderingOperations - :param endpoint: The endpoint to use e.g. https://remoterendering.eastus.mixedreality.azure.com. A list can be found at https://docs.microsoft.com/azure/remote-rendering/reference/regions. - :type endpoint: str - """ - - def __init__( - self, - endpoint: str, - **kwargs: Any - ) -> None: - base_url = '{endpoint}' - self._config = RemoteRenderingRestClientConfiguration(endpoint, **kwargs) - self._client = AsyncPipelineClient(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._deserialize = Deserializer(client_models) - - self.remote_rendering = RemoteRenderingOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "RemoteRenderingRestClient": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/aio/operations_async/__init__.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/aio/operations_async/__init__.py deleted file mode 100644 index 95b63f50c90d..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/aio/operations_async/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -# 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 ._remote_rendering_operations_async import RemoteRenderingOperations - -__all__ = [ - 'RemoteRenderingOperations', -] diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/aio/operations_async/_remote_rendering_operations_async.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/aio/operations_async/_remote_rendering_operations_async.py deleted file mode 100644 index 348e32d320ae..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/aio/operations_async/_remote_rendering_operations_async.py +++ /dev/null @@ -1,620 +0,0 @@ -# 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, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest - -from ... import models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class RemoteRenderingOperations: - """RemoteRenderingOperations 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.mixedreality.remoterendering._generated.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 - - async def create_conversion( - self, - account_id: str, - conversion_id: str, - body: "models.CreateAssetConversionSettings", - **kwargs - ) -> "models.AssetConversion": - """Creates a conversion using an asset stored in an Azure Blob Storage account. - - Creates a conversion using an asset stored in an Azure Blob Storage account. - - :param account_id: The Azure Remote Rendering account ID. - :type account_id: str - :param conversion_id: An ID uniquely identifying the conversion for the given account. The ID - is case sensitive, can contain any combination of alphanumeric characters including hyphens and - underscores, and cannot contain more than 256 characters. - :type conversion_id: str - :param body: Request body configuring the settings for an asset conversion. - :type body: ~azure.mixedreality.remoterendering._generated.models.CreateAssetConversionSettings - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AssetConversion, or the result of cls(response) - :rtype: ~azure.mixedreality.remoterendering._generated.models.AssetConversion - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AssetConversion"] - error_map = { - 404: ResourceNotFoundError, - 400: lambda response: HttpResponseError(response=response, model=self._deserialize(models.ErrorResponse, response)), - 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(models.ErrorResponse, response)), - 500: lambda response: HttpResponseError(response=response, model=self._deserialize(models.ErrorResponse, response)), - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.create_conversion.metadata['url'] # type: ignore - path_format_arguments = { - 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - 'account_id': self._serialize.url("account_id", account_id, 'str'), - 'conversion_id': self._serialize.url("conversion_id", conversion_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'CreateAssetConversionSettings') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - if response.status_code == 200: - response_headers['MS-CV']=self._deserialize('str', response.headers.get('MS-CV')) - deserialized = self._deserialize('AssetConversion', pipeline_response) - - if response.status_code == 201: - response_headers['MS-CV']=self._deserialize('str', response.headers.get('MS-CV')) - deserialized = self._deserialize('AssetConversion', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - create_conversion.metadata = {'url': '/accounts/{account_id}/conversions/{conversion_id}'} # type: ignore - - async def get_conversion( - self, - account_id: str, - conversion_id: str, - **kwargs - ) -> "models.AssetConversion": - """Gets the status of a particular conversion. - - Gets the status of a particular conversion. - - :param account_id: The Azure Remote Rendering account ID. - :type account_id: str - :param conversion_id: An ID uniquely identifying the conversion for the given account. The ID - is case sensitive, can contain any combination of alphanumeric characters including hyphens and - underscores, and cannot contain more than 256 characters. - :type conversion_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AssetConversion, or the result of cls(response) - :rtype: ~azure.mixedreality.remoterendering._generated.models.AssetConversion - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AssetConversion"] - error_map = { - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 500: lambda response: HttpResponseError(response=response, model=self._deserialize(models.ErrorResponse, response)), - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - - # Construct URL - url = self.get_conversion.metadata['url'] # type: ignore - path_format_arguments = { - 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - 'account_id': self._serialize.url("account_id", account_id, 'str'), - 'conversion_id': self._serialize.url("conversion_id", conversion_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - request = self._client.get(url, query_parameters, header_parameters) - 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) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers['MS-CV']=self._deserialize('str', response.headers.get('MS-CV')) - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - deserialized = self._deserialize('AssetConversion', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - get_conversion.metadata = {'url': '/accounts/{account_id}/conversions/{conversion_id}'} # type: ignore - - def list_conversions( - self, - account_id: str, - **kwargs - ) -> AsyncIterable["models.ConversionList"]: - """Gets a list of all conversions. - - Gets a list of all conversions. - - :param account_id: The Azure Remote Rendering account ID. - :type account_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConversionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mixedreality.remoterendering._generated.models.ConversionList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ConversionList"] - error_map = { - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 500: lambda response: HttpResponseError(response=response, model=self._deserialize(models.ErrorResponse, response)), - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list_conversions.metadata['url'] # type: ignore - path_format_arguments = { - 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - 'account_id': self._serialize.url("account_id", account_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - path_format_arguments = { - 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - 'account_id': self._serialize.url("account_id", account_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('ConversionList', pipeline_response) - list_of_elem = deserialized.conversions - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - 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) - raise HttpResponseError(response=response) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_conversions.metadata = {'url': '/accounts/{account_id}/conversions'} # type: ignore - - async def create_session( - self, - account_id: str, - session_id: str, - body: "models.CreateRenderingSessionSettings", - **kwargs - ) -> "models.RenderingSession": - """Creates a new rendering session. - - Creates a new rendering session. - - :param account_id: The Azure Remote Rendering account ID. - :type account_id: str - :param session_id: An ID uniquely identifying the rendering session for the given account. The - ID is case sensitive, can contain any combination of alphanumeric characters including hyphens - and underscores, and cannot contain more than 256 characters. - :type session_id: str - :param body: Settings of the session to be created. - :type body: ~azure.mixedreality.remoterendering._generated.models.CreateRenderingSessionSettings - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RenderingSession, or the result of cls(response) - :rtype: ~azure.mixedreality.remoterendering._generated.models.RenderingSession - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.RenderingSession"] - error_map = { - 404: ResourceNotFoundError, - 400: lambda response: HttpResponseError(response=response, model=self._deserialize(models.ErrorResponse, response)), - 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(models.ErrorResponse, response)), - 500: lambda response: HttpResponseError(response=response, model=self._deserialize(models.ErrorResponse, response)), - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.create_session.metadata['url'] # type: ignore - path_format_arguments = { - 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - 'account_id': self._serialize.url("account_id", account_id, 'str'), - 'session_id': self._serialize.url("session_id", session_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'CreateRenderingSessionSettings') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize('RenderingSession', pipeline_response) - - if response.status_code == 201: - response_headers['MS-CV']=self._deserialize('str', response.headers.get('MS-CV')) - deserialized = self._deserialize('RenderingSession', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - create_session.metadata = {'url': '/accounts/{account_id}/sessions/{session_id}'} # type: ignore - - async def get_session( - self, - account_id: str, - session_id: str, - **kwargs - ) -> "models.RenderingSession": - """Gets the properties of a particular rendering session. - - Gets the properties of a particular rendering session. - - :param account_id: The Azure Remote Rendering account ID. - :type account_id: str - :param session_id: An ID uniquely identifying the rendering session for the given account. The - ID is case sensitive, can contain any combination of alphanumeric characters including hyphens - and underscores, and cannot contain more than 256 characters. - :type session_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RenderingSession, or the result of cls(response) - :rtype: ~azure.mixedreality.remoterendering._generated.models.RenderingSession - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.RenderingSession"] - error_map = { - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 500: lambda response: HttpResponseError(response=response, model=self._deserialize(models.ErrorResponse, response)), - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - - # Construct URL - url = self.get_session.metadata['url'] # type: ignore - path_format_arguments = { - 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - 'account_id': self._serialize.url("account_id", account_id, 'str'), - 'session_id': self._serialize.url("session_id", session_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - request = self._client.get(url, query_parameters, header_parameters) - 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) - raise HttpResponseError(response=response) - - deserialized = self._deserialize('RenderingSession', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get_session.metadata = {'url': '/accounts/{account_id}/sessions/{session_id}'} # type: ignore - - async def update_session( - self, - account_id: str, - session_id: str, - body: "models.UpdateSessionSettings", - **kwargs - ) -> "models.RenderingSession": - """Updates the max lease time of a particular rendering session. - - Updates the max lease time of a particular rendering session. - - :param account_id: The Azure Remote Rendering account ID. - :type account_id: str - :param session_id: An ID uniquely identifying the rendering session for the given account. The - ID is case sensitive, can contain any combination of alphanumeric characters including hyphens - and underscores, and cannot contain more than 256 characters. - :type session_id: str - :param body: Settings used to update the session. - :type body: ~azure.mixedreality.remoterendering._generated.models.UpdateSessionSettings - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RenderingSession, or the result of cls(response) - :rtype: ~azure.mixedreality.remoterendering._generated.models.RenderingSession - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.RenderingSession"] - error_map = { - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 422: lambda response: HttpResponseError(response=response, model=self._deserialize(models.ErrorResponse, response)), - 500: lambda response: HttpResponseError(response=response, model=self._deserialize(models.ErrorResponse, response)), - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.update_session.metadata['url'] # type: ignore - path_format_arguments = { - 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - 'account_id': self._serialize.url("account_id", account_id, 'str'), - 'session_id': self._serialize.url("session_id", session_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'UpdateSessionSettings') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - - 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) - raise HttpResponseError(response=response) - - deserialized = self._deserialize('RenderingSession', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - update_session.metadata = {'url': '/accounts/{account_id}/sessions/{session_id}'} # type: ignore - - async def stop_session( - self, - account_id: str, - session_id: str, - **kwargs - ) -> None: - """Stops a particular rendering session. - - Stops a particular rendering session. - - :param account_id: The Azure Remote Rendering account ID. - :type account_id: str - :param session_id: An ID uniquely identifying the rendering session for the given account. The - ID is case sensitive, can contain any combination of alphanumeric characters including hyphens - and underscores, and cannot contain more than 256 characters. - :type session_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 500: lambda response: HttpResponseError(response=response, model=self._deserialize(models.ErrorResponse, response)), - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - - # Construct URL - url = self.stop_session.metadata['url'] # type: ignore - path_format_arguments = { - 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - 'account_id': self._serialize.url("account_id", account_id, 'str'), - 'session_id': self._serialize.url("session_id", session_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers['MS-CV']=self._deserialize('str', response.headers.get('MS-CV')) - - if cls: - return cls(pipeline_response, None, response_headers) - - stop_session.metadata = {'url': '/accounts/{account_id}/sessions/{session_id}/:stop'} # type: ignore - - def list_sessions( - self, - account_id: str, - **kwargs - ) -> AsyncIterable["models.SessionsList"]: - """Gets a list of all rendering sessions. - - Gets a list of all rendering sessions. - - :param account_id: The Azure Remote Rendering account ID. - :type account_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SessionsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mixedreality.remoterendering._generated.models.SessionsList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SessionsList"] - error_map = { - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 500: lambda response: HttpResponseError(response=response, model=self._deserialize(models.ErrorResponse, response)), - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list_sessions.metadata['url'] # type: ignore - path_format_arguments = { - 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - 'account_id': self._serialize.url("account_id", account_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - path_format_arguments = { - 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - 'account_id': self._serialize.url("account_id", account_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('SessionsList', pipeline_response) - list_of_elem = deserialized.sessions - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - 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) - raise HttpResponseError(response=response) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_sessions.metadata = {'url': '/accounts/{account_id}/sessions'} # type: ignore diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/models/__init__.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/models/__init__.py deleted file mode 100644 index 231006f9c25b..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/models/__init__.py +++ /dev/null @@ -1,61 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -try: - from ._models_py3 import AssetConversion - from ._models_py3 import AssetConversionInputSettings - from ._models_py3 import AssetConversionOutput - from ._models_py3 import AssetConversionOutputSettings - from ._models_py3 import AssetConversionSettings - from ._models_py3 import ConversionList - from ._models_py3 import CreateAssetConversionSettings - from ._models_py3 import CreateRenderingSessionSettings - from ._models_py3 import ErrorResponse - from ._models_py3 import RemoteRenderingError - from ._models_py3 import RenderingSession - from ._models_py3 import SessionsList - from ._models_py3 import UpdateSessionSettings -except (SyntaxError, ImportError): - from ._models import AssetConversion # type: ignore - from ._models import AssetConversionInputSettings # type: ignore - from ._models import AssetConversionOutput # type: ignore - from ._models import AssetConversionOutputSettings # type: ignore - from ._models import AssetConversionSettings # type: ignore - from ._models import ConversionList # type: ignore - from ._models import CreateAssetConversionSettings # type: ignore - from ._models import CreateRenderingSessionSettings # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import RemoteRenderingError # type: ignore - from ._models import RenderingSession # type: ignore - from ._models import SessionsList # type: ignore - from ._models import UpdateSessionSettings # type: ignore - -from ._remote_rendering_rest_client_enums import ( - AssetConversionStatus, - RenderingSessionSize, - RenderingSessionStatus, -) - -__all__ = [ - 'AssetConversion', - 'AssetConversionInputSettings', - 'AssetConversionOutput', - 'AssetConversionOutputSettings', - 'AssetConversionSettings', - 'ConversionList', - 'CreateAssetConversionSettings', - 'CreateRenderingSessionSettings', - 'ErrorResponse', - 'RemoteRenderingError', - 'RenderingSession', - 'SessionsList', - 'UpdateSessionSettings', - 'AssetConversionStatus', - 'RenderingSessionSize', - 'RenderingSessionStatus', -] diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/models/_models.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/models/_models.py deleted file mode 100644 index a70239a592ae..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/models/_models.py +++ /dev/null @@ -1,538 +0,0 @@ -# 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 azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class AssetConversion(msrest.serialization.Model): - """The properties of the conversion. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. The ID of the conversion supplied when the conversion was created. - :type id: str - :param settings: Required. Conversion settings describe the origin of input files and - destination of output files. - :type settings: ~azure.mixedreality.remoterendering._generated.models.AssetConversionSettings - :ivar output: Information about the output of a successful conversion. Only present when the - status of the conversion is 'Succeeded'. - :vartype output: ~azure.mixedreality.remoterendering._generated.models.AssetConversionOutput - :param error: Required. The error object containing details about the conversion failure. - :type error: ~azure.mixedreality.remoterendering._generated.models.RemoteRenderingError - :param status: Required. The status of the conversion. Terminal states are 'Cancelled', - 'Failed', and 'Succeeded'. Possible values include: "NotStarted", "Running", "Cancelled", - "Failed", "Succeeded". - :type status: str or - ~azure.mixedreality.remoterendering._generated.models.AssetConversionStatus - :param created_on: Required. The time when the conversion was created. Date and time in ISO - 8601 format. - :type created_on: ~datetime.datetime - """ - - _validation = { - 'id': {'required': True}, - 'settings': {'required': True}, - 'output': {'readonly': True}, - 'error': {'required': True}, - 'status': {'required': True}, - 'created_on': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'settings': {'key': 'settings', 'type': 'AssetConversionSettings'}, - 'output': {'key': 'output', 'type': 'AssetConversionOutput'}, - 'error': {'key': 'error', 'type': 'RemoteRenderingError'}, - 'status': {'key': 'status', 'type': 'str'}, - 'created_on': {'key': 'creationTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(AssetConversion, self).__init__(**kwargs) - self.id = kwargs['id'] - self.settings = kwargs['settings'] - self.output = None - self.error = kwargs['error'] - self.status = kwargs['status'] - self.created_on = kwargs['created_on'] - - -class AssetConversionInputSettings(msrest.serialization.Model): - """Conversion input settings describe the origin of conversion input. - - All required parameters must be populated in order to send to Azure. - - :param storage_container_uri: Required. The URI of the Azure blob storage container containing - the input model. - :type storage_container_uri: str - :param storage_container_read_list_sas: An Azure blob storage container shared access signature - giving read and list access to the storage container. Optional. If not provided, the Azure - Remote Rendering account needs to be linked with the storage account containing the blob - container. See https://docs.microsoft.com/azure/remote-rendering/how-tos/create-an- - account#link-storage-accounts for details. For security purposes this field will never be - filled out in responses bodies. - :type storage_container_read_list_sas: str - :param blob_prefix: Only Blobs starting with this prefix will be downloaded to perform the - conversion. Optional. If not provided, all Blobs from the container will be downloaded. - :type blob_prefix: str - :param relative_input_asset_path: Required. The relative path starting at blobPrefix (or at the - container root if blobPrefix is not provided) to the input model. Must point to a file with a - supported file format ending. See https://docs.microsoft.com/azure/remote-rendering/how- - tos/conversion/model-conversion for details. - :type relative_input_asset_path: str - """ - - _validation = { - 'storage_container_uri': {'required': True}, - 'relative_input_asset_path': {'required': True}, - } - - _attribute_map = { - 'storage_container_uri': {'key': 'storageContainerUri', 'type': 'str'}, - 'storage_container_read_list_sas': {'key': 'storageContainerReadListSas', 'type': 'str'}, - 'blob_prefix': {'key': 'blobPrefix', 'type': 'str'}, - 'relative_input_asset_path': {'key': 'relativeInputAssetPath', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AssetConversionInputSettings, self).__init__(**kwargs) - self.storage_container_uri = kwargs['storage_container_uri'] - self.storage_container_read_list_sas = kwargs.get('storage_container_read_list_sas', None) - self.blob_prefix = kwargs.get('blob_prefix', None) - self.relative_input_asset_path = kwargs['relative_input_asset_path'] - - -class AssetConversionOutput(msrest.serialization.Model): - """Information about the output of a successful conversion. Only present when the status of the conversion is 'Succeeded'. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar asset_uri: URI of the asset generated by the conversion process. - :vartype asset_uri: str - """ - - _validation = { - 'asset_uri': {'readonly': True}, - } - - _attribute_map = { - 'asset_uri': {'key': 'outputAssetUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AssetConversionOutput, self).__init__(**kwargs) - self.asset_uri = None - - -class AssetConversionOutputSettings(msrest.serialization.Model): - """Conversion output settings describe the destination of conversion output. - - All required parameters must be populated in order to send to Azure. - - :param storage_container_uri: Required. The URI of the Azure blob storage container where the - result of the conversion should be written to. - :type storage_container_uri: str - :param storage_container_write_sas: An Azure blob storage container shared access signature - giving write access to the storage container. Optional. If not provided, the Azure Remote - Rendering account needs to be linked with the storage account containing the blob container. - See https://docs.microsoft.com/azure/remote-rendering/how-tos/create-an-account#link-storage- - accounts for details. For security purposes this field will never be filled out in responses - bodies. - :type storage_container_write_sas: str - :param blob_prefix: A prefix which gets prepended in front of all files produced by the - conversion process. Will be treated as a virtual folder. Optional. If not provided, output - files will be stored at the container root. - :type blob_prefix: str - :param output_asset_filename: The file name of the output asset. Must end in '.arrAsset'. - Optional. If not provided, file name will the same name as the input asset, with '.arrAsset' - extension. - :type output_asset_filename: str - """ - - _validation = { - 'storage_container_uri': {'required': True}, - } - - _attribute_map = { - 'storage_container_uri': {'key': 'storageContainerUri', 'type': 'str'}, - 'storage_container_write_sas': {'key': 'storageContainerWriteSas', 'type': 'str'}, - 'blob_prefix': {'key': 'blobPrefix', 'type': 'str'}, - 'output_asset_filename': {'key': 'outputAssetFilename', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AssetConversionOutputSettings, self).__init__(**kwargs) - self.storage_container_uri = kwargs['storage_container_uri'] - self.storage_container_write_sas = kwargs.get('storage_container_write_sas', None) - self.blob_prefix = kwargs.get('blob_prefix', None) - self.output_asset_filename = kwargs.get('output_asset_filename', None) - - -class AssetConversionSettings(msrest.serialization.Model): - """Conversion settings describe the origin of input files and destination of output files. - - All required parameters must be populated in order to send to Azure. - - :param input_settings: Required. Conversion input settings describe the origin of conversion - input. - :type input_settings: - ~azure.mixedreality.remoterendering._generated.models.AssetConversionInputSettings - :param output_settings: Required. Conversion output settings describe the destination of - conversion output. - :type output_settings: - ~azure.mixedreality.remoterendering._generated.models.AssetConversionOutputSettings - """ - - _validation = { - 'input_settings': {'required': True}, - 'output_settings': {'required': True}, - } - - _attribute_map = { - 'input_settings': {'key': 'inputLocation', 'type': 'AssetConversionInputSettings'}, - 'output_settings': {'key': 'outputLocation', 'type': 'AssetConversionOutputSettings'}, - } - - def __init__( - self, - **kwargs - ): - super(AssetConversionSettings, self).__init__(**kwargs) - self.input_settings = kwargs['input_settings'] - self.output_settings = kwargs['output_settings'] - - -class ConversionList(msrest.serialization.Model): - """List of conversions. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param conversions: Required. The list of conversions. - :type conversions: list[~azure.mixedreality.remoterendering._generated.models.AssetConversion] - :ivar next_link: If more conversions are available this field will contain a URL where the next - batch of conversions can be requested. This URL will need the same authentication as all calls - to the Azure Remote Rendering API. - :vartype next_link: str - """ - - _validation = { - 'conversions': {'required': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'conversions': {'key': 'conversions', 'type': '[AssetConversion]'}, - 'next_link': {'key': '@nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ConversionList, self).__init__(**kwargs) - self.conversions = kwargs['conversions'] - self.next_link = None - - -class CreateAssetConversionSettings(msrest.serialization.Model): - """Request to start a conversion. - - All required parameters must be populated in order to send to Azure. - - :param settings: Required. Conversion settings describe the origin of input files and - destination of output files. - :type settings: ~azure.mixedreality.remoterendering._generated.models.AssetConversionSettings - """ - - _validation = { - 'settings': {'required': True}, - } - - _attribute_map = { - 'settings': {'key': 'settings', 'type': 'AssetConversionSettings'}, - } - - def __init__( - self, - **kwargs - ): - super(CreateAssetConversionSettings, self).__init__(**kwargs) - self.settings = kwargs['settings'] - - -class CreateRenderingSessionSettings(msrest.serialization.Model): - """Settings of the session to be created. - - All required parameters must be populated in order to send to Azure. - - :param lease_time_minutes: Required. The time in minutes the session will run after reaching - the 'Ready' state. It has to be between 0 and 1440. - :type lease_time_minutes: int - :param size: Required. The size of the server used for the rendering session. The size impacts - the number of polygons the server can render. Refer to https://docs.microsoft.com/azure/remote- - rendering/reference/vm-sizes for details. Possible values include: "Standard", "Premium". - :type size: str or ~azure.mixedreality.remoterendering._generated.models.RenderingSessionSize - """ - - _validation = { - 'lease_time_minutes': {'required': True}, - 'size': {'required': True}, - } - - _attribute_map = { - 'lease_time_minutes': {'key': 'maxLeaseTimeMinutes', 'type': 'int'}, - 'size': {'key': 'size', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CreateRenderingSessionSettings, self).__init__(**kwargs) - self.lease_time_minutes = kwargs['lease_time_minutes'] - self.size = kwargs['size'] - - -class ErrorResponse(msrest.serialization.Model): - """The error response containing details of why the request failed. - - All required parameters must be populated in order to send to Azure. - - :param error: Required. The error object containing details of why the request failed. - :type error: ~azure.mixedreality.remoterendering._generated.models.RemoteRenderingError - """ - - _validation = { - 'error': {'required': True}, - } - - _attribute_map = { - 'error': {'key': 'error', 'type': 'RemoteRenderingError'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs['error'] - - -class RemoteRenderingError(msrest.serialization.Model): - """The error object containing details of why the request failed. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. Error code. - :type code: str - :param message: Required. A human-readable representation of the error. - :type message: str - :ivar details: An array of details about specific errors that led to this reported error. - :vartype details: - list[~azure.mixedreality.remoterendering._generated.models.RemoteRenderingError] - :ivar target: The target of the particular error (e.g., the name of the property in error). - :vartype target: str - :ivar inner_error: An object containing more specific information than the current object about - the error. - :vartype inner_error: - ~azure.mixedreality.remoterendering._generated.models.RemoteRenderingError - """ - - _validation = { - 'code': {'required': True}, - 'message': {'required': True}, - 'details': {'readonly': True}, - 'target': {'readonly': True}, - 'inner_error': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[RemoteRenderingError]'}, - 'target': {'key': 'target', 'type': 'str'}, - 'inner_error': {'key': 'innerError', 'type': 'RemoteRenderingError'}, - } - - def __init__( - self, - **kwargs - ): - super(RemoteRenderingError, self).__init__(**kwargs) - self.code = kwargs['code'] - self.message = kwargs['message'] - self.details = None - self.target = None - self.inner_error = None - - -class RenderingSession(msrest.serialization.Model): - """The properties of a rendering session. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. The ID of the session supplied when the session was created. - :type id: str - :ivar arr_inspector_port: The TCP port at which the Azure Remote Rendering Inspector tool is - hosted. - :vartype arr_inspector_port: int - :ivar handshake_port: The TCP port used for the handshake when establishing a connection. - :vartype handshake_port: int - :ivar elapsed_time_minutes: Amount of time in minutes the session is or was in the 'Ready' - state. Time is rounded down to a full minute. - :vartype elapsed_time_minutes: int - :ivar hostname: The hostname under which the rendering session is reachable. - :vartype hostname: str - :ivar lease_time_minutes: The time in minutes the session will run after reaching the 'Ready' - state. - :vartype lease_time_minutes: int - :param size: Required. The size of the server used for the rendering session. The size impacts - the number of polygons the server can render. Refer to https://docs.microsoft.com/azure/remote- - rendering/reference/vm-sizes for details. Possible values include: "Standard", "Premium". - :type size: str or ~azure.mixedreality.remoterendering._generated.models.RenderingSessionSize - :param status: Required. The status of the rendering session. Terminal states are 'Error', - 'Expired', and 'Stopped'. Possible values include: "Error", "Expired", "Starting", "Ready", - "Stopped". - :type status: str or - ~azure.mixedreality.remoterendering._generated.models.RenderingSessionStatus - :ivar teraflops: The computational power of the rendering session GPU measured in teraflops. - :vartype teraflops: float - :ivar error: The error object containing details about the rendering session startup failure. - :vartype error: ~azure.mixedreality.remoterendering._generated.models.RemoteRenderingError - :ivar created_on: The time when the rendering session was created. Date and time in ISO 8601 - format. - :vartype created_on: ~datetime.datetime - """ - - _validation = { - 'id': {'required': True}, - 'arr_inspector_port': {'readonly': True, 'maximum': 65534, 'minimum': 49152}, - 'handshake_port': {'readonly': True, 'maximum': 65534, 'minimum': 49152}, - 'elapsed_time_minutes': {'readonly': True}, - 'hostname': {'readonly': True}, - 'lease_time_minutes': {'readonly': True}, - 'size': {'required': True}, - 'status': {'required': True}, - 'teraflops': {'readonly': True}, - 'error': {'readonly': True}, - 'created_on': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'arr_inspector_port': {'key': 'arrInspectorPort', 'type': 'int'}, - 'handshake_port': {'key': 'handshakePort', 'type': 'int'}, - 'elapsed_time_minutes': {'key': 'elapsedTimeMinutes', 'type': 'int'}, - 'hostname': {'key': 'hostname', 'type': 'str'}, - 'lease_time_minutes': {'key': 'maxLeaseTimeMinutes', 'type': 'int'}, - 'size': {'key': 'size', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'teraflops': {'key': 'teraflops', 'type': 'float'}, - 'error': {'key': 'error', 'type': 'RemoteRenderingError'}, - 'created_on': {'key': 'creationTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(RenderingSession, self).__init__(**kwargs) - self.id = kwargs['id'] - self.arr_inspector_port = None - self.handshake_port = None - self.elapsed_time_minutes = None - self.hostname = None - self.lease_time_minutes = None - self.size = kwargs['size'] - self.status = kwargs['status'] - self.teraflops = None - self.error = None - self.created_on = None - - -class SessionsList(msrest.serialization.Model): - """The result of a list sessions request. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param sessions: Required. The list of rendering sessions. Does not include sessions in - 'Stopped' state. - :type sessions: list[~azure.mixedreality.remoterendering._generated.models.RenderingSession] - :ivar next_link: If more rendering sessions are available this field will contain a URL where - the next batch of sessions can be requested. This URL will need the same authentication as all - calls to the Azure Remote Rendering API. - :vartype next_link: str - """ - - _validation = { - 'sessions': {'required': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'sessions': {'key': 'sessions', 'type': '[RenderingSession]'}, - 'next_link': {'key': '@nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SessionsList, self).__init__(**kwargs) - self.sessions = kwargs['sessions'] - self.next_link = None - - -class UpdateSessionSettings(msrest.serialization.Model): - """Settings used to update the session. - - All required parameters must be populated in order to send to Azure. - - :param lease_time_minutes: Required. Update to the time the session will run after it reached - the 'Ready' state. It has to be larger than the current value of maxLeaseTimeMinutes and less - than 1440. - :type lease_time_minutes: int - """ - - _validation = { - 'lease_time_minutes': {'required': True}, - } - - _attribute_map = { - 'lease_time_minutes': {'key': 'maxLeaseTimeMinutes', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateSessionSettings, self).__init__(**kwargs) - self.lease_time_minutes = kwargs['lease_time_minutes'] diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/models/_models_py3.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/models/_models_py3.py deleted file mode 100644 index 1603b2006645..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/models/_models_py3.py +++ /dev/null @@ -1,582 +0,0 @@ -# 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 datetime -from typing import List, Optional, Union - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - -from ._remote_rendering_rest_client_enums import * - - -class AssetConversion(msrest.serialization.Model): - """The properties of the conversion. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. The ID of the conversion supplied when the conversion was created. - :type id: str - :param settings: Required. Conversion settings describe the origin of input files and - destination of output files. - :type settings: ~azure.mixedreality.remoterendering._generated.models.AssetConversionSettings - :ivar output: Information about the output of a successful conversion. Only present when the - status of the conversion is 'Succeeded'. - :vartype output: ~azure.mixedreality.remoterendering._generated.models.AssetConversionOutput - :param error: Required. The error object containing details about the conversion failure. - :type error: ~azure.mixedreality.remoterendering._generated.models.RemoteRenderingError - :param status: Required. The status of the conversion. Terminal states are 'Cancelled', - 'Failed', and 'Succeeded'. Possible values include: "NotStarted", "Running", "Cancelled", - "Failed", "Succeeded". - :type status: str or - ~azure.mixedreality.remoterendering._generated.models.AssetConversionStatus - :param created_on: Required. The time when the conversion was created. Date and time in ISO - 8601 format. - :type created_on: ~datetime.datetime - """ - - _validation = { - 'id': {'required': True}, - 'settings': {'required': True}, - 'output': {'readonly': True}, - 'error': {'required': True}, - 'status': {'required': True}, - 'created_on': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'settings': {'key': 'settings', 'type': 'AssetConversionSettings'}, - 'output': {'key': 'output', 'type': 'AssetConversionOutput'}, - 'error': {'key': 'error', 'type': 'RemoteRenderingError'}, - 'status': {'key': 'status', 'type': 'str'}, - 'created_on': {'key': 'creationTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - *, - id: str, - settings: "AssetConversionSettings", - error: "RemoteRenderingError", - status: Union[str, "AssetConversionStatus"], - created_on: datetime.datetime, - **kwargs - ): - super(AssetConversion, self).__init__(**kwargs) - self.id = id - self.settings = settings - self.output = None - self.error = error - self.status = status - self.created_on = created_on - - -class AssetConversionInputSettings(msrest.serialization.Model): - """Conversion input settings describe the origin of conversion input. - - All required parameters must be populated in order to send to Azure. - - :param storage_container_uri: Required. The URI of the Azure blob storage container containing - the input model. - :type storage_container_uri: str - :param storage_container_read_list_sas: An Azure blob storage container shared access signature - giving read and list access to the storage container. Optional. If not provided, the Azure - Remote Rendering account needs to be linked with the storage account containing the blob - container. See https://docs.microsoft.com/azure/remote-rendering/how-tos/create-an- - account#link-storage-accounts for details. For security purposes this field will never be - filled out in responses bodies. - :type storage_container_read_list_sas: str - :param blob_prefix: Only Blobs starting with this prefix will be downloaded to perform the - conversion. Optional. If not provided, all Blobs from the container will be downloaded. - :type blob_prefix: str - :param relative_input_asset_path: Required. The relative path starting at blobPrefix (or at the - container root if blobPrefix is not provided) to the input model. Must point to a file with a - supported file format ending. See https://docs.microsoft.com/azure/remote-rendering/how- - tos/conversion/model-conversion for details. - :type relative_input_asset_path: str - """ - - _validation = { - 'storage_container_uri': {'required': True}, - 'relative_input_asset_path': {'required': True}, - } - - _attribute_map = { - 'storage_container_uri': {'key': 'storageContainerUri', 'type': 'str'}, - 'storage_container_read_list_sas': {'key': 'storageContainerReadListSas', 'type': 'str'}, - 'blob_prefix': {'key': 'blobPrefix', 'type': 'str'}, - 'relative_input_asset_path': {'key': 'relativeInputAssetPath', 'type': 'str'}, - } - - def __init__( - self, - *, - storage_container_uri: str, - relative_input_asset_path: str, - storage_container_read_list_sas: Optional[str] = None, - blob_prefix: Optional[str] = None, - **kwargs - ): - super(AssetConversionInputSettings, self).__init__(**kwargs) - self.storage_container_uri = storage_container_uri - self.storage_container_read_list_sas = storage_container_read_list_sas - self.blob_prefix = blob_prefix - self.relative_input_asset_path = relative_input_asset_path - - -class AssetConversionOutput(msrest.serialization.Model): - """Information about the output of a successful conversion. Only present when the status of the conversion is 'Succeeded'. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar asset_uri: URI of the asset generated by the conversion process. - :vartype asset_uri: str - """ - - _validation = { - 'asset_uri': {'readonly': True}, - } - - _attribute_map = { - 'asset_uri': {'key': 'outputAssetUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AssetConversionOutput, self).__init__(**kwargs) - self.asset_uri = None - - -class AssetConversionOutputSettings(msrest.serialization.Model): - """Conversion output settings describe the destination of conversion output. - - All required parameters must be populated in order to send to Azure. - - :param storage_container_uri: Required. The URI of the Azure blob storage container where the - result of the conversion should be written to. - :type storage_container_uri: str - :param storage_container_write_sas: An Azure blob storage container shared access signature - giving write access to the storage container. Optional. If not provided, the Azure Remote - Rendering account needs to be linked with the storage account containing the blob container. - See https://docs.microsoft.com/azure/remote-rendering/how-tos/create-an-account#link-storage- - accounts for details. For security purposes this field will never be filled out in responses - bodies. - :type storage_container_write_sas: str - :param blob_prefix: A prefix which gets prepended in front of all files produced by the - conversion process. Will be treated as a virtual folder. Optional. If not provided, output - files will be stored at the container root. - :type blob_prefix: str - :param output_asset_filename: The file name of the output asset. Must end in '.arrAsset'. - Optional. If not provided, file name will the same name as the input asset, with '.arrAsset' - extension. - :type output_asset_filename: str - """ - - _validation = { - 'storage_container_uri': {'required': True}, - } - - _attribute_map = { - 'storage_container_uri': {'key': 'storageContainerUri', 'type': 'str'}, - 'storage_container_write_sas': {'key': 'storageContainerWriteSas', 'type': 'str'}, - 'blob_prefix': {'key': 'blobPrefix', 'type': 'str'}, - 'output_asset_filename': {'key': 'outputAssetFilename', 'type': 'str'}, - } - - def __init__( - self, - *, - storage_container_uri: str, - storage_container_write_sas: Optional[str] = None, - blob_prefix: Optional[str] = None, - output_asset_filename: Optional[str] = None, - **kwargs - ): - super(AssetConversionOutputSettings, self).__init__(**kwargs) - self.storage_container_uri = storage_container_uri - self.storage_container_write_sas = storage_container_write_sas - self.blob_prefix = blob_prefix - self.output_asset_filename = output_asset_filename - - -class AssetConversionSettings(msrest.serialization.Model): - """Conversion settings describe the origin of input files and destination of output files. - - All required parameters must be populated in order to send to Azure. - - :param input_settings: Required. Conversion input settings describe the origin of conversion - input. - :type input_settings: - ~azure.mixedreality.remoterendering._generated.models.AssetConversionInputSettings - :param output_settings: Required. Conversion output settings describe the destination of - conversion output. - :type output_settings: - ~azure.mixedreality.remoterendering._generated.models.AssetConversionOutputSettings - """ - - _validation = { - 'input_settings': {'required': True}, - 'output_settings': {'required': True}, - } - - _attribute_map = { - 'input_settings': {'key': 'inputLocation', 'type': 'AssetConversionInputSettings'}, - 'output_settings': {'key': 'outputLocation', 'type': 'AssetConversionOutputSettings'}, - } - - def __init__( - self, - *, - input_settings: "AssetConversionInputSettings", - output_settings: "AssetConversionOutputSettings", - **kwargs - ): - super(AssetConversionSettings, self).__init__(**kwargs) - self.input_settings = input_settings - self.output_settings = output_settings - - -class ConversionList(msrest.serialization.Model): - """List of conversions. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param conversions: Required. The list of conversions. - :type conversions: list[~azure.mixedreality.remoterendering._generated.models.AssetConversion] - :ivar next_link: If more conversions are available this field will contain a URL where the next - batch of conversions can be requested. This URL will need the same authentication as all calls - to the Azure Remote Rendering API. - :vartype next_link: str - """ - - _validation = { - 'conversions': {'required': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'conversions': {'key': 'conversions', 'type': '[AssetConversion]'}, - 'next_link': {'key': '@nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - conversions: List["AssetConversion"], - **kwargs - ): - super(ConversionList, self).__init__(**kwargs) - self.conversions = conversions - self.next_link = None - - -class CreateAssetConversionSettings(msrest.serialization.Model): - """Request to start a conversion. - - All required parameters must be populated in order to send to Azure. - - :param settings: Required. Conversion settings describe the origin of input files and - destination of output files. - :type settings: ~azure.mixedreality.remoterendering._generated.models.AssetConversionSettings - """ - - _validation = { - 'settings': {'required': True}, - } - - _attribute_map = { - 'settings': {'key': 'settings', 'type': 'AssetConversionSettings'}, - } - - def __init__( - self, - *, - settings: "AssetConversionSettings", - **kwargs - ): - super(CreateAssetConversionSettings, self).__init__(**kwargs) - self.settings = settings - - -class CreateRenderingSessionSettings(msrest.serialization.Model): - """Settings of the session to be created. - - All required parameters must be populated in order to send to Azure. - - :param lease_time_minutes: Required. The time in minutes the session will run after reaching - the 'Ready' state. It has to be between 0 and 1440. - :type lease_time_minutes: int - :param size: Required. The size of the server used for the rendering session. The size impacts - the number of polygons the server can render. Refer to https://docs.microsoft.com/azure/remote- - rendering/reference/vm-sizes for details. Possible values include: "Standard", "Premium". - :type size: str or ~azure.mixedreality.remoterendering._generated.models.RenderingSessionSize - """ - - _validation = { - 'lease_time_minutes': {'required': True}, - 'size': {'required': True}, - } - - _attribute_map = { - 'lease_time_minutes': {'key': 'maxLeaseTimeMinutes', 'type': 'int'}, - 'size': {'key': 'size', 'type': 'str'}, - } - - def __init__( - self, - *, - lease_time_minutes: int, - size: Union[str, "RenderingSessionSize"], - **kwargs - ): - super(CreateRenderingSessionSettings, self).__init__(**kwargs) - self.lease_time_minutes = lease_time_minutes - self.size = size - - -class ErrorResponse(msrest.serialization.Model): - """The error response containing details of why the request failed. - - All required parameters must be populated in order to send to Azure. - - :param error: Required. The error object containing details of why the request failed. - :type error: ~azure.mixedreality.remoterendering._generated.models.RemoteRenderingError - """ - - _validation = { - 'error': {'required': True}, - } - - _attribute_map = { - 'error': {'key': 'error', 'type': 'RemoteRenderingError'}, - } - - def __init__( - self, - *, - error: "RemoteRenderingError", - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = error - - -class RemoteRenderingError(msrest.serialization.Model): - """The error object containing details of why the request failed. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. Error code. - :type code: str - :param message: Required. A human-readable representation of the error. - :type message: str - :ivar details: An array of details about specific errors that led to this reported error. - :vartype details: - list[~azure.mixedreality.remoterendering._generated.models.RemoteRenderingError] - :ivar target: The target of the particular error (e.g., the name of the property in error). - :vartype target: str - :ivar inner_error: An object containing more specific information than the current object about - the error. - :vartype inner_error: - ~azure.mixedreality.remoterendering._generated.models.RemoteRenderingError - """ - - _validation = { - 'code': {'required': True}, - 'message': {'required': True}, - 'details': {'readonly': True}, - 'target': {'readonly': True}, - 'inner_error': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[RemoteRenderingError]'}, - 'target': {'key': 'target', 'type': 'str'}, - 'inner_error': {'key': 'innerError', 'type': 'RemoteRenderingError'}, - } - - def __init__( - self, - *, - code: str, - message: str, - **kwargs - ): - super(RemoteRenderingError, self).__init__(**kwargs) - self.code = code - self.message = message - self.details = None - self.target = None - self.inner_error = None - - -class RenderingSession(msrest.serialization.Model): - """The properties of a rendering session. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. The ID of the session supplied when the session was created. - :type id: str - :ivar arr_inspector_port: The TCP port at which the Azure Remote Rendering Inspector tool is - hosted. - :vartype arr_inspector_port: int - :ivar handshake_port: The TCP port used for the handshake when establishing a connection. - :vartype handshake_port: int - :ivar elapsed_time_minutes: Amount of time in minutes the session is or was in the 'Ready' - state. Time is rounded down to a full minute. - :vartype elapsed_time_minutes: int - :ivar hostname: The hostname under which the rendering session is reachable. - :vartype hostname: str - :ivar lease_time_minutes: The time in minutes the session will run after reaching the 'Ready' - state. - :vartype lease_time_minutes: int - :param size: Required. The size of the server used for the rendering session. The size impacts - the number of polygons the server can render. Refer to https://docs.microsoft.com/azure/remote- - rendering/reference/vm-sizes for details. Possible values include: "Standard", "Premium". - :type size: str or ~azure.mixedreality.remoterendering._generated.models.RenderingSessionSize - :param status: Required. The status of the rendering session. Terminal states are 'Error', - 'Expired', and 'Stopped'. Possible values include: "Error", "Expired", "Starting", "Ready", - "Stopped". - :type status: str or - ~azure.mixedreality.remoterendering._generated.models.RenderingSessionStatus - :ivar teraflops: The computational power of the rendering session GPU measured in teraflops. - :vartype teraflops: float - :ivar error: The error object containing details about the rendering session startup failure. - :vartype error: ~azure.mixedreality.remoterendering._generated.models.RemoteRenderingError - :ivar created_on: The time when the rendering session was created. Date and time in ISO 8601 - format. - :vartype created_on: ~datetime.datetime - """ - - _validation = { - 'id': {'required': True}, - 'arr_inspector_port': {'readonly': True, 'maximum': 65534, 'minimum': 49152}, - 'handshake_port': {'readonly': True, 'maximum': 65534, 'minimum': 49152}, - 'elapsed_time_minutes': {'readonly': True}, - 'hostname': {'readonly': True}, - 'lease_time_minutes': {'readonly': True}, - 'size': {'required': True}, - 'status': {'required': True}, - 'teraflops': {'readonly': True}, - 'error': {'readonly': True}, - 'created_on': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'arr_inspector_port': {'key': 'arrInspectorPort', 'type': 'int'}, - 'handshake_port': {'key': 'handshakePort', 'type': 'int'}, - 'elapsed_time_minutes': {'key': 'elapsedTimeMinutes', 'type': 'int'}, - 'hostname': {'key': 'hostname', 'type': 'str'}, - 'lease_time_minutes': {'key': 'maxLeaseTimeMinutes', 'type': 'int'}, - 'size': {'key': 'size', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'teraflops': {'key': 'teraflops', 'type': 'float'}, - 'error': {'key': 'error', 'type': 'RemoteRenderingError'}, - 'created_on': {'key': 'creationTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - *, - id: str, - size: Union[str, "RenderingSessionSize"], - status: Union[str, "RenderingSessionStatus"], - **kwargs - ): - super(RenderingSession, self).__init__(**kwargs) - self.id = id - self.arr_inspector_port = None - self.handshake_port = None - self.elapsed_time_minutes = None - self.hostname = None - self.lease_time_minutes = None - self.size = size - self.status = status - self.teraflops = None - self.error = None - self.created_on = None - - -class SessionsList(msrest.serialization.Model): - """The result of a list sessions request. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param sessions: Required. The list of rendering sessions. Does not include sessions in - 'Stopped' state. - :type sessions: list[~azure.mixedreality.remoterendering._generated.models.RenderingSession] - :ivar next_link: If more rendering sessions are available this field will contain a URL where - the next batch of sessions can be requested. This URL will need the same authentication as all - calls to the Azure Remote Rendering API. - :vartype next_link: str - """ - - _validation = { - 'sessions': {'required': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'sessions': {'key': 'sessions', 'type': '[RenderingSession]'}, - 'next_link': {'key': '@nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - sessions: List["RenderingSession"], - **kwargs - ): - super(SessionsList, self).__init__(**kwargs) - self.sessions = sessions - self.next_link = None - - -class UpdateSessionSettings(msrest.serialization.Model): - """Settings used to update the session. - - All required parameters must be populated in order to send to Azure. - - :param lease_time_minutes: Required. Update to the time the session will run after it reached - the 'Ready' state. It has to be larger than the current value of maxLeaseTimeMinutes and less - than 1440. - :type lease_time_minutes: int - """ - - _validation = { - 'lease_time_minutes': {'required': True}, - } - - _attribute_map = { - 'lease_time_minutes': {'key': 'maxLeaseTimeMinutes', 'type': 'int'}, - } - - def __init__( - self, - *, - lease_time_minutes: int, - **kwargs - ): - super(UpdateSessionSettings, self).__init__(**kwargs) - self.lease_time_minutes = lease_time_minutes diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/models/_remote_rendering_rest_client_enums.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/models/_remote_rendering_rest_client_enums.py deleted file mode 100644 index dc98ad743f46..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/models/_remote_rendering_rest_client_enums.py +++ /dev/null @@ -1,56 +0,0 @@ -# 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 enum import Enum, EnumMeta -from six import with_metaclass - -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AssetConversionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The status of the conversion. Terminal states are 'Cancelled', 'Failed', and 'Succeeded'. - """ - - NOT_STARTED = "NotStarted" #: The conversion was created but hasn't started. - RUNNING = "Running" #: The conversion is running. - CANCELLED = "Cancelled" #: The conversion was cancelled. This is a terminal state. - FAILED = "Failed" #: The conversion has failed. Check the 'error' field for more details. This is a terminal state. - SUCCEEDED = "Succeeded" #: The conversion has succeeded. Check the 'output' field for output asset location. This is a terminal state. - -class RenderingSessionSize(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The size of the server used for the rendering session. The size impacts the number of polygons - the server can render. Refer to https://docs.microsoft.com/azure/remote-rendering/reference/vm- - sizes for details. - """ - - STANDARD = "Standard" #: Standard rendering session size. - PREMIUM = "Premium" #: Premium rendering session size. - -class RenderingSessionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The status of the rendering session. Terminal states are 'Error', 'Expired', and 'Stopped'. - """ - - ERROR = "Error" #: The rendering session has encountered an error, and is unusable. This is a terminal state. - EXPIRED = "Expired" #: The rendering session enters the 'Expired' state when it has been in the 'Ready' state longer than its lease time. This is a terminal state. - STARTING = "Starting" #: The rendering session is starting, but not accepting incoming connections yet. - READY = "Ready" #: The rendering session is ready for incoming connections. - STOPPED = "Stopped" #: The rendering session has been stopped with the 'Stop Session' operation. This is a terminal state. diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/operations/__init__.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/operations/__init__.py deleted file mode 100644 index dd0822aab99b..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/operations/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -# 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 ._remote_rendering_operations import RemoteRenderingOperations - -__all__ = [ - 'RemoteRenderingOperations', -] diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/operations/_remote_rendering_operations.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/operations/_remote_rendering_operations.py deleted file mode 100644 index 3badd06cebba..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/operations/_remote_rendering_operations.py +++ /dev/null @@ -1,632 +0,0 @@ -# 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 -import warnings - -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class RemoteRenderingOperations(object): - """RemoteRenderingOperations 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.mixedreality.remoterendering._generated.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): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def create_conversion( - self, - account_id, # type: str - conversion_id, # type: str - body, # type: "models.CreateAssetConversionSettings" - **kwargs # type: Any - ): - # type: (...) -> "models.AssetConversion" - """Creates a conversion using an asset stored in an Azure Blob Storage account. - - Creates a conversion using an asset stored in an Azure Blob Storage account. - - :param account_id: The Azure Remote Rendering account ID. - :type account_id: str - :param conversion_id: An ID uniquely identifying the conversion for the given account. The ID - is case sensitive, can contain any combination of alphanumeric characters including hyphens and - underscores, and cannot contain more than 256 characters. - :type conversion_id: str - :param body: Request body configuring the settings for an asset conversion. - :type body: ~azure.mixedreality.remoterendering._generated.models.CreateAssetConversionSettings - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AssetConversion, or the result of cls(response) - :rtype: ~azure.mixedreality.remoterendering._generated.models.AssetConversion - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AssetConversion"] - error_map = { - 404: ResourceNotFoundError, - 400: lambda response: HttpResponseError(response=response, model=self._deserialize(models.ErrorResponse, response)), - 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(models.ErrorResponse, response)), - 500: lambda response: HttpResponseError(response=response, model=self._deserialize(models.ErrorResponse, response)), - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.create_conversion.metadata['url'] # type: ignore - path_format_arguments = { - 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - 'account_id': self._serialize.url("account_id", account_id, 'str'), - 'conversion_id': self._serialize.url("conversion_id", conversion_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'CreateAssetConversionSettings') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - if response.status_code == 200: - response_headers['MS-CV']=self._deserialize('str', response.headers.get('MS-CV')) - deserialized = self._deserialize('AssetConversion', pipeline_response) - - if response.status_code == 201: - response_headers['MS-CV']=self._deserialize('str', response.headers.get('MS-CV')) - deserialized = self._deserialize('AssetConversion', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - create_conversion.metadata = {'url': '/accounts/{account_id}/conversions/{conversion_id}'} # type: ignore - - def get_conversion( - self, - account_id, # type: str - conversion_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "models.AssetConversion" - """Gets the status of a particular conversion. - - Gets the status of a particular conversion. - - :param account_id: The Azure Remote Rendering account ID. - :type account_id: str - :param conversion_id: An ID uniquely identifying the conversion for the given account. The ID - is case sensitive, can contain any combination of alphanumeric characters including hyphens and - underscores, and cannot contain more than 256 characters. - :type conversion_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AssetConversion, or the result of cls(response) - :rtype: ~azure.mixedreality.remoterendering._generated.models.AssetConversion - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AssetConversion"] - error_map = { - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 500: lambda response: HttpResponseError(response=response, model=self._deserialize(models.ErrorResponse, response)), - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - - # Construct URL - url = self.get_conversion.metadata['url'] # type: ignore - path_format_arguments = { - 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - 'account_id': self._serialize.url("account_id", account_id, 'str'), - 'conversion_id': self._serialize.url("conversion_id", conversion_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = 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) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers['MS-CV']=self._deserialize('str', response.headers.get('MS-CV')) - response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - deserialized = self._deserialize('AssetConversion', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - get_conversion.metadata = {'url': '/accounts/{account_id}/conversions/{conversion_id}'} # type: ignore - - def list_conversions( - self, - account_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.ConversionList"] - """Gets a list of all conversions. - - Gets a list of all conversions. - - :param account_id: The Azure Remote Rendering account ID. - :type account_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConversionList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mixedreality.remoterendering._generated.models.ConversionList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ConversionList"] - error_map = { - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 500: lambda response: HttpResponseError(response=response, model=self._deserialize(models.ErrorResponse, response)), - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list_conversions.metadata['url'] # type: ignore - path_format_arguments = { - 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - 'account_id': self._serialize.url("account_id", account_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - path_format_arguments = { - 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - 'account_id': self._serialize.url("account_id", account_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('ConversionList', pipeline_response) - list_of_elem = deserialized.conversions - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = 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) - raise HttpResponseError(response=response) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_conversions.metadata = {'url': '/accounts/{account_id}/conversions'} # type: ignore - - def create_session( - self, - account_id, # type: str - session_id, # type: str - body, # type: "models.CreateRenderingSessionSettings" - **kwargs # type: Any - ): - # type: (...) -> "models.RenderingSession" - """Creates a new rendering session. - - Creates a new rendering session. - - :param account_id: The Azure Remote Rendering account ID. - :type account_id: str - :param session_id: An ID uniquely identifying the rendering session for the given account. The - ID is case sensitive, can contain any combination of alphanumeric characters including hyphens - and underscores, and cannot contain more than 256 characters. - :type session_id: str - :param body: Settings of the session to be created. - :type body: ~azure.mixedreality.remoterendering._generated.models.CreateRenderingSessionSettings - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RenderingSession, or the result of cls(response) - :rtype: ~azure.mixedreality.remoterendering._generated.models.RenderingSession - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.RenderingSession"] - error_map = { - 404: ResourceNotFoundError, - 400: lambda response: HttpResponseError(response=response, model=self._deserialize(models.ErrorResponse, response)), - 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(models.ErrorResponse, response)), - 500: lambda response: HttpResponseError(response=response, model=self._deserialize(models.ErrorResponse, response)), - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.create_session.metadata['url'] # type: ignore - path_format_arguments = { - 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - 'account_id': self._serialize.url("account_id", account_id, 'str'), - 'session_id': self._serialize.url("session_id", session_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'CreateRenderingSessionSettings') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize('RenderingSession', pipeline_response) - - if response.status_code == 201: - response_headers['MS-CV']=self._deserialize('str', response.headers.get('MS-CV')) - deserialized = self._deserialize('RenderingSession', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - create_session.metadata = {'url': '/accounts/{account_id}/sessions/{session_id}'} # type: ignore - - def get_session( - self, - account_id, # type: str - session_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "models.RenderingSession" - """Gets the properties of a particular rendering session. - - Gets the properties of a particular rendering session. - - :param account_id: The Azure Remote Rendering account ID. - :type account_id: str - :param session_id: An ID uniquely identifying the rendering session for the given account. The - ID is case sensitive, can contain any combination of alphanumeric characters including hyphens - and underscores, and cannot contain more than 256 characters. - :type session_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RenderingSession, or the result of cls(response) - :rtype: ~azure.mixedreality.remoterendering._generated.models.RenderingSession - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.RenderingSession"] - error_map = { - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 500: lambda response: HttpResponseError(response=response, model=self._deserialize(models.ErrorResponse, response)), - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - - # Construct URL - url = self.get_session.metadata['url'] # type: ignore - path_format_arguments = { - 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - 'account_id': self._serialize.url("account_id", account_id, 'str'), - 'session_id': self._serialize.url("session_id", session_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = 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) - raise HttpResponseError(response=response) - - deserialized = self._deserialize('RenderingSession', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get_session.metadata = {'url': '/accounts/{account_id}/sessions/{session_id}'} # type: ignore - - def update_session( - self, - account_id, # type: str - session_id, # type: str - body, # type: "models.UpdateSessionSettings" - **kwargs # type: Any - ): - # type: (...) -> "models.RenderingSession" - """Updates the max lease time of a particular rendering session. - - Updates the max lease time of a particular rendering session. - - :param account_id: The Azure Remote Rendering account ID. - :type account_id: str - :param session_id: An ID uniquely identifying the rendering session for the given account. The - ID is case sensitive, can contain any combination of alphanumeric characters including hyphens - and underscores, and cannot contain more than 256 characters. - :type session_id: str - :param body: Settings used to update the session. - :type body: ~azure.mixedreality.remoterendering._generated.models.UpdateSessionSettings - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RenderingSession, or the result of cls(response) - :rtype: ~azure.mixedreality.remoterendering._generated.models.RenderingSession - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.RenderingSession"] - error_map = { - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 422: lambda response: HttpResponseError(response=response, model=self._deserialize(models.ErrorResponse, response)), - 500: lambda response: HttpResponseError(response=response, model=self._deserialize(models.ErrorResponse, response)), - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.update_session.metadata['url'] # type: ignore - path_format_arguments = { - 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - 'account_id': self._serialize.url("account_id", account_id, 'str'), - 'session_id': self._serialize.url("session_id", session_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'UpdateSessionSettings') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - - pipeline_response = 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) - raise HttpResponseError(response=response) - - deserialized = self._deserialize('RenderingSession', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - update_session.metadata = {'url': '/accounts/{account_id}/sessions/{session_id}'} # type: ignore - - def stop_session( - self, - account_id, # type: str - session_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - """Stops a particular rendering session. - - Stops a particular rendering session. - - :param account_id: The Azure Remote Rendering account ID. - :type account_id: str - :param session_id: An ID uniquely identifying the rendering session for the given account. The - ID is case sensitive, can contain any combination of alphanumeric characters including hyphens - and underscores, and cannot contain more than 256 characters. - :type session_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 500: lambda response: HttpResponseError(response=response, model=self._deserialize(models.ErrorResponse, response)), - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - - # Construct URL - url = self.stop_session.metadata['url'] # type: ignore - path_format_arguments = { - 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - 'account_id': self._serialize.url("account_id", account_id, 'str'), - 'session_id': self._serialize.url("session_id", session_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers['MS-CV']=self._deserialize('str', response.headers.get('MS-CV')) - - if cls: - return cls(pipeline_response, None, response_headers) - - stop_session.metadata = {'url': '/accounts/{account_id}/sessions/{session_id}/:stop'} # type: ignore - - def list_sessions( - self, - account_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.SessionsList"] - """Gets a list of all rendering sessions. - - Gets a list of all rendering sessions. - - :param account_id: The Azure Remote Rendering account ID. - :type account_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SessionsList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mixedreality.remoterendering._generated.models.SessionsList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SessionsList"] - error_map = { - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 500: lambda response: HttpResponseError(response=response, model=self._deserialize(models.ErrorResponse, response)), - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list_sessions.metadata['url'] # type: ignore - path_format_arguments = { - 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - 'account_id': self._serialize.url("account_id", account_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - path_format_arguments = { - 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - 'account_id': self._serialize.url("account_id", account_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('SessionsList', pipeline_response) - list_of_elem = deserialized.sessions - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = 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) - raise HttpResponseError(response=response) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_sessions.metadata = {'url': '/accounts/{account_id}/sessions'} # type: ignore diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/py.typed b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_generated/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_polling.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_polling.py deleted file mode 100644 index 505cef078c09..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_polling.py +++ /dev/null @@ -1,156 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- -import base64 -import time -from functools import partial -from typing import Any, Callable, Union - -from azure.core.polling import PollingMethod -from azure.core.exceptions import HttpResponseError, ODataV4Format - -from ._generated.models import (AssetConversion, AssetConversionStatus, - RenderingSession, RenderingSessionStatus) - -from ._generated import RemoteRenderingRestClient - - -class RemoteRenderingPolling(PollingMethod): - """ Abstract base class for polling. - """ - - def __init__(self, account_id: str, is_terminated: Callable, polling_interval: int=5) -> None: - self._account_id = account_id - self._response: Union[AssetConversion, RenderingSession, None] = None - self._client: Union[RemoteRenderingRestClient, None] = None - self._query_status = None - self._is_terminated = is_terminated - self._polling_interval = polling_interval - - def _update_status(self) -> None: - if self._query_status is None: - raise RuntimeError("this poller has not been initialized") - self._response = self._query_status() # pylint: disable=E1102 - if self._response.error is not None: # type: ignore - error = HttpResponseError("Polling returned a status indicating an error state.", model=self._response) - error.error = ODataV4Format(self._response.error.serialize()) # type: ignore - raise error - - def initialize(self, client: Any, initial_response: Any, deserialization_callback: Callable) -> None: - self._client = client - self._response = initial_response - - def run(self) -> None: - while not self.finished(): - self._update_status() - if not self.finished(): - time.sleep(self._polling_interval) - - def status(self) -> str: - raise NotImplementedError("This method needs to be implemented") - - def finished(self) -> bool: - if self._response is None: - return False - if self._response.status is None: - return False - return self._is_terminated(self._response.status) - - def resource(self) -> Union[AssetConversion, RenderingSession, None]: - if not self.finished(): - return None - return self._response - - def get_continuation_token(self) -> str: - # returns a Base64 encoded string of "::" - token_str = "1:"+self._account_id+":"+self._response.id # type: ignore - encoded = token_str.encode('ascii') - base64_endcoded = base64.b64encode(encoded) - return base64_endcoded.decode('ascii') - - -class ConversionPolling(RemoteRenderingPolling): - def __init__(self, account_id: str, polling_interval: int=5) -> None: - def is_terminated(status): - return status in [ - AssetConversionStatus.FAILED, - AssetConversionStatus.SUCCEEDED - ] - - super(ConversionPolling, self).__init__(account_id=account_id, - is_terminated=is_terminated, - polling_interval=polling_interval) - - def initialize(self, client: Any, initial_response: Any, deserialization_callback: Callable) -> None: - super(ConversionPolling, self).initialize(client=client, - initial_response=initial_response, - deserialization_callback=deserialization_callback) - self._query_status = partial( - self._client.remote_rendering.get_conversion, # type: ignore - account_id=self._account_id, - conversion_id=initial_response.id) # type: ignore - - def status(self) -> str: - if self._response is None: - return AssetConversionStatus.NOT_STARTED - return self._response.status - - @classmethod - def from_continuation_token(cls, continuation_token, client, **kwargs): # pylint: disable=W0221 - # type(str, RemoteRenderingRestClient, Any) -> Tuple - version, account_id, conversion_id = base64.b64decode( - continuation_token.encode('ascii')).decode('ascii').split(":") - - if version != "1": - raise ValueError("Cannot continue from continuation token from a different/newer client version.") - - initial_response = client.remote_rendering.get_conversion( - account_id=account_id, - conversion_id=conversion_id, - **kwargs) - - return client, initial_response, None - - -class SessionPolling(RemoteRenderingPolling): - def __init__(self, account_id: str, polling_interval: int=2) -> None: - def is_terminated(status): - return status in [ - RenderingSessionStatus.EXPIRED, - RenderingSessionStatus.ERROR, - RenderingSessionStatus.STOPPED, - RenderingSessionStatus.READY - ] - super(SessionPolling, self).__init__(account_id=account_id, - is_terminated=is_terminated, - polling_interval=polling_interval) - - def initialize(self, client: Any, initial_response: Any, deserialization_callback: Callable) -> None: - super(SessionPolling, self).initialize(client, initial_response, deserialization_callback) - self._query_status = partial( - self._client.remote_rendering.get_session, # type: ignore - account_id=self._account_id, - session_id=initial_response.id) # type: ignore - - def status(self) -> str: - if self._response is None: - return RenderingSessionStatus.STARTING - return self._response.status - - @classmethod - def from_continuation_token(cls, continuation_token, client, **kwargs): # pylint: disable=W0221 - # type(str, RemoteRenderingRestClient, Any) -> Tuple - version, account_id, session_id = base64.b64decode( - continuation_token.encode('ascii')).decode('ascii').split(":") - - if version != "1": - raise ValueError("Cannot continue from continuation token from a different/newer client version.") - - initial_response = client.remote_rendering.get_session( - account_id=account_id, - session_id=session_id, - **kwargs) - - return client, initial_response, None diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_remote_rendering_client.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_remote_rendering_client.py deleted file mode 100644 index 397e66a35ed8..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_remote_rendering_client.py +++ /dev/null @@ -1,375 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - - -from typing import Any, Callable, Union - -from azure.core.credentials import AccessToken, AzureKeyCredential -from azure.core.paging import ItemPaged -from azure.core.pipeline.policies import BearerTokenCredentialPolicy -from azure.core.polling import LROPoller -from azure.core.tracing.decorator import distributed_trace -from azure.core.credentials import TokenCredential - -from ._api_version import validate_api_version, DEFAULT_VERSION -from ._generated import RemoteRenderingRestClient - -from ._generated.models import (AssetConversion, AssetConversionInputSettings, - AssetConversionOutputSettings, - AssetConversionSettings, - CreateAssetConversionSettings, - CreateRenderingSessionSettings, - RenderingSession, RenderingSessionSize, - UpdateSessionSettings) -from ._polling import ConversionPolling, SessionPolling -from ._shared.authentication_endpoint import construct_endpoint_url -from ._shared.mixed_reality_token_credential import get_mixedreality_credential -from ._shared.mixedreality_account_key_credential import \ - MixedRealityAccountKeyCredential -from ._shared.static_access_token_credential import StaticAccessTokenCredential -from ._version import SDK_MONIKER - -class RemoteRenderingClient: - """A client for the Azure Remote Rendering Service. - - This client offers functionality to convert assets to the format expected by the runtime, and also to manage the - lifetime of remote rendering sessions. - - :param str endpoint: - The rendering service endpoint. This determines the region in which the rendering session is created and - asset conversions are performed. - :param str account_id: The Azure Remote Rendering account identifier. - :param str account_domain: - The Azure Remote Rendering account domain. For example, for an account created in the eastus region, this - will have the form "eastus.mixedreality.azure.com" - :param credential: Authentication for the Azure Remote - Rendering account. Can be of the form of an AzureKeyCredential, TokenCredential or an AccessToken acquired - from the Mixed Reality Secure Token Service (STS). - :type credential: Union[AzureKeyCredential, TokenCredential, AccessToken] - :keyword api_version: - The API version of the service to use for requests. It defaults to the latest service version. - Setting to an older version may result in reduced feature compatibility. - :type api_version: str or ~azure.mixedreality.remoterenderings.RemoteRenderingApiVersion - :keyword polling_interval: - Seconds to wait between each check, whether the session is ready yet. - :type polling_interval: int - :keyword authentication_endpoint_url: - Overwrite for the authentication endpoint. Usually using account_domain for the authentication domain is enough. - If used, specify the whole authentication url including the schema. - :type authentication_endpoint_url: str - """ - - def __init__(self, - endpoint: str, - account_id: str, - account_domain: str, - credential: Union[AzureKeyCredential, 'TokenCredential', AccessToken], - **kwargs) -> None: - - self._api_version = kwargs.pop( - "api_version", DEFAULT_VERSION - ) - validate_api_version(self._api_version) - - if not endpoint: - raise ValueError("endpoint cannot be None") - - if not account_id: - raise ValueError("account_id cannot be None") - - if not account_domain: - raise ValueError("account_domain cannot be None") - - if not credential: - raise ValueError("credential cannot be None") - - self.polling_interval = kwargs.pop("polling_interval", 5) - endpoint_url = kwargs.pop('authentication_endpoint_url', construct_endpoint_url(account_domain)) - - cred: Any - - if isinstance(credential, AccessToken): - cred = StaticAccessTokenCredential(credential) - elif isinstance(credential, AzureKeyCredential): - cred = MixedRealityAccountKeyCredential(account_id=account_id, account_key=credential) - else: - cred = credential - - pipeline_credential = get_mixedreality_credential( - account_id=account_id, - account_domain=account_domain, - credential=cred, - endpoint_url=endpoint_url) - - if pipeline_credential is None: - raise ValueError("credential is not of type TokenCredential, AzureKeyCredential or AccessToken") - - authentication_policy = BearerTokenCredentialPolicy( - pipeline_credential, endpoint_url + '/.default') - - self._account_id = account_id - - self._client = RemoteRenderingRestClient( - endpoint=endpoint, - authentication_policy=authentication_policy, - sdk_moniker=SDK_MONIKER, - api_version=self._api_version, - **kwargs) - - @distributed_trace - def begin_asset_conversion(self, - conversion_id: str, - input_settings: AssetConversionInputSettings, - output_settings: AssetConversionOutputSettings, - **kwargs) -> LROPoller[AssetConversion]: - """Start a new asset conversion with the given options. - - :param str conversion_id: - An ID uniquely identifying the conversion for the remote rendering account. The ID is case sensitive, can - contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain - more than 256 characters. - :param ~azure.mixedreality.remoterendering.AssetConversionInputSettings input_settings: Options for the - input of the conversion. - :param ~azure.mixedreality.remoterendering.AssetConversionOutputSettings output_settings: Options for the - output of the conversion. - :return: A poller for the created asset conversion - :rtype: ~azure.core.polling.LROPoller[AssetConversion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - polling_interval = kwargs.pop("polling_interval", self.polling_interval) - - initial_state = self._client.remote_rendering.create_conversion( - account_id=self._account_id, - conversion_id=conversion_id, - body=CreateAssetConversionSettings(settings=AssetConversionSettings( - input_settings=input_settings, output_settings=output_settings)), - **kwargs) - - polling_method = ConversionPolling(account_id=self._account_id, polling_interval=polling_interval) - deserialization_method: Callable[[Any], Any] = lambda _: None - - return LROPoller(client=self._client, - initial_response=initial_state, - deserialization_callback=deserialization_method, - polling_method=polling_method) - - @distributed_trace - def get_asset_conversion(self, conversion_id: str, **kwargs) -> AssetConversion: - """Retrieve the state of a previously created conversion. - - :param str conversion_id: - The identifier of the conversion to retrieve. - :return: Information about the ongoing conversion process. - :rtype: ~azure.mixedreality.remoterendering.models.AssetConversion - :raises ~azure.core.exceptions.HttpResponseError: - """ - return self._client.remote_rendering.get_conversion( - account_id=self._account_id, conversion_id=conversion_id, **kwargs) - - @distributed_trace - def get_asset_conversion_poller(self, **kwargs) -> LROPoller[AssetConversion]: # pylint:disable=docstring-keyword-should-match-keyword-only - """Returns a poller for an existing conversion by conversion id or a continuation - token retrieved from a previous poller. - - :keyword str conversion_id: The conversion_id of a previously created conversion. - :keyword str continuation_token: A continuation token retrieved from a poller of a conversion. - :return: A poller for the created asset conversion - :rtype: ~azure.core.polling.LROPoller[AssetConversion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - conversion_id: Union[str,None] = kwargs.pop("conversion_id", None) - continuation_token: Union[str,None] = kwargs.pop("continuation_token", None) - - if conversion_id is None and continuation_token is None: - raise ValueError( - "Either conversion_id or continuation_token needs to be supplied.") - - if conversion_id is not None and continuation_token is not None: - raise ValueError( - "Parameters conversion_id and continuation_token are mutual exclusive. Supply only one of the two.") - - polling_interval = kwargs.pop("polling_interval", self.polling_interval) - polling_method = ConversionPolling(account_id=self._account_id, polling_interval=polling_interval) - if continuation_token is not None: - return LROPoller.from_continuation_token(continuation_token=continuation_token, - polling_method=polling_method, - client=self._client) - - if conversion_id is not None: - initial_state = self._client.remote_rendering.get_conversion( - account_id=self._account_id, - conversion_id=conversion_id, - **kwargs) - - deserialization_method: Callable[[Any], Any] = lambda _: None - - return LROPoller(client=self._client, - initial_response=initial_state, - deserialization_callback=deserialization_method, - polling_method=polling_method) - - @distributed_trace - def list_asset_conversions(self, **kwargs) -> ItemPaged[AssetConversion]: - """Returns list of conversions for the remote rendering account. - - :rtype: ItemPaged[AssetConversion] - :raises ~azure.core.exceptions.HttpResponseError: - :return: List of conversion for the remote rendering account. - """ - return self._client.remote_rendering.list_conversions(account_id=self._account_id, **kwargs) # type: ignore - - @distributed_trace - def begin_rendering_session(self, - session_id: str, - size: Union[str, RenderingSessionSize], - lease_time_minutes: int, - **kwargs) -> LROPoller[RenderingSession]: - """ - - :param str session_id: An ID uniquely identifying the rendering session for the given account. The ID is case - sensitive, can contain any combination of alphanumeric characters including hyphens and underscores, and - cannot contain more than 256 characters. - :param size: Size of the server used for the rendering session. Remote Rendering with Standard size server has - a maximum scene size of 20 million polygons. Remote Rendering with Premium size does not enforce a hard - maximum, but performance may be degraded if your content exceeds the rendering capabilities of the service. - :param int lease_time_minutes: The time in minutes the session will run after reaching the 'Ready' state. - :type size: str or ~azure.mixedreality.remoterendering.RenderingSessionSize - :return: A poller for the created rendering session - :rtype: LROPoller[RenderingSession] - :raises ~azure.core.exceptions.HttpResponseError: - """ - settings = CreateRenderingSessionSettings( - size=size, lease_time_minutes=lease_time_minutes) - initial_state = self._client.remote_rendering.create_session( - account_id=self._account_id, - session_id=session_id, - body=settings, - **kwargs) - polling_interval = kwargs.pop("polling_interval", self.polling_interval) - polling_method = SessionPolling(account_id=self._account_id, polling_interval=polling_interval) - deserialization_method: Callable[[Any], Any] = lambda _: None - return LROPoller(client=self._client, - initial_response=initial_state, - deserialization_callback=deserialization_method, - polling_method=polling_method) - - @distributed_trace - def get_rendering_session(self, session_id: str, **kwargs) -> RenderingSession: - '''Returns the properties of a previously generated rendering session. - - :param str session_id: The identifier of the rendering session. - :return: Properties of the rendering session - :rtype: ~azure.mixedreality.remoterendering.models.RenderingSession - :raises ~azure.core.exceptions.HttpResponseError: - ''' - return self._client.remote_rendering.get_session( - account_id=self._account_id, - session_id=session_id, - **kwargs) - - @distributed_trace - def get_rendering_session_poller(self, **kwargs) -> LROPoller[RenderingSession]: # pylint:disable=docstring-keyword-should-match-keyword-only - """Returns a poller for an existing rendering session by session id or a continuation token retrieved from a - previous poller. - - :keyword str session_id: The conversion id of a previously created conversion. - :keyword str continuation_token: A continuation token retrieved from a poller of a session. - :return: A session poller for the given session - :rtype: LROPoller[RenderingSession] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - session_id: Union[str,None] = kwargs.pop("session_id", None) - continuation_token: Union[str,None] = kwargs.pop("continuation_token", None) - - if session_id is None and continuation_token is None: - raise ValueError( - "Either session_id or continuation_token needs to be supplied.") - - if session_id is not None and continuation_token is not None: - raise ValueError( - "Parameters session_id and continuation_token are mutual exclusive. Supply only one of the two.") - - polling_interval = kwargs.pop("polling_interval", self.polling_interval) - if continuation_token is not None: - polling_method = SessionPolling(account_id=self._account_id, polling_interval=polling_interval) - return LROPoller.from_continuation_token(continuation_token=continuation_token, - polling_method=polling_method, - client=self._client) - - if session_id is not None: - initial_state = self._client.remote_rendering.get_session( - account_id=self._account_id, - session_id=session_id, - **kwargs) - - polling_method = SessionPolling(account_id=self._account_id, polling_interval=polling_interval) - deserialization_method: Callable[[Any], Any] = lambda _: None - return LROPoller(client=self._client, - initial_response=initial_state, - deserialization_callback=deserialization_method, - polling_method=polling_method) - - @distributed_trace - def stop_rendering_session(self, session_id: str, **kwargs) -> None: - """ - - :param str session_id: The identifier of the session to be stopped. - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - self._client.remote_rendering.stop_session( - account_id=self._account_id, session_id=session_id, **kwargs) - - @distributed_trace - def update_rendering_session(self, session_id: str, **kwargs) -> RenderingSession: # pylint:disable=docstring-keyword-should-match-keyword-only - """Updates an already existing rendering session. - - :param str session_id: The identifier of the session to be updated. - :keyword int lease_time_minutes: The new lease time of the rendering session. Has to be strictly larger than - the previous lease time. - :return: The properties of the updated session - :rtype: ~azure.mixedreality.remoterendering.models.RenderingSession - :raises ~azure.core.exceptions.HttpResponseError: - """ - - lease_time_minutes: Union[int,None] = kwargs.pop("lease_time_minutes", None) - if lease_time_minutes is not None: - return self._client.remote_rendering.update_session(account_id=self._account_id, - session_id=session_id, - body=UpdateSessionSettings( - lease_time_minutes=lease_time_minutes), - **kwargs) - - # if no param to update has been provided the unchanged session is returned - return self._client.remote_rendering.get_session(account_id=self._account_id, - session_id=session_id, - **kwargs) - - @distributed_trace - def list_rendering_sessions(self, **kwargs) -> ItemPaged[RenderingSession]: - """Returns list of rendering sessions in the 'Ready' or 'Starting' state. - - Does not return stopped or failed rendering sessions. - :rtype: ItemPaged[RenderingSession] - :raises ~azure.core.exceptions.HttpResponseError: - :return: List of rendering sessions in the 'Ready' or 'Starting' state. - """ - return self._client.remote_rendering.list_sessions(account_id=self._account_id, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> "RemoteRenderingClient": - self._client.__enter__() # pylint:disable=no-member - return self - - def __exit__(self, *args: Any) -> None: - self._client.__exit__(*args) # pylint:disable=no-member diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_shared/INFO.md b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_shared/INFO.md deleted file mode 100644 index 738dabd25ef8..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_shared/INFO.md +++ /dev/null @@ -1 +0,0 @@ -This is utility code from sdk\mixedreality\azure-mixedreality-authentication\azure\mixedreality\authentication\_shared copied in here to prevent exposing internal details \ No newline at end of file diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_shared/__init__.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_shared/__init__.py deleted file mode 100644 index 5b396cd202e8..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_shared/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_shared/aio/__init__.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_shared/aio/__init__.py deleted file mode 100644 index 5b396cd202e8..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_shared/aio/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_shared/aio/mixed_reality_token_credential.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_shared/aio/mixed_reality_token_credential.py deleted file mode 100644 index 3bf340e7caad..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_shared/aio/mixed_reality_token_credential.py +++ /dev/null @@ -1,66 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -from typing import Any - -from azure.core.credentials import AccessToken -from azure.core.credentials_async import AsyncTokenCredential -from azure.mixedreality.authentication.aio import MixedRealityStsClient - -from .static_access_token_credential import StaticAccessTokenCredential - -def get_mixedreality_credential( - account_id: str, - account_domain: str, - endpoint_url: str, - credential: AsyncTokenCredential, - **kwargs): - if isinstance(credential, StaticAccessTokenCredential): - return credential - - return MixedRealityTokenCredential( - account_id=account_id, - account_domain=account_domain, - endpoint_url=endpoint_url, - credential=credential, - **kwargs) - - -class MixedRealityTokenCredential(object): - """ Represents a token credential that can be used to access a Mixed Reality service. - This implements the TokenCredential protocol. - - :param str account_id: The Mixed Reality service account identifier. - :param str endpoint_url: The Mixed Reality STS service endpoint. - :param TokenCredential credential: The credential used to access the Mixed Reality service. - """ - - def __init__( - self, - account_id: str, - account_domain: str, - endpoint_url: str, - credential: AsyncTokenCredential, - **kwargs): - self.stsClient = MixedRealityStsClient( - account_id=account_id, - account_domain=account_domain, - custom_endpoint_url=endpoint_url, - credential=credential, - **kwargs) - - async def get_token(self, *scopes: str, **kwargs: Any) -> AccessToken: # pylint: disable=unused-argument - return await self.stsClient.get_token(**kwargs) - - async def close(self) -> None: - await self.stsClient.close() - - async def __aenter__(self): - await self.stsClient.__aenter__() - return self - - async def __aexit__(self, exc_type, exc_value, traceback) -> None: - await self.stsClient.__aexit__() diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_shared/aio/mixedreality_account_key_credential.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_shared/aio/mixedreality_account_key_credential.py deleted file mode 100644 index 21ab82a61b14..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_shared/aio/mixedreality_account_key_credential.py +++ /dev/null @@ -1,51 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -from typing import Any -from datetime import date, datetime - -from azure.core.credentials import AzureKeyCredential, AccessToken - - -ACCOUNT_KEY_VALID_YEARS = 10 - - -class MixedRealityAccountKeyCredential(object): - """ Represents an object used for Mixed Reality account key authentication. - - :param str account_id: The Mixed Reality service account identifier. - :param AzureKeyCredential account_key: The Mixed Reality service account primary or secondary key credential. - """ - - def __init__(self, account_id: str, account_key: AzureKeyCredential) -> None: - self.account_id = account_id - self.account_key = account_key - - async def get_token(self, *scopes: str, **kwargs: Any) -> AccessToken: # pylint: disable=unused-argument - token = self.account_id + ":" + self.account_key.key - - # No way to know when an account key might expire, so we'll set the - # access token wrapping it to expire 10 years in the future. - expiration_date = _add_years(datetime.now(), ACCOUNT_KEY_VALID_YEARS) - expiration_timestamp = int(expiration_date.timestamp()) - - return AccessToken(token, expiration_timestamp) - - async def close(self) -> None: - pass - - async def __aenter__(self): - pass - - async def __aexit__(self, exc_type, exc_value, traceback) -> None: - pass - - -def _add_years(date_to_update, years): - try: - return date_to_update.replace(year=date_to_update.year + years) - except ValueError: - return date_to_update + (date(date_to_update.year + years, 1, 1) - date(date_to_update.year, 1, 1)) diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_shared/aio/static_access_token_credential.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_shared/aio/static_access_token_credential.py deleted file mode 100644 index 90de97090959..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_shared/aio/static_access_token_credential.py +++ /dev/null @@ -1,34 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -from typing import Any -from azure.core.credentials import AccessToken - -class StaticAccessTokenCredential(object): - """ Represents a static access token credential. - This implements the AsyncTokenCredential protocol. - - :param AccessToken access_token: An access token. - """ - - def __init__(self, access_token: AccessToken): - self._access_token = access_token - - async def get_token( - self, - #pylint: disable=unused-argument - *scopes: str, - **kwargs: Any) -> AccessToken: - return self._access_token - - async def close(self) -> None: - pass - - async def __aenter__(self): - pass - - async def __aexit__(self, exc_type, exc_value, traceback) -> None: - pass diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_shared/authentication_endpoint.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_shared/authentication_endpoint.py deleted file mode 100644 index e9374595a680..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_shared/authentication_endpoint.py +++ /dev/null @@ -1,8 +0,0 @@ -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -def construct_endpoint_url(account_domain: str) -> str: - return 'https://sts.' + account_domain diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_shared/mixed_reality_token_credential.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_shared/mixed_reality_token_credential.py deleted file mode 100644 index 45ea040ea3f6..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_shared/mixed_reality_token_credential.py +++ /dev/null @@ -1,50 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -from azure.core.credentials import AccessToken, TokenCredential - -from azure.mixedreality.authentication import MixedRealityStsClient -from .static_access_token_credential import StaticAccessTokenCredential - -def get_mixedreality_credential(account_id: str, - account_domain: str, - endpoint_url: str, - credential: TokenCredential, - **kwargs) -> TokenCredential: - if isinstance(credential, StaticAccessTokenCredential): - return credential - - return MixedRealityTokenCredential( - account_id=account_id, - account_domain=account_domain, - endpoint_url=endpoint_url, - credential=credential, - **kwargs) - - -class MixedRealityTokenCredential(object): - """ Represents a token credential that can be used to access a Mixed Reality service. - This implements the TokenCredential protocol. - - :param str account_id: The Mixed Reality service account identifier. - :param str endpoint_url: The Mixed Reality STS service endpoint. - :param TokenCredential credential: The credential used to access the Mixed Reality service. - """ - - def __init__(self, account_id: str, - account_domain: str, - endpoint_url: str, - credential: TokenCredential, - **kwargs) -> None: - self.stsClient = MixedRealityStsClient( - account_id=account_id, - account_domain=account_domain, - custom_endpoint_url=endpoint_url, - credential=credential, - **kwargs) - - def get_token(self, *scopes: str, **kwargs) -> AccessToken: # pylint: disable=unused-argument - return self.stsClient.get_token(**kwargs) diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_shared/mixedreality_account_key_credential.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_shared/mixedreality_account_key_credential.py deleted file mode 100644 index 99db94cccfd9..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_shared/mixedreality_account_key_credential.py +++ /dev/null @@ -1,38 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- -from datetime import date, datetime -import time - -from azure.core.credentials import AzureKeyCredential, AccessToken - -ACCOUNT_KEY_VALID_YEARS = 10 - -class MixedRealityAccountKeyCredential(object): - """ Represents an object used for Mixed Reality account key authentication. - - :param str account_id: The Mixed Reality service account identifier. - :param AzureKeyCredential account_key: The Mixed Reality service account primary or secondary key credential. - """ - - def __init__(self, account_id: str, account_key: AzureKeyCredential) -> None: - self.account_id = account_id - self.account_key = account_key - - def get_token(self, *scopes: str, **kwargs) -> AccessToken: #pylint: disable=unused-argument - token = self.account_id + ":" + self.account_key.key - - # No way to know when an account key might expire, so we'll set the - # access token wrapping it to expire 10 years in the future. - expiration_date = _add_years(datetime.now(), ACCOUNT_KEY_VALID_YEARS) - expiration_timestamp = int(time.mktime(expiration_date.timetuple())) - - return AccessToken(token, expiration_timestamp) - -def _add_years(date_to_update, years): - try: - return date_to_update.replace(year=date_to_update.year + years) - except ValueError: - return date_to_update + (date(date_to_update.year + years, 1, 1) - date(date_to_update.year, 1, 1)) diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_shared/static_access_token_credential.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_shared/static_access_token_credential.py deleted file mode 100644 index 995f124e53a7..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_shared/static_access_token_credential.py +++ /dev/null @@ -1,19 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- -from azure.core.credentials import AccessToken - -class StaticAccessTokenCredential(object): - """ Represents a static access token credential. - This implements the TokenCredential protocol. - - :param AccessToken access_token: An access token. - """ - - def __init__(self, access_token: AccessToken) -> None: - self._access_token = access_token - - def get_token(self, *scopes: str, **kwargs) -> AccessToken: #pylint: disable=unused-argument - return self._access_token diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_version.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_version.py deleted file mode 100644 index 1cab739bea78..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_version.py +++ /dev/null @@ -1,10 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -# matches SEMVER -VERSION = "1.0.0b3" - -SDK_MONIKER = "mixedreality-remoterendering/{}".format(VERSION) # type: str diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/aio/__init__.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/aio/__init__.py deleted file mode 100644 index 1f5e515d93c8..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/aio/__init__.py +++ /dev/null @@ -1,11 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -from ._remote_rendering_client_async import RemoteRenderingClient - -__all__ = [ - 'RemoteRenderingClient' -] diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/aio/_polling_async.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/aio/_polling_async.py deleted file mode 100644 index 76d3685ed82b..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/aio/_polling_async.py +++ /dev/null @@ -1,165 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- -import asyncio -import base64 -from functools import partial -from typing import Any, Callable, Union - -from azure.core.polling import AsyncPollingMethod -from azure.core.exceptions import HttpResponseError, ODataV4Format - -from .._generated.aio import RemoteRenderingRestClient -from .._generated.models import (AssetConversion, - AssetConversionStatus, - RenderingSession, - RenderingSessionStatus) - -class RemoteRenderingPollingAsync(AsyncPollingMethod): - """ABC class for remote rendering operations. - """ - - def __init__(self, account_id: str, is_terminated: Callable, polling_interval: int=5) -> None: - self._account_id = account_id - self._response: Union[AssetConversion, RenderingSession, None] = None - self._client: Union[RemoteRenderingRestClient, None] = None - self._query_status: Union[partial, None] = None - self._is_terminated = is_terminated - self._polling_interval = polling_interval - - async def _update_status(self) -> None: - if self._query_status is None: - raise RuntimeError("this poller has not been initialized") - self._response = await self._query_status() # pylint: disable=E1102 - if self._response is not None and self._response.error is not None: - error = HttpResponseError("Polling returned a status indicating an error state.", model=self._response) - error.error = ODataV4Format(self._response.error.serialize()) - raise error - - def initialize(self, client: Any, initial_response: Any, deserialization_callback: Callable) -> None: - self._client = client - self._response = initial_response - - async def run(self) -> None: - while not self.finished(): - await self._update_status() - if not self.finished(): - await asyncio.sleep(self._polling_interval) - - def status(self) -> str: - raise NotImplementedError("This method needs to be implemented in a derived class.") - - def finished(self) -> bool: - if self._response is None: - return False - if self._response.status is None: - return False - return self._is_terminated(self._response.status) - - def resource(self) -> Union[AssetConversion, RenderingSession, None]: - if not self.finished(): - return None - return self._response - - def get_continuation_token(self) -> str: - # returns a Base64 encoded string of "::" - token_str = "1:"+self._account_id+":"+self._response.id # type: ignore - encoded = token_str.encode('ascii') - base64_endcoded = base64.b64encode(encoded) - return base64_endcoded.decode('ascii') - - -class ConversionPollingAsync(RemoteRenderingPollingAsync): - def __init__(self, account_id: str, polling_interval: int=5) -> None: - def is_terminated(status): - return status in [ - AssetConversionStatus.FAILED, - AssetConversionStatus.SUCCEEDED - ] - super(ConversionPollingAsync, self).__init__(account_id=account_id, - is_terminated=is_terminated, - polling_interval=polling_interval) - - def initialize(self, - client: RemoteRenderingRestClient, - initial_response: AssetConversion, - deserialization_callback: Callable) -> None: - super().initialize(client, initial_response, deserialization_callback) - if self._client is not None: - self._query_status = partial( - self._client.remote_rendering.get_conversion, - account_id=self._account_id, - conversion_id=initial_response.id) - - def status(self) -> str: - if self._response is None: - return AssetConversionStatus.NOT_STARTED - return self._response.status - - @classmethod - async def initial_response_from_continuation_token(cls, - continuation_token: str, - client: RemoteRenderingRestClient, - **kwargs) -> AssetConversion: - - version, account_id, conversion_id = base64.b64decode( - continuation_token.encode('ascii')).decode('ascii').split(":") - - if version != "1": - raise ValueError("Cannot continue from continuation token from a different/newer client version.") - - initial_response = await client.remote_rendering.get_conversion( - account_id=account_id, - conversion_id=conversion_id, - **kwargs) - - return initial_response - - -class SessionPollingAsync(RemoteRenderingPollingAsync): - def __init__(self, account_id: str, polling_interval: int=2) -> None: - def is_terminated(status): - return status in [ - RenderingSessionStatus.EXPIRED, - RenderingSessionStatus.ERROR, - RenderingSessionStatus.STOPPED, - RenderingSessionStatus.READY - ] - super(SessionPollingAsync, self).__init__(account_id=account_id, - is_terminated=is_terminated, - polling_interval=polling_interval) - - def initialize(self, - client: RemoteRenderingRestClient, - initial_response: RenderingSession, - deserialization_callback: Callable) -> None: - super().initialize(client, initial_response, deserialization_callback) - if self._client is not None: - self._query_status = partial( - self._client.remote_rendering.get_session, account_id=self._account_id, session_id=initial_response.id) - - def status(self) -> str: - if self._response is None: - return RenderingSessionStatus.STARTING - return self._response.status - - @classmethod - async def initial_response_from_continuation_token(cls, - continuation_token: str, - client: RemoteRenderingRestClient, - **kwargs) -> RenderingSession: - - version, account_id, session_id = base64.b64decode( - continuation_token.encode('ascii')).decode('ascii').split(":") - - if version != "1": - raise ValueError("Cannot continue from continuation token from a different/newer client version.") - - initial_response = await client.remote_rendering.get_session( - account_id=account_id, - session_id=session_id, - **kwargs) - - return initial_response diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/aio/_remote_rendering_client_async.py b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/aio/_remote_rendering_client_async.py deleted file mode 100644 index fb271850caf0..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/aio/_remote_rendering_client_async.py +++ /dev/null @@ -1,367 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - - -from typing import Any, Callable, Union - -from azure.core.async_paging import AsyncItemPaged -from azure.core.credentials import AccessToken, AzureKeyCredential -from azure.core.pipeline.policies import AsyncBearerTokenCredentialPolicy -from azure.core.polling import AsyncLROPoller -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.credentials_async import AsyncTokenCredential - -from .._api_version import validate_api_version, DEFAULT_VERSION -from .._generated.aio import RemoteRenderingRestClient -from .._generated.models import (AssetConversion, AssetConversionInputSettings, - AssetConversionOutputSettings, - AssetConversionSettings, - CreateAssetConversionSettings, - CreateRenderingSessionSettings, - RenderingSession, RenderingSessionSize, - UpdateSessionSettings) -from .._shared.aio.mixed_reality_token_credential import \ - get_mixedreality_credential -from .._shared.aio.mixedreality_account_key_credential import \ - MixedRealityAccountKeyCredential -from .._shared.aio.static_access_token_credential import \ - StaticAccessTokenCredential -from .._shared.authentication_endpoint import construct_endpoint_url -from .._version import SDK_MONIKER -from ._polling_async import ConversionPollingAsync, SessionPollingAsync - -class RemoteRenderingClient(object): - """A client for the Azure Remote Rendering Service. - - This client offers functionality to convert assets to the format expected by the runtime, and also to manage the - lifetime of remote rendering sessions. - - :param endpoint: - The rendering service endpoint. This determines the region in which the rendering session is created and - asset conversions are performed. - :type endpoint: str - :param account_id: The Azure Remote Rendering account identifier. - :type account_id: str - :param account_domain: - The Azure Remote Rendering account domain. For example, for an account created in the eastus region, this - will have the form "eastus.mixedreality.azure.com" - :type account_domain: str - :param credential: Authentication for the Azure Remote - Rendering account. Can be of the form of an AzureKeyCredential, AsyncTokenCredential or an AccessToken acquired - from the Mixed Reality Secure Token Service (STS). - :type credential: Union[AzureKeyCredential, AsyncTokenCredential, AccessToken] - :keyword api_version: - The API version of the service to use for requests. It defaults to the latest service version. - Setting to an older version may result in reduced feature compatibility. - :type api_version: str or ~azure.mixedreality.remoterenderings.RemoteRenderingApiVersion - :keyword polling_interval: - Seconds to wait between each check, whether the session is ready yet. - :type polling_interval: int - :keyword authentication_endpoint_url: - Overwrite for the authentication endpoint. Usually using account_domain for the authentication domain is enough. - If used, specify the whole authentication url including the schema. - :type authentication_endpoint_url: str - """ - - def __init__(self, - endpoint: str, - account_id: str, - account_domain: str, - credential: Union[AzureKeyCredential, 'AsyncTokenCredential', AccessToken], - **kwargs) -> None: - - self._api_version = kwargs.pop( - "api_version", DEFAULT_VERSION - ) - validate_api_version(self._api_version) - - if not endpoint: - raise ValueError("endpoint cannot be None") - - if not account_id: - raise ValueError("account_id cannot be None") - - if not account_domain: - raise ValueError("account_domain cannot be None") - - if not credential: - raise ValueError("credential cannot be None") - - self.polling_interval = kwargs.pop("polling_interval", 5) - endpoint_url = kwargs.pop('authentication_endpoint_url', construct_endpoint_url(account_domain)) - - cred: Any - - if isinstance(credential, AccessToken): - cred = StaticAccessTokenCredential(credential) - elif isinstance(credential, AzureKeyCredential): - cred = MixedRealityAccountKeyCredential(account_id=account_id, account_key=credential) - else: - cred = credential - - pipeline_credential = get_mixedreality_credential( - account_id=account_id, - account_domain=account_domain, - credential=cred, - endpoint_url=endpoint_url) - - if pipeline_credential is None: - raise ValueError("credential is not of type TokenCredential, AzureKeyCredential or AccessToken") - - authentication_policy = AsyncBearerTokenCredentialPolicy( - pipeline_credential, endpoint_url + '/.default') - - self._account_id = account_id - - self._client = RemoteRenderingRestClient( - endpoint=endpoint, - authentication_policy=authentication_policy, - sdk_moniker=SDK_MONIKER, - api_version=self._api_version, - **kwargs) - - @distributed_trace_async - async def begin_asset_conversion(self, - conversion_id: str, - input_settings: AssetConversionInputSettings, - output_settings: AssetConversionOutputSettings, - **kwargs) -> AsyncLROPoller[AssetConversion]: - """Start a new asset conversion with the given options. - - :param str conversion_id: - An ID uniquely identifying the conversion for the remote rendering account. The ID is case sensitive, can - contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain - more than 256 characters. - :param ~azure.mixedreality.remoterendering.AssetConversionInputSettings input_settings: Options for the - input of the conversion. - :param ~azure.mixedreality.remoterendering.AssetConversionOutputSettings output_settings: Options for the - output of the conversion. - :return: A poller for the created asset conversion - :rtype: ~azure.core.polling.AsyncLROPoller[AssetConversion] - """ - polling_interval = kwargs.pop("polling_interval", self.polling_interval) - polling_method = ConversionPollingAsync(account_id=self._account_id, polling_interval=polling_interval) - settings = AssetConversionSettings(input_settings=input_settings, output_settings=output_settings) - initial_state = await self._client.remote_rendering.create_conversion(account_id=self._account_id, - conversion_id=conversion_id, - body=CreateAssetConversionSettings( - settings=settings), - **kwargs) - deserialization_method: Callable[[Any], Any] = lambda _: None - - return AsyncLROPoller(client=self._client, - initial_response=initial_state, - deserialization_callback=deserialization_method, - polling_method=polling_method) - - @distributed_trace_async - async def get_asset_conversion(self, conversion_id: str, **kwargs) -> AssetConversion: - """Retrieve the state of a previously created conversion. - - :param str conversion_id: - The identifier of the conversion to retrieve. - :return: Information about the ongoing conversion process. - :rtype: ~azure.mixedreality.remoterendering.AssetConversion - """ - return await self._client.remote_rendering.get_conversion(account_id=self._account_id, - conversion_id=conversion_id, - **kwargs) - - @distributed_trace_async - async def get_asset_conversion_poller(self, **kwargs) -> AsyncLROPoller[AssetConversion]: # pylint:disable=docstring-keyword-should-match-keyword-only - """Returns a poller for an existing conversion by conversion id or a continuation - token retrieved from a previous poller. - - :keyword str conversion_id: The conversion id of a previously created conversion. - :keyword str continuation_token: A continuation token retrieved from a poller of a conversion. - :return: A poller for the created asset conversion - :rtype: ~azure.core.polling.AsyncLROPoller[AssetConversion] - """ - - conversion_id: Union[str,None] = kwargs.pop("conversion_id", None) - continuation_token: Union[str,None] = kwargs.pop("continuation_token", None) - - if conversion_id is None and continuation_token is None: - raise ValueError( - "Either conversion_id or continuation_token needs to be supplied.") - - if conversion_id is not None and continuation_token is not None: - raise ValueError( - "Parameters conversion_id and continuation_token are mutual exclusive. Supply only one of the two.") - polling_interval = kwargs.pop("polling_interval", self.polling_interval) - polling_method = ConversionPollingAsync(account_id=self._account_id, polling_interval=polling_interval) - if continuation_token is not None: - initial_state = await ConversionPollingAsync.initial_response_from_continuation_token( - continuation_token, - client=self._client, - **kwargs) - - if conversion_id is not None: - initial_state = await self._client.remote_rendering.get_conversion( - account_id=self._account_id, - conversion_id=conversion_id, - **kwargs) - - deserialization_method: Callable[[Any], Any] = lambda _: None - - return AsyncLROPoller(client=self._client, - initial_response=initial_state, - deserialization_callback=deserialization_method, - polling_method=polling_method) - - @distributed_trace_async - async def list_asset_conversions(self, **kwargs) -> AsyncItemPaged[AssetConversion]: - """Returns list of conversions for the remote rendering account. - - :rtype: AsyncItemPaged[AssetConversion] - :return: List of conversions for the remote rendering account. - """ - return self._client.remote_rendering.list_conversions(account_id=self._account_id, **kwargs) # type: ignore - - @distributed_trace_async - async def begin_rendering_session(self, - session_id: str, - size: Union[str, RenderingSessionSize], - lease_time_minutes: int, - **kwargs) -> AsyncLROPoller[RenderingSession]: - """ - - :param session_id: An ID uniquely identifying the rendering session for the given account. The ID is case - sensitive, can contain any combination of alphanumeric characters including hyphens and underscores, and - cannot contain more than 256 characters. - :type session_id: str - :param size: Size of the server used for the rendering session. Remote Rendering with Standard size server has - a maximum scene size of 20 million polygons. Remote Rendering with Premium size does not enforce a hard - maximum, but performance may be degraded if your content exceeds the rendering capabilities of the service. - :type size: str or ~azure.mixedreality.remoterendering.RenderingSessionSize - :param lease_time_minutes: The time in minutes the session will run after reaching the 'Ready' state. - :type lease_time_minutes: int - :return: A poller for the created rendering session - :rtype: AsyncLROPoller[RenderingSession] - """ - polling_interval = kwargs.pop("polling_interval", self.polling_interval) - polling_method = SessionPollingAsync(account_id=self._account_id, polling_interval=polling_interval) - settings = CreateRenderingSessionSettings( - size=size, lease_time_minutes=lease_time_minutes) - initial_state = await self._client.remote_rendering.create_session(account_id=self._account_id, - session_id=session_id, - body=settings, - **kwargs) - - deserialization_method: Callable[[Any], Any] = lambda _: None - - return AsyncLROPoller(client=self._client, - initial_response=initial_state, - deserialization_callback=deserialization_method, - polling_method=polling_method) - - @distributed_trace_async - async def get_rendering_session(self, session_id: str, **kwargs) -> RenderingSession: - '''Returns the properties of a previously generated rendering session. - - :param str session_id: The identifier of the rendering session. - :return: Properties of the rendering session - :rtype: ~azure.mixedreality.remoterendering.RenderingSession - ''' - return await self._client.remote_rendering.get_session(self._account_id, session_id=session_id, **kwargs) - - @distributed_trace_async - async def get_rendering_session_poller(self, **kwargs) -> AsyncLROPoller[RenderingSession]: # pylint:disable=docstring-keyword-should-match-keyword-only - """Returns a poller for an existing rendering session by session id or a continuation token retrieved from a - previous poller. - - :keyword str session_id: The conversion id of a previously created conversion. - :keyword str continuation_token: A continuation token retrieved from a poller of a session. - :return: A poller for the created rendering session - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mixedreality.remoterendering.RenderingSession] - """ - - session_id: Union[str,None] = kwargs.pop("session_id", None) - continuation_token: Union[str,None] = kwargs.pop("continuation_token", None) - - if session_id is None and continuation_token is None: - raise ValueError( - "Either session_id or continuation_token needs to be supplied.") - - if session_id is not None and continuation_token is not None: - raise ValueError( - "Parameters session_id and continuation_token are mutual exclusive. Supply only one of the two.") - polling_interval = kwargs.pop("polling_interval", self.polling_interval) - polling_method = SessionPollingAsync(account_id=self._account_id, polling_interval=polling_interval) - if continuation_token is not None: - initial_state = await SessionPollingAsync.initial_response_from_continuation_token( - continuation_token=continuation_token, - client=self._client, **kwargs) - - if session_id is not None: - initial_state = await self._client.remote_rendering.get_session( - account_id=self._account_id, - session_id=session_id, - **kwargs) - - deserialization_method: Callable[[Any], Any] = lambda _: None - - return AsyncLROPoller(client=self._client, - initial_response=initial_state, - deserialization_callback=deserialization_method, - polling_method=polling_method) - - @distributed_trace_async - async def update_rendering_session(self, session_id: str, **kwargs) -> RenderingSession: # pylint:disable=docstring-keyword-should-match-keyword-only - """Updates an already existing rendering session. - - :param str session_id: The identifier of the session to be updated. - :keyword int lease_time_minutes: The new lease time of the rendering session. Has to be strictly larger than - the previous lease time. - :return: The updated rendering session - :rtype: ~azure.mixedreality.remoterendering.models.RenderingSession - :raises ~azure.core.exceptions.HttpResponseError: - """ - lease_time_minutes: Union[int,None] = kwargs.pop("lease_time_minutes", None) - if lease_time_minutes is not None: - return await self._client.remote_rendering.update_session(account_id=self._account_id, - session_id=session_id, - body=UpdateSessionSettings( - lease_time_minutes=lease_time_minutes), - **kwargs) - - # if no param to update has been provided the unchanged session is returned - return await self._client.remote_rendering.get_session(self._account_id, session_id=session_id, **kwargs) - - @distributed_trace_async - async def stop_rendering_session(self, session_id: str, **kwargs) -> None: - """ - - :param str session_id: The identifier of the session to be stopped. - :return: None - :rtype: None - """ - return await self._client.remote_rendering.stop_session(account_id=self._account_id, - session_id=session_id, - **kwargs) - - @distributed_trace_async - async def list_rendering_sessions( - self, - **kwargs) -> AsyncItemPaged[RenderingSession]: - """Returns list of rendering sessions in the 'Ready' or 'Starting' state. - Does not return stopped or failed rendering sessions. - - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mixedreality.remoterendering.RenderingSession] - :return: List of rendering sessions in the 'Ready' or 'Starting' state. - """ - return self._client.remote_rendering.list_sessions(account_id=self._account_id, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "RemoteRenderingClient": - await self._client.__aenter__() - return self - - async def __aexit__(self, *args) -> None: - await self._client.__aexit__(*args) diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/py.typed b/sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/py.typed deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/dev_requirements.txt b/sdk/remoterendering/azure-mixedreality-remoterendering/dev_requirements.txt deleted file mode 100644 index 078b40b46c40..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/dev_requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ --e ../../../eng/tools/azure-sdk-tools -../../core/azure-core -../../mixedreality/azure-mixedreality-authentication -aiohttp>=3.0 -../../identity/azure-identity -configargparse diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/mypy.ini b/sdk/remoterendering/azure-mixedreality-remoterendering/mypy.ini deleted file mode 100644 index c6eb4da3eaa3..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/mypy.ini +++ /dev/null @@ -1,12 +0,0 @@ -[mypy] -python_version = 3.10 -warn_unused_configs = True -ignore_missing_imports = True - -# Per-module options: - -[mypy-azure.mixedreality.remoterendering._generated.*] -ignore_errors = True - -[mypy-azure.core.*] -ignore_errors = True \ No newline at end of file diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/pyproject.toml b/sdk/remoterendering/azure-mixedreality-remoterendering/pyproject.toml deleted file mode 100644 index e00361912969..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/pyproject.toml +++ /dev/null @@ -1,2 +0,0 @@ -[tool.azure-sdk-build] -pyright = false diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/samples/remote_rendering_client_sample.py b/sdk/remoterendering/azure-mixedreality-remoterendering/samples/remote_rendering_client_sample.py deleted file mode 100644 index 20cc52d96d0b..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/samples/remote_rendering_client_sample.py +++ /dev/null @@ -1,217 +0,0 @@ -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: remote_rendering_client_sample.py -DESCRIPTION: - These samples demonstrate creating a remote rendering client, converting an asset into the format used in rendering - sessions, listing created asset conversions, starting a rendering session, extending the lifetime of a rendering - session, stopping a rendering session and listing rendering sessions. - -USAGE: - python remote_rendering_client_sample.py - Set the environment variables with your own values before running the sample: - ARR_SERVICE_ENDPOINT - the endpoint of the Azure Remote Rendering service in the desired region. - e.g. "https://remoterendering.eastus.mixedreality.azure.com" for the East US region - Supported regions can be found at https://docs.microsoft.com/en-us/azure/remote-rendering/reference/regions - ARR_ACCOUNT_DOMAIN - the Remote Rendering account domain. e.g. "eastus.mixedreality.azure.com" - ARR_ACCOUNT_ID - the Remote Rendering account identifier. - ARR_ACCOUNT_KEY - the Remote Rendering account primary or secondary key. -""" - -import logging -import os -import sys -from typing import Optional, Union, cast -import uuid -from datetime import datetime - -from azure.core.credentials import AzureKeyCredential, AccessToken, TokenCredential -from azure.core.pipeline.policies import NetworkTraceLoggingPolicy -from azure.mixedreality.authentication import MixedRealityStsClient -from azure.mixedreality.remoterendering import (AssetConversion, - AssetConversionInputSettings, - AssetConversionOutputSettings, - AssetConversionStatus, - RemoteRenderingClient, - RenderingSessionSize, - RenderingSessionStatus, - AssetConversionOutput) - -# Create a logger for the 'azure' SDK -logger = logging.getLogger("azure") -logger.setLevel(logging.DEBUG) - -# Configure a console output -handler = logging.StreamHandler(stream=sys.stdout) -logger.addHandler(handler) - -# Enable network trace logging. This will be logged at DEBUG level. -# By default, logging is disabled. -logging_policy_enabled = os.environ.get("ARR_LOGGING_ENABLED", None) - -logging_policy = None -if logging_policy_enabled: - logging_policy = NetworkTraceLoggingPolicy() - logging_policy.enable_http_logger = True - -arr_endpoint = os.environ.get("ARR_SERVICE_ENDPOINT", None) -if not arr_endpoint: - raise ValueError("Set ARR_SERVICE_ENDPOINT env before run this sample.") - -account_id = os.environ.get("ARR_ACCOUNT_ID", None) -if not account_id: - raise ValueError("Set ARR_ACCOUNT_ID env before run this sample.") - -account_domain = os.environ.get("ARR_ACCOUNT_DOMAIN", None) -if not account_domain: - raise ValueError("Set ARR_ACCOUNT_DOMAIN env before run this sample.") - -account_key = os.environ.get("ARR_ACCOUNT_KEY", None) -if not account_key: - raise ValueError("Set ARR_ACCOUNT_KEY env before run this sample.") - -storage_container_uri_optional: Optional[str] = os.environ.get("ARR_STORAGE_CONTAINER_URI", None) -if not storage_container_uri_optional: - raise ValueError("Set ARR_STORAGE_CONTAINER_URI env before run this sample.") -storage_container_uri: str = storage_container_uri_optional - -input_blob_prefix = os.environ.get("ARR_STORAGE_INPUT_BLOB_PREFIX", None) -# if no input_blob_prefix is specified the whole content of the storage container will be retrieved for conversions -# this is not recommended since copying lots of unneeded files will slow down conversions - -relative_input_asset_path_optional: Optional[str] = os.environ.get("ARR_STORAGE_INPUT_ASSET_PATH", None) -if not relative_input_asset_path_optional: - raise ValueError("Set ARR_STORAGE_INPUT_ASSET_PATH env before run this sample.") -relative_input_asset_path: str = relative_input_asset_path_optional - -# use AzureKeyCredentials to authenticate to the service - other auth options include AAD and getting -# STS token using the mixed reality STS client -key_credential: Union[AzureKeyCredential, TokenCredential, AccessToken] = AzureKeyCredential(account_key) - -client = RemoteRenderingClient( - endpoint=arr_endpoint, - account_id=account_id, - account_domain=account_domain, - credential=key_credential, - logging_policy=logging_policy -) - - -def perform_asset_conversion(): - try: - # a UUID is a good conversion ID - guaranteed to be unique on an account - conversion_id = str(uuid.uuid4()) - - # In order to convert a model the input model needs to be retrieved from blob storage and the result of the - # conversion process will be written back to blob storage - # The subset of files which will be retrieved from the given input storage container is controlled by the - # input_settings blob_prefix more details at: - # https://docs.microsoft.com/en-us/azure/remote-rendering/resources/troubleshoot#conversion-file-download-errors - input_settings = AssetConversionInputSettings( - storage_container_uri=storage_container_uri, - blob_prefix=input_blob_prefix, # if not specified all files from the input container will be retrieved - relative_input_asset_path=relative_input_asset_path, - # container_read_list_sas #if storage is not linked with the ARR account provide a SAS here to grant access. - ) - - output_settings = AssetConversionOutputSettings( - storage_container_uri=storage_container_uri, # Note: different input/output containers can be specified - blob_prefix="output/"+conversion_id, - # output_asset_filename= convertedAsset.arrAsset # if not specified the output will be ".arrAsset". - # container_write_sas #if storage is not linked with the ARR account provide a SAS here to grant access. - ) - - conversion_poller = client.begin_asset_conversion(conversion_id=conversion_id, - input_settings=input_settings, - output_settings=output_settings) - - print("conversion with id:", conversion_id, "created. Waiting for completion.") - conversion = conversion_poller.result() - print("conversion with id:", conversion_id, "finished with result:", conversion.status) - if conversion.output is not None: - print(conversion.output.asset_uri) - else: - print("conversion had no output asset_uri") - - # a poller can also be acquired by id - # id_poller = await client.get_asset_conversion_poller(conversion_id=conversion_id) - # conversion = await id_poller.result() - - # we can also get the status of an individual asset conversion like this: - conversion = client.get_asset_conversion(conversion_id) - print("individual conversion retrieved with id:", conversion.id) - print("\tconversion status:", conversion.status) - - except Exception as e: - print("An error occurred: ", e) - - -def list_all_asset_conversions(): - print("listing conversions for remote rendering account: ", account_id) - print("conversions:") - conversions = client.list_asset_conversions() - for c in conversions: - created_on = c.created_on.strftime("%m/%d/%Y, %H:%M:%S") - print("\t conversion: id:", c.id, "status:", c.status, "created on:", created_on) - if c.status == AssetConversionStatus.SUCCEEDED: - if c.output is not None: - print("\t\tconversion result URI:", c.output.asset_uri) - else: - print("conversion result returned with empty URI") - - -def demonstrate_rendering_session_lifecycle(): - try: - # a UUID is a good session ID - guaranteed to be unique on an account - session_id = str(uuid.uuid4()) - print("starting rendering session with id:", session_id) - session_poller = client.begin_rendering_session( - session_id=session_id, size=RenderingSessionSize.STANDARD, lease_time_minutes=5) - print("rendering session with id:", session_id, "created. Waiting for session to be ready.",) - - session = session_poller.result() - print("session with id:", session.id, "is ready. lease_time_minutes:", session.lease_time_minutes,) - - # a poller can also be acquired by a id if a session already exists - # id_poller = client.get_rendering_session_poller(session_id=session_id) - # session = id_poller.result() - - # one can now connect to the rendering session using the runtime SDK on a Hololens 2 - print(session) - - # we can also get the properties of an individual session by id: - session = client.get_rendering_session(session_id) - print(session) - - # if the session should run longer than initially requested we can extend the lifetime of the session - session = client.get_rendering_session(session_id) - if cast(int, session.lease_time_minutes) - cast(int, session.elapsed_time_minutes) < 2: - session = client.update_rendering_session( - session_id=session_id, lease_time_minutes=cast(int, session.lease_time_minutes) + 10) - print("session with id:", session.id, "updated. New lease time:", session.lease_time_minutes, "minutes",) - - # once we do not need the session anymore we can stop the session - client.stop_rendering_session(session_id) - print("session with id:", session_id, "stopped") - except Exception as e: - print("An error occurred: ", e) - - -def list_all_rendering_sessions(): - print("listing sessions for account:", account_id) - print("sessions:") - rendering_sessions = client.list_rendering_sessions() - for session in rendering_sessions: - created_on = cast(datetime, session.created_on).strftime("%m/%d/%Y, %H:%M:%S") - print("\t session: id:", session.id, "status:", session.status, "created on:", created_on,) - - -if __name__ == "__main__": - perform_asset_conversion() - # list_all_asset_conversions() - demonstrate_rendering_session_lifecycle() - list_all_rendering_sessions() diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/samples/remote_rendering_client_sample_async.py b/sdk/remoterendering/azure-mixedreality-remoterendering/samples/remote_rendering_client_sample_async.py deleted file mode 100644 index a30ec141f1c6..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/samples/remote_rendering_client_sample_async.py +++ /dev/null @@ -1,222 +0,0 @@ -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -""" -FILE: remote_rendering_client_sample_async.py -DESCRIPTION: - These samples demonstrate creating a remote rendering client, converting an asset into the format used in rendering - sessions, listing created asset conversions, starting a rendering session, extending the lifetime of a rendering - session, stopping a rendering session and listing rendering sessions. - -USAGE: - python remote_rendering_client_sample_async.py - Set the environment variables with your own values before running the sample: - ARR_SERVICE_ENDPOINT - the endpoint of the Azure Remote Rendering service in the desired region. - e.g. "https://remoterendering.eastus.mixedreality.azure.com" for the East US region - Supported regions can be found at https://docs.microsoft.com/en-us/azure/remote-rendering/reference/regions - ARR_ACCOUNT_DOMAIN - the Remote Rendering account domain. e.g. "eastus.mixedreality.azure.com" - ARR_ACCOUNT_ID - the Remote Rendering account identifier. - ARR_ACCOUNT_KEY - the Remote Rendering account primary or secondary key. -""" - -import asyncio -import logging -import os -import sys -from typing import Optional, cast -import uuid -from datetime import datetime - -from azure.core.async_paging import AsyncItemPaged -from azure.core.credentials import AzureKeyCredential -from azure.core.pipeline import policies -from azure.mixedreality.remoterendering import (AssetConversionInputSettings, - AssetConversionOutputSettings, - AssetConversionStatus, - AssetConversionOutput, - RenderingSession, - RenderingSessionSize, - RenderingSessionStatus) -from azure.mixedreality.remoterendering.aio import RemoteRenderingClient - -# Create a logger for the 'azure' SDK -logger = logging.getLogger("azure") -logger.setLevel(logging.DEBUG) - -# Configure a console output -handler = logging.StreamHandler(stream=sys.stdout) -logger.addHandler(handler) - -# Enable network trace logging. This will be logged at DEBUG level. -# By default, logging is disabled. -logging_policy_enabled = os.environ.get("ARR_LOGGING_ENABLED", None) - -logging_policy = None -if logging_policy_enabled: - logging_policy = policies.NetworkTraceLoggingPolicy() - logging_policy.enable_http_logger = True - -arr_endpoint = os.environ.get("ARR_SERVICE_ENDPOINT", None) -if not arr_endpoint: - raise ValueError("Set ARR_SERVICE_ENDPOINT env before run this sample.") - -account_id = os.environ.get("ARR_ACCOUNT_ID", None) -if not account_id: - raise ValueError("Set ARR_ACCOUNT_ID env before run this sample.") - -account_domain = os.environ.get("ARR_ACCOUNT_DOMAIN", None) -if not account_domain: - raise ValueError("Set ARR_ACCOUNT_DOMAIN env before run this sample.") - -account_key = os.environ.get("ARR_ACCOUNT_KEY", None) -if not account_key: - raise ValueError("Set ARR_ACCOUNT_KEY env before run this sample.") - -storage_container_uri_optional: Optional[str] = os.environ.get("ARR_STORAGE_CONTAINER_URI", None) -if not storage_container_uri_optional: - raise ValueError("Set ARR_STORAGE_CONTAINER_URI env before run this sample.") -storage_container_uri: str = storage_container_uri_optional - -input_blob_prefix = os.environ.get("ARR_STORAGE_INPUT_BLOB_PREFIX", None) -# if no input_blob_prefix is specified the whole content of the storage container will be retrieved for conversions -# this is not recommended since copying lots of unneeded files will slow down conversions - -relative_input_asset_path_optional: Optional[str] = os.environ.get("ARR_STORAGE_INPUT_ASSET_PATH", None) -if not relative_input_asset_path_optional: - raise ValueError("Set ARR_STORAGE_INPUT_ASSET_PATH env before run this sample.") -relative_input_asset_path: str = relative_input_asset_path_optional - -# use AzureKeyCredentials to authenticate to the service - other auth options include AAD and getting -# STS token using the mixed reality STS client -key_credential = AzureKeyCredential(account_key) - -client = RemoteRenderingClient( - endpoint=arr_endpoint, - account_id=account_id, - account_domain=account_domain, - credential=key_credential, - logging_policy=logging_policy -) - - -async def perform_asset_conversion(): - try: - # a UUID is a good conversion ID - guaranteed to be unique on an account - conversion_id = str(uuid.uuid4()) - - # In order to convert a model the input model needs to be retrieved from blob storage and the result of the - # conversion process will be written back to blob storage - # The subset of files which will be retrieved from the given input storage container is controlled by the - # input_settings blob_prefix more details at: - # https://docs.microsoft.com/en-us/azure/remote-rendering/resources/troubleshoot#conversion-file-download-errors - input_settings = AssetConversionInputSettings( - storage_container_uri=storage_container_uri, - blob_prefix=input_blob_prefix, # if not specified all files from the input container will be retrieved - relative_input_asset_path=relative_input_asset_path, - # container_read_list_sas #if storage is not linked with the ARR account provide a SAS here to grant access. - ) - - output_settings = AssetConversionOutputSettings( - storage_container_uri=storage_container_uri, # Note: different input/output containers can be specified - blob_prefix="output/"+conversion_id, - # output_asset_filename= convertedAsset.arrAsset # if not specified the output will be ".arrAsset". - # container_write_sas #if storage is not linked with the ARR account provide a SAS here to grant access. - ) - - conversion_poller = await client.begin_asset_conversion(conversion_id=conversion_id, - input_settings=input_settings, - output_settings=output_settings) - - print("conversion with id:", conversion_id, "created. Waiting for completion.") - conversion = await conversion_poller.result() - print("conversion with id:", conversion_id, "finished with result:", conversion.status) - if conversion.output is not None: - print(conversion.output.asset_uri) - else: - print("conversion had no output asset_uri") - - # a poller can also be acquired by id - # id_poller = await client.get_asset_conversion_poller(conversion_id=conversion_id) - # conversion = await id_poller.result() - - # we can also get the status of an individual asset conversion like this: - conversion = await client.get_asset_conversion(conversion_id) - print("individual conversion retrieved with id:", conversion.id) - print("\tconversion status:", conversion.status) - - except Exception as e: - print("An error occurred: ", e) - - -async def list_all_asset_conversions(): - print("listing conversions for remote rendering account: ", account_id) - print("conversions:") - conversions = await client.list_asset_conversions() - async for c in conversions: - created_on = c.created_on.strftime("%m/%d/%Y, %H:%M:%S") - print("\t conversion: id:", c.id, "status:", c.status, "created on:", created_on) - if c.status == AssetConversionStatus.SUCCEEDED: - if c.output is not None: - print("\t\tconversion result URI:", c.output.asset_uri) - else: - print("conversion result returned with empty URI") - - -async def demonstrate_rendering_session_lifecycle(): - try: - # a UUID is a good session ID - guaranteed to be unique on an account - session_id = str(uuid.uuid4()) - print("starting rendering session with id:", session_id) - session_poller = await client.begin_rendering_session( - session_id=session_id, size=RenderingSessionSize.STANDARD, lease_time_minutes=5) - print("rendering session with id:", session_id, "created. Waiting for session to be ready.") - - session = await session_poller.result() - print("session with id:", session.id, "is ready. lease_time_minutes:", session.lease_time_minutes) - - # a poller can also be acquired by id - # id_poller = await client.get_rendering_session_poller(session_id=session_id) - # session = await id_poller.result() - - # one can now connect to the rendering session using the runtime SDK on a Hololens 2 - print(session) - - # we can also get the properties of an individual session by id: - session = await client.get_rendering_session(session_id) - print(session) - - # if the session should run longer than initially requested we can extend the lifetime of the session - session = await client.get_rendering_session(session_id) - if cast(int, session.lease_time_minutes) - cast(int, session.elapsed_time_minutes) < 2: - session = await client.update_rendering_session( - session_id=session_id, lease_time_minutes=cast(int, session.lease_time_minutes) + 10) - print("session with id:", session.id, "updated. New lease time:", session.lease_time_minutes, "minutes") - - # once we do not need the session anymore we can stop the session - await client.stop_rendering_session(session_id) - print("session with id:", session_id, "stopped") - except Exception as e: - print("An error occurred: ", e) - - -async def list_all_rendering_sessions(): - print("listing sessions for account:", account_id) - print("sessions:") - rendering_sessions = await client.list_rendering_sessions() - async for session in rendering_sessions: - print("\t session: id:", session.id, "status:", session.status, - "created on:", cast(datetime, session.created_on).strftime("%m/%d/%Y, %H:%M:%S")) - - -async def main(): - async with client: - await perform_asset_conversion() - await list_all_asset_conversions() - await demonstrate_rendering_session_lifecycle() - await list_all_rendering_sessions() - -if __name__ == '__main__': - asyncio.run(main()) diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/sdk_packaging.toml b/sdk/remoterendering/azure-mixedreality-remoterendering/sdk_packaging.toml deleted file mode 100644 index 773788868685..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/sdk_packaging.toml +++ /dev/null @@ -1,7 +0,0 @@ -[packaging] -auto_update = false -package_name = "azure-mixedreality-remoterendering" -package_pprint_name = "Azure Remote Rendering" -package_doc_id = "" -is_stable = false -is_arm = false diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/setup.py b/sdk/remoterendering/azure-mixedreality-remoterendering/setup.py deleted file mode 100644 index ac72a896b9a2..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/setup.py +++ /dev/null @@ -1,74 +0,0 @@ -from setuptools import setup, find_packages -import os -from io import open -import re - -PACKAGE_NAME = "azure-mixedreality-remoterendering" -PACKAGE_PPRINT_NAME = "Azure Remote Rendering" - -# a-b-c => a/b/c -package_folder_path = PACKAGE_NAME.replace('-', '/') -# a-b-c => a.b.c -namespace_name = PACKAGE_NAME.replace('-', '.') - -# Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, '_version.py'), 'r') as fd: - version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', - fd.read(), re.MULTILINE).group(1) -if not version: - raise RuntimeError('Cannot find version information') - -with open('README.md', encoding='utf-8') as f: - long_description = f.read() - -with open("CHANGELOG.md", encoding="utf-8") as f: - long_description += f.read() - -setup( - name=PACKAGE_NAME, - version=version, - description='Microsoft Azure {} Client Library for Python'.format( - PACKAGE_PPRINT_NAME), - - # ensure that these are updated to reflect the package owners' information - long_description=long_description, - long_description_content_type='text/markdown', - url='https://github.com/Azure/azure-sdk-for-python', - keywords="azure, azure sdk", - author='Microsoft Corporation', - author_email='azuresdkengsysadmins@microsoft.com', - - license='MIT License', - # ensure that the development status reflects the status of your package - classifiers=[ - "Development Status :: 7 - Inactive", - 'Programming Language :: Python', - 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'License :: OSI Approved :: MIT License', - ], - packages=find_packages(exclude=[ - 'tests', - # Exclude packages that will be covered by PEP420 or nspkg - 'azure', - 'azure.mixedreality' - ]), - include_package_data=True, - package_data={ - 'pytyped': ['py.typed'], - }, - python_requires=">=3.7", - install_requires=[ - 'azure-core<2.0.0,>=1.26.0', - 'azure-mixedreality-authentication>=1.0.0b1', - 'msrest>=0.6.21' - ], - project_urls={ - 'Bug Reports': 'https://github.com/Azure/azure-sdk-for-python/issues', - 'Source': 'https://github.com/Azure/azure-sdk-for-python', - } -) diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/swagger/AUTOREST.md b/sdk/remoterendering/azure-mixedreality-remoterendering/swagger/AUTOREST.md deleted file mode 100644 index 180f93b315da..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/swagger/AUTOREST.md +++ /dev/null @@ -1,232 +0,0 @@ -# Azure Remote Rendering Service client library for Python - -## Setup - -```ps -npm install -g autorest -``` - -## Generation - -```ps -cd -autorest AUTOREST.md -``` - -### Code generation settings - -```yaml -title: RemoteRenderingRestClient -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/2a65b0a2bbd9113b91c889f187d8778c2725c0b9/specification/mixedreality/data-plane/Microsoft.MixedReality/stable/2021-01-01/mr-arr.json -output-folder: ../azure/mixedreality/remoterendering/_generated -namespace: azure.mixedreality.remoterendering._generated -no-namespace-folders: true -license-header: MICROSOFT_MIT_NO_VERSION -enable-xml: false -clear-output-folder: true -vanilla: true -python: true -v3: true -no-async: false -``` - -### Directive renaming conversion "creationTime" property to "createdOn" - -``` yaml -directive: - from: swagger-document - where: '$.definitions.conversion.properties.creationTime' - transform: > - $["x-ms-client-name"] = "createdOn"; -``` - -### Directive renaming conversion to asset_conversion - -``` yaml -directive: - from: swagger-document - where: '$.definitions.conversion' - transform: > - $["x-ms-client-name"] = "asset_conversion"; -``` - -### Directive renaming create_conversion_settings to create_asset_conversion_settings - -``` yaml -directive: - from: swagger-document - where: '$.definitions.create_conversion_settings' - transform: > - $["x-ms-client-name"] = "create_asset_conversion_settings"; -``` - -### Directive renaming conversion output outputAssetUri property to assetUri - -``` yaml -directive: - from: swagger-document - where: '$.definitions.conversion.properties.output.properties.outputAssetUri' - transform: > - $["x-ms-client-name"] = "assetUri"; -``` - -### Directive renaming conversion_input_settings to asset_conversion_input_settings - -``` yaml -directive: - from: swagger-document - where: '$.definitions.conversion_input_settings' - transform: > - $["x-ms-client-name"] = "asset_conversion_input_settings"; -``` - -### Directive renaming conversion_output to asset_conversion_output - -``` yaml -directive: - - from: swagger-document - where: $.definitions - transform: > - $["AssetConversionOutput"] = $.conversion.properties.output; - $.conversion.properties["output"] = {"$ref": "#/definitions/AssetConversionOutput"}; -``` - -### Directive renaming conversion_output_settings to asset_conversion_output_settings - -``` yaml -directive: - from: swagger-document - where: '$.definitions.conversion_output_settings' - transform: > - $["x-ms-client-name"] = "asset_conversion_output_settings"; -``` - -### Directive renaming conversion_settings to asset_conversion_settings - -``` yaml -directive: - from: swagger-document - where: '$.definitions.conversion_settings' - transform: > - $["x-ms-client-name"] = "asset_conversion_settings"; -``` - -### Directive renaming conversion_status to asset_conversion_status - -``` yaml -directive: - from: swagger-document - where: '$.definitions.conversion_status' - transform: > - $["x-ms-enum"].name = "asset_conversion_status"; -``` - -### Directive renaming session creationTime property to createdOn - -``` yaml -directive: - from: swagger-document - where: '$.definitions.session_properties.properties.creationTime' - transform: > - $["x-ms-client-name"] = "createdOn"; -``` - -### Directive renaming session maxLeaseTimeMinutes property to leaseTimeMinutes - -``` yaml -directive: - from: swagger-document - where: '$.definitions.session_properties.properties.maxLeaseTimeMinutes' - transform: > - $["x-ms-client-name"] = "leaseTimeMinutes"; -``` - -### Directive renaming create_session_settings maxLeaseTimeMinutes property to leaseTimeMinutes - -``` yaml -directive: - from: swagger-document - where: '$.definitions.create_session_settings.properties.maxLeaseTimeMinutes' - transform: > - $["x-ms-client-name"] = "leaseTimeMinutes"; -``` - -### Directive renaming update_session_settings maxLeaseTimeMinutes property to leaseTimeMinutes - -``` yaml -directive: - from: swagger-document - where: '$.definitions.update_session_settings.properties.maxLeaseTimeMinutes' - transform: > - $["x-ms-client-name"] = "leaseTimeMinutes"; -``` - -### Directive renaming conversion settings inputLocation property to inputSettings - -``` yaml -directive: - from: swagger-document - where: '$.definitions.conversion_settings.properties.inputLocation' - transform: > - $["x-ms-client-name"] = "inputSettings"; -``` - -### Directive renaming conversion settings outputLocation property to outputSettings - -``` yaml -directive: - from: swagger-document - where: '$.definitions.conversion_settings.properties.outputLocation' - transform: > - $["x-ms-client-name"] = "outputSettings"; -``` - -### Directive renaming session_properties to rendering_session - -``` yaml -directive: - from: swagger-document - where: '$.definitions.session_properties' - transform: > - $["x-ms-client-name"] = "rendering_session"; -``` - -### Directive renaming create_session_settings to create_rendering_session_settings - -``` yaml -directive: - from: swagger-document - where: '$.definitions.create_session_settings' - transform: > - $["x-ms-client-name"] = "create_rendering_session_settings"; -``` - -### Directive renaming session_status to rendering_session_status - -``` yaml -directive: - from: swagger-document - where: '$.definitions.session_status' - transform: > - $["x-ms-enum"].name = "rendering_session_status"; -``` - -### Directive renaming session_size to rendering_session_size - -``` yaml -directive: - from: swagger-document - where: '$.definitions.session_size' - transform: > - $["x-ms-enum"].name = "rendering_session_size"; -``` - -### Directive renaming error to remote_rendering_error - -``` yaml -directive: - from: swagger-document - where: '$.definitions.error' - transform: > - $["x-ms-client-name"] = "remote_rendering_error"; -``` diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/tests/conftest.py b/sdk/remoterendering/azure-mixedreality-remoterendering/tests/conftest.py deleted file mode 100644 index 0a85f14d4b50..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/tests/conftest.py +++ /dev/null @@ -1,111 +0,0 @@ -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- -import pytest -import pytest_asyncio - -from azure.core.credentials import AzureKeyCredential -from azure.mixedreality.remoterendering import RemoteRenderingClient -from azure.mixedreality.remoterendering.aio import RemoteRenderingClient as RemoteRenderingClientAsync -from devtools_testutils.sanitizers import ( - add_body_key_sanitizer, - add_general_regex_sanitizer, - add_remove_header_sanitizer, - is_live, - remove_batch_sanitizers, -) - -# Environment variable keys -ENV_ARR_SERVICE_ENDPOINT = "REMOTERENDERING_ARR_SERVICE_ENDPOINT" -ENV_ARR_ACCOUNT_DOMAIN = "REMOTERENDERING_ARR_ACCOUNT_DOMAIN" -ENV_ARR_ACCOUNT_ID = "REMOTERENDERING_ARR_ACCOUNT_ID" -ENV_ARR_ACCOUNT_KEY = "REMOTERENDERING_ARR_ACCOUNT_KEY" -ENV_ARR_STORAGE_ACCOUNT_NAME = "REMOTERENDERING_ARR_STORAGE_ACCOUNT_NAME" -ENV_ARR_SAS_TOKEN = "REMOTERENDERING_ARR_SAS_TOKEN" -ENV_ARR_BLOB_CONTAINER_NAME = "REMOTERENDERING_ARR_BLOB_CONTAINER_NAME" -ENV_STORAGE_ENDPOINT_SUFFIX = "REMOTERENDERING_STORAGE_ENDPOINT_SUFFIX" - -# Fake values -TEST_ARR_SERVICE_ENDPOINT = "https://remoterendering.eastus.mixedreality.azure.com" -TEST_ARR_ACCOUNT_DOMAIN = "eastus.mixedreality.azure.com" -TEST_ARR_ACCOUNT_ID = "00000000-0000-0000-0000-000000000000" -TEST_ARR_ACCOUNT_KEY = "fakekey" -TEST_ARR_STORAGE_ACCOUNT_NAME = "arrstorageaccount" -TEST_ARR_SAS_TOKEN = "sv=2015-04-05&sr=c&se=2122-03-10T16%3A13%3A40.0000000Z&sp=rwl&sig=fakeSig" -TEST_ARR_BLOB_CONTAINER_NAME = "test" -TEST_STORAGE_ENDPOINT_SUFFIX = "storage_endpoint_suffix" -TEST_ID_PLACEHOLDER = "rr-test-id" - - -@pytest.fixture(scope="session", autouse=True) -def add_sanitizers(test_proxy, environment_variables): - sanitization_mapping = { - ENV_ARR_SERVICE_ENDPOINT: TEST_ARR_SERVICE_ENDPOINT, - ENV_ARR_ACCOUNT_DOMAIN: TEST_ARR_ACCOUNT_DOMAIN, - ENV_ARR_ACCOUNT_ID: TEST_ARR_ACCOUNT_ID, - ENV_ARR_ACCOUNT_KEY: TEST_ARR_ACCOUNT_KEY, - ENV_ARR_STORAGE_ACCOUNT_NAME: TEST_ARR_STORAGE_ACCOUNT_NAME, - ENV_ARR_SAS_TOKEN: TEST_ARR_SAS_TOKEN, - ENV_ARR_BLOB_CONTAINER_NAME: TEST_ARR_BLOB_CONTAINER_NAME, - ENV_STORAGE_ENDPOINT_SUFFIX: TEST_STORAGE_ENDPOINT_SUFFIX - } - environment_variables.sanitize_batch(sanitization_mapping) - add_remove_header_sanitizer(headers="X-MRC-CV") - add_body_key_sanitizer(json_path="AccessToken", value="fake.eyJleHAiOjIxNDc0ODM2NDd9.fake") - add_general_regex_sanitizer( - regex=f"{TEST_ID_PLACEHOLDER}[a-z0-9-]+", - value=TEST_ID_PLACEHOLDER - ) - - # Remove the following sanitizers since certain fields are needed in tests and are non-sensitive: - # - AZSDK3430: $..id - remove_batch_sanitizers(["AZSDK3430"]) - - -@pytest.fixture(scope="session") -def account_info(environment_variables): - yield { - "service_endpoint": environment_variables.get(ENV_ARR_SERVICE_ENDPOINT), - "account_domain": environment_variables.get(ENV_ARR_ACCOUNT_DOMAIN), - "account_id": environment_variables.get(ENV_ARR_ACCOUNT_ID), - "account_key": environment_variables.get(ENV_ARR_ACCOUNT_KEY), - "storage_account_name": environment_variables.get(ENV_ARR_STORAGE_ACCOUNT_NAME), - "sas_token": environment_variables.get(ENV_ARR_SAS_TOKEN), - "blob_container_name": environment_variables.get(ENV_ARR_BLOB_CONTAINER_NAME), - "storage_endpoint_suffix": environment_variables.get(ENV_STORAGE_ENDPOINT_SUFFIX), - "key_credential": AzureKeyCredential(environment_variables.get(ENV_ARR_ACCOUNT_KEY)), - "id_placeholder": TEST_ID_PLACEHOLDER - } - - -@pytest.fixture -def arr_client(account_info): - # Give a small interval for playback tests to avoid - # a race condition where a poller consumes more recorded requests - # than expected. - polling_interval = 10 if is_live() else 0.2 - client = RemoteRenderingClient( - endpoint=account_info["service_endpoint"], - account_id=account_info["account_id"], - account_domain=account_info["account_domain"], - credential=account_info["key_credential"], - polling_interval=polling_interval - ) - yield client - client.close() - - -@pytest_asyncio.fixture -async def async_arr_client(account_info): - polling_interval = 10 if is_live() else 0 - client = RemoteRenderingClientAsync( - endpoint=account_info["service_endpoint"], - account_id=account_info["account_id"], - account_domain=account_info["account_domain"], - credential=account_info["key_credential"], - polling_interval=polling_interval - ) - yield client - await client.close() diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/tests/test_client.py b/sdk/remoterendering/azure-mixedreality-remoterendering/tests/test_client.py deleted file mode 100644 index 51ef104c5794..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/tests/test_client.py +++ /dev/null @@ -1,278 +0,0 @@ -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- -import pytest -import uuid -import json - -from azure.core.credentials import AzureKeyCredential -from azure.core.exceptions import HttpResponseError -from azure.mixedreality.remoterendering import (AssetConversionInputSettings, - AssetConversionOutputSettings, - AssetConversionStatus, - RemoteRenderingClient, - RenderingSessionSize, - RenderingSessionStatus) -from devtools_testutils import AzureRecordedTestCase - - -class TestRemoteRenderingClient(AzureRecordedTestCase): - - def test_create_client(self, account_info): - client = RemoteRenderingClient( - endpoint=account_info["service_endpoint"], - account_id=account_info["account_id"], - account_domain=account_info["account_domain"], - credential=account_info["key_credential"] - ) - assert client is not None - - def test_create_client_with_invalid_arguments(self, account_info): - with pytest.raises(ValueError): - RemoteRenderingClient( - endpoint=None, - account_id=account_info["account_id"], - account_domain=account_info["account_domain"], - credential=account_info["key_credential"]) - - with pytest.raises(ValueError): - RemoteRenderingClient( - endpoint=account_info["service_endpoint"], - account_id=None, - account_domain=account_info["account_domain"], - credential=account_info["key_credential"]) - - with pytest.raises(ValueError): - RemoteRenderingClient( - endpoint=account_info["service_endpoint"], - account_id=account_info["account_id"], - account_domain=None, - credential=account_info["key_credential"]) - - with pytest.raises(ValueError): - RemoteRenderingClient( - endpoint=account_info["service_endpoint"], - account_id=account_info["account_id"], - account_domain=account_info["account_domain"], - credential=None) - - with pytest.raises(ValueError): - RemoteRenderingClient( - endpoint=account_info["service_endpoint"], - account_id=account_info["account_id"], - account_domain=account_info["account_domain"], - credential=account_info["key_credential"], - authentication_endpoint_url="#") - - def test_simple_conversion(self, recorded_test, account_info, arr_client): - conversion_id = account_info["id_placeholder"] - if self.is_live: - conversion_id += str(uuid.uuid4()) - - print("Using conversion id: {}".format(conversion_id)) - - storage_container_uri = "https://"+account_info["storage_account_name"] + \ - ".blob."+account_info["storage_endpoint_suffix"]+"/"+account_info["blob_container_name"] - - input_settings = AssetConversionInputSettings( - storage_container_uri=storage_container_uri, - relative_input_asset_path="testBox.fbx", - blob_prefix="Input", - storage_container_read_list_sas="?"+account_info["sas_token"] - ) - output_settings = AssetConversionOutputSettings( - storage_container_uri=storage_container_uri, - blob_prefix=conversion_id, - storage_container_write_sas="?"+account_info["sas_token"] - ) - - conversion_poller = arr_client.begin_asset_conversion( - conversion_id=conversion_id, input_settings=input_settings, output_settings=output_settings - ) - - conversion = arr_client.get_asset_conversion(conversion_id) - assert conversion.id == conversion_id - assert conversion.settings.input_settings.relative_input_asset_path == input_settings.relative_input_asset_path - assert conversion.status != AssetConversionStatus.FAILED - - finished_conversion = conversion_poller.result() - - assert finished_conversion.id == conversion_id - assert finished_conversion.settings.input_settings.relative_input_asset_path == input_settings.relative_input_asset_path - assert finished_conversion.status == AssetConversionStatus.SUCCEEDED - finished_conversion.output.asset_uri.endswith(conversion_id+"/testBox.arrAsset") - - foundConversion = False - conversions = arr_client.list_asset_conversions() - for c in conversions: - if(c.id == conversion_id): - foundConversion = True - break - assert foundConversion == True - - def test_failed_conversion_unauthorized(self, recorded_test, account_info): - client = RemoteRenderingClient( - endpoint=account_info["service_endpoint"], - account_id=account_info["account_id"], - account_domain=account_info["account_domain"], - credential=AzureKeyCredential("wrong_key") - ) - - conversion_id = account_info["id_placeholder"] - if self.is_live: - conversion_id += str(uuid.uuid4()) - - print("Using conversion id: {}".format(conversion_id)) - - storage_container_uri = "https://"+account_info["storage_account_name"] + \ - ".blob."+account_info["storage_endpoint_suffix"]+"/"+account_info["blob_container_name"] - - input_settings = AssetConversionInputSettings( - storage_container_uri=storage_container_uri, - relative_input_asset_path="testBox.fbx", - blob_prefix="Input" - # Do not provide SAS access to the container, and assume the test account is not linked to the storage. - ) - output_settings = AssetConversionOutputSettings( - storage_container_uri=storage_container_uri, - blob_prefix=conversion_id - # Do not provide SAS access to the container, and assume the test account is not linked to the storage. - ) - - with pytest.raises(HttpResponseError) as excinfo: - # make the request which cannot access the storage account - conversion_poller = client.begin_asset_conversion( - conversion_id=conversion_id, input_settings=input_settings, output_settings=output_settings - ) - - exception = excinfo.value - assert exception.status_code == 401 - assert "Unauthorized" in exception.message - - def test_failed_conversion_no_access(self, recorded_test, account_info, arr_client): - conversion_id = account_info["id_placeholder"] - if self.is_live: - conversion_id += str(uuid.uuid4()) - - storage_container_uri = "https://"+account_info["storage_account_name"] + \ - ".blob."+account_info["storage_endpoint_suffix"]+"/"+account_info["blob_container_name"] - - input_settings = AssetConversionInputSettings( - storage_container_uri=storage_container_uri, - relative_input_asset_path="testBox.fbx", - blob_prefix="Input" - # Do not provide SAS access to the container, and assume the test account is not linked to the storage. - ) - output_settings = AssetConversionOutputSettings( - storage_container_uri=storage_container_uri, - blob_prefix=conversion_id - # Do not provide SAS access to the container, and assume the test account is not linked to the storage. - ) - - with pytest.raises(HttpResponseError) as excinfo: - # make the request which cannot access the storage account - conversion_poller = arr_client.begin_asset_conversion( - conversion_id=conversion_id, input_settings=input_settings, output_settings=output_settings - ) - - assert excinfo.value.status_code == 403 - error_details = excinfo.value - assert "storage" in error_details.message - assert "permissions" in error_details.message - - def test_failed_conversion_missing_asset(self, recorded_test, account_info, arr_client): - conversion_id = account_info["id_placeholder"] - if self.is_live: - conversion_id += str(uuid.uuid4()) - - print("Using conversion id: {}".format(conversion_id)) - - storage_container_uri = "https://"+account_info["storage_account_name"] + \ - ".blob."+account_info["storage_endpoint_suffix"]+"/"+account_info["blob_container_name"] - - input_settings = AssetConversionInputSettings( - storage_container_uri=storage_container_uri, - relative_input_asset_path="testBoxWhichDoesNotExist.fbx", - blob_prefix="Input", - storage_container_read_list_sas="?"+account_info["sas_token"] - ) - output_settings = AssetConversionOutputSettings( - storage_container_uri=storage_container_uri, - blob_prefix=conversion_id, - storage_container_write_sas="?"+account_info["sas_token"] - ) - - with pytest.raises(HttpResponseError) as excinfo: - # make the request which fails in polling because of the missing asset - conversion_poller = arr_client.begin_asset_conversion( - conversion_id=conversion_id, input_settings=input_settings, output_settings=output_settings) - conversion_poller.result() - - error_details = excinfo.value - - print(json.dumps(error_details.error.__dict__)) - - assert "InputContainerError" == error_details.error.code - # Message: "Could not find the asset file in the storage account. Please make sure all paths and names are correct and the file is uploaded to storage." - assert error_details.error.message is not None - assert "Could not find the asset file in the storage account" in error_details.error.message - - def test_simple_session(self, recorded_test, account_info, arr_client): - session_id = account_info["id_placeholder"] - if self.is_live: - session_id += str(uuid.uuid4()) - - print("Using session id: {}".format(session_id)) - - session_poller = arr_client.begin_rendering_session( - session_id=session_id, size=RenderingSessionSize.STANDARD, lease_time_minutes=15) - - session = arr_client.get_rendering_session(session_id) - assert session.id == session_id - - assert session.lease_time_minutes == 15 - assert session.status != RenderingSessionStatus.ERROR - - ready_session = session_poller.result() - assert ready_session.id == session_id - assert ready_session.lease_time_minutes == 15 - assert ready_session.status == RenderingSessionStatus.READY - - assert ready_session.hostname - assert ready_session.arr_inspector_port is not None - assert ready_session.handshake_port is not None - - extended_session = arr_client.update_rendering_session(session_id=session_id, lease_time_minutes=20) - assert extended_session.id == session_id - assert extended_session.lease_time_minutes == 15 or extended_session.lease_time_minutes == 20 - assert extended_session.status == RenderingSessionStatus.READY - - foundSession = False - for s in arr_client.list_rendering_sessions(): - if s.id == session_id: - foundSession = True - break - assert foundSession == True - - arr_client.stop_rendering_session(session_id) - stopped_session = arr_client.get_rendering_session(session_id) - assert stopped_session.status == RenderingSessionStatus.STOPPED - - def test_failed_session_request(self, recorded_test, account_info, arr_client): - session_id = account_info["id_placeholder"] - if self.is_live: - session_id += str(uuid.uuid4()) - - print("Using session id: {}".format(session_id)) - - with pytest.raises(HttpResponseError) as excinfo: - # Make an invalid request (negative lease time). - session_poller = arr_client.begin_rendering_session( - session_id=session_id, size=RenderingSessionSize.STANDARD, lease_time_minutes=-4) - - assert excinfo.value.status_code == 400 - exception = excinfo.value - assert "lease" in exception.message.lower() - assert "negative" in exception.message.lower() diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/tests/test_client_async.py b/sdk/remoterendering/azure-mixedreality-remoterendering/tests/test_client_async.py deleted file mode 100644 index d65d2c38a444..000000000000 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/tests/test_client_async.py +++ /dev/null @@ -1,272 +0,0 @@ -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- -import pytest -import uuid - -from azure.core.credentials import AzureKeyCredential -from azure.core.exceptions import HttpResponseError -from azure.mixedreality.remoterendering.aio import RemoteRenderingClient -from azure.mixedreality.remoterendering import ( - AssetConversionInputSettings, - AssetConversionOutputSettings, - AssetConversionStatus, - RenderingSessionSize, - RenderingSessionStatus -) -from devtools_testutils import AzureRecordedTestCase - - -class TestRemoteRenderingClientAsync(AzureRecordedTestCase): - - def test_create_client(self, account_info): - - client = RemoteRenderingClient( - endpoint=account_info["service_endpoint"], - account_id=account_info["account_id"], - account_domain=account_info["account_domain"], - credential=account_info["key_credential"] - ) - assert client is not None - - def test_create_client_with_invalid_arguments(self, account_info): - with pytest.raises(ValueError): - RemoteRenderingClient( - endpoint=None, - account_id=account_info["account_id"], - account_domain=account_info["account_domain"], - credential=account_info["key_credential"]) - - with pytest.raises(ValueError): - RemoteRenderingClient( - endpoint=account_info["service_endpoint"], - account_id=None, - account_domain=account_info["account_domain"], - credential=account_info["key_credential"]) - - with pytest.raises(ValueError): - RemoteRenderingClient( - endpoint=account_info["service_endpoint"], - account_id=account_info["account_id"], - account_domain=None, - credential=account_info["key_credential"]) - - with pytest.raises(ValueError): - RemoteRenderingClient( - endpoint=account_info["service_endpoint"], - account_id=account_info["account_id"], - account_domain=account_info["account_domain"], - credential=None) - - with pytest.raises(ValueError): - RemoteRenderingClient( - endpoint=account_info["service_endpoint"], - account_id=account_info["account_id"], - account_domain=account_info["account_domain"], - credential=account_info["key_credential"], - authentication_endpoint_url="#") - - @pytest.mark.asyncio - async def test_simple_conversion(self, recorded_test, account_info, async_arr_client): - conversion_id = account_info["id_placeholder"] - if self.is_live: - conversion_id += str(uuid.uuid4()) - - storage_container_uri = "https://"+account_info["storage_account_name"] + \ - ".blob."+account_info["storage_endpoint_suffix"]+"/"+account_info["blob_container_name"] - - input_settings = AssetConversionInputSettings( - storage_container_uri=storage_container_uri, - relative_input_asset_path="testBox.fbx", - blob_prefix="Input", - storage_container_read_list_sas="?"+account_info["sas_token"] - ) - output_settings = AssetConversionOutputSettings( - storage_container_uri=storage_container_uri, - blob_prefix=conversion_id, - storage_container_write_sas="?"+account_info["sas_token"] - ) - - conversion_poller = await async_arr_client.begin_asset_conversion( - conversion_id=conversion_id, input_settings=input_settings, output_settings=output_settings - ) - - conversion = await async_arr_client.get_asset_conversion(conversion_id) - assert conversion.id == conversion_id - assert conversion.settings.input_settings.relative_input_asset_path == input_settings.relative_input_asset_path - assert conversion.status != AssetConversionStatus.FAILED - - finished_conversion = await conversion_poller.result() - - assert finished_conversion.id == conversion_id - assert finished_conversion.settings.input_settings.relative_input_asset_path == input_settings.relative_input_asset_path - assert finished_conversion.status == AssetConversionStatus.SUCCEEDED - finished_conversion.output.asset_uri.endswith(conversion_id+"/testBox.arrAsset") - - foundConversion = False - conversions = await async_arr_client.list_asset_conversions() - async for c in conversions: - if(c.id == conversion_id): - foundConversion = True - break - assert foundConversion == True - - @pytest.mark.asyncio - async def test_failed_conversion_unauthorized(self, recorded_test, account_info): - client = RemoteRenderingClient( - endpoint=account_info["service_endpoint"], - account_id=account_info["account_id"], - account_domain=account_info["account_domain"], - credential=AzureKeyCredential("wrong_key") - ) - - conversion_id = account_info["id_placeholder"] - if self.is_live: - conversion_id += str(uuid.uuid4()) - - storage_container_uri = "https://"+account_info["storage_account_name"] + \ - ".blob."+account_info["storage_endpoint_suffix"]+"/"+account_info["blob_container_name"] - - input_settings = AssetConversionInputSettings( - storage_container_uri=storage_container_uri, - relative_input_asset_path="testBox.fbx", - blob_prefix="Input" - # Do not provide SAS access to the container, and assume the test account is not linked to the storage. - ) - output_settings = AssetConversionOutputSettings( - storage_container_uri=storage_container_uri, - blob_prefix=conversion_id - # Do not provide SAS access to the container, and assume the test account is not linked to the storage. - ) - - with pytest.raises(HttpResponseError) as excinfo: - # make the request which cannot access the storage account - conversion_poller = await client.begin_asset_conversion( - conversion_id=conversion_id, input_settings=input_settings, output_settings=output_settings - ) - - exception = excinfo.value - assert exception.status_code == 401 - assert "Unauthorized" in exception.message - - @pytest.mark.asyncio - async def test_failed_conversion_no_access(self, recorded_test, account_info, async_arr_client): - conversion_id = account_info["id_placeholder"] - if self.is_live: - conversion_id += str(uuid.uuid4()) - - storage_container_uri = "https://"+account_info["storage_account_name"] + \ - ".blob."+account_info["storage_endpoint_suffix"]+"/"+account_info["blob_container_name"] - - input_settings = AssetConversionInputSettings( - storage_container_uri=storage_container_uri, - relative_input_asset_path="testBox.fbx", - blob_prefix="Input" - # Do not provide SAS access to the container, and assume the test account is not linked to the storage. - ) - output_settings = AssetConversionOutputSettings( - storage_container_uri=storage_container_uri, - blob_prefix=conversion_id - # Do not provide SAS access to the container, and assume the test account is not linked to the storage. - ) - - with pytest.raises(HttpResponseError) as excinfo: - # make the request which cannot access the storage account - conversion_poller = await async_arr_client.begin_asset_conversion( - conversion_id=conversion_id, input_settings=input_settings, output_settings=output_settings - ) - - assert excinfo.value.status_code == 403 - error_details = excinfo.value - assert "storage" in error_details.message - assert "permissions" in error_details.message - - @pytest.mark.asyncio - async def test_failed_conversion_missing_asset(self, recorded_test, account_info, async_arr_client): - conversion_id = account_info["id_placeholder"] - if self.is_live: - conversion_id += str(uuid.uuid4()) - - storage_container_uri = "https://"+account_info["storage_account_name"] + \ - ".blob."+account_info["storage_endpoint_suffix"]+"/"+account_info["blob_container_name"] - - input_settings = AssetConversionInputSettings( - storage_container_uri=storage_container_uri, - relative_input_asset_path="testBoxWhichDoesNotExist.fbx", - blob_prefix="Input", - storage_container_read_list_sas="?"+account_info["sas_token"] - ) - output_settings = AssetConversionOutputSettings( - storage_container_uri=storage_container_uri, - blob_prefix=conversion_id, - storage_container_write_sas="?"+account_info["sas_token"] - ) - with pytest.raises(HttpResponseError) as excinfo: - conversion_poller = await async_arr_client.begin_asset_conversion( - conversion_id=conversion_id, input_settings=input_settings, output_settings=output_settings - ) - await conversion_poller.result() - - error_details = excinfo.value - assert "InputContainerError" == error_details.error.code - # Message: "Could not find the asset file in the storage account. Please make sure all paths and names are correct and the file is uploaded to storage." - assert error_details.error.message is not None - assert "Could not find the asset file in the storage account" in error_details.error.message - - @pytest.mark.asyncio - async def test_simple_session(self, recorded_test, account_info, async_arr_client): - session_id = account_info["id_placeholder"] - if self.is_live: - session_id += str(uuid.uuid4()) - - session_poller = await async_arr_client.begin_rendering_session( - session_id=session_id, size=RenderingSessionSize.STANDARD, lease_time_minutes=15) - - session = await async_arr_client.get_rendering_session(session_id) - assert session.id == session_id - - assert session.lease_time_minutes == 15 - assert session.status != RenderingSessionStatus.ERROR - - ready_session = await session_poller.result() - assert ready_session.id == session_id - assert ready_session.lease_time_minutes == 15 - assert ready_session.status == RenderingSessionStatus.READY - - assert ready_session.hostname - assert ready_session.arr_inspector_port is not None - assert ready_session.handshake_port is not None - - extended_session = await async_arr_client.update_rendering_session(session_id=session_id, lease_time_minutes=20) - assert extended_session.id == session_id - assert extended_session.lease_time_minutes == 15 or extended_session.lease_time_minutes == 20 - assert extended_session.status == RenderingSessionStatus.READY - - foundSession = False - async for s in await async_arr_client.list_rendering_sessions(): - if s.id == session_id: - foundSession = True - break - assert foundSession == True - - await async_arr_client.stop_rendering_session(session_id) - stopped_session = await async_arr_client.get_rendering_session(session_id) - assert stopped_session.status == RenderingSessionStatus.STOPPED - - @pytest.mark.asyncio - async def test_failed_session_request(self, recorded_test, account_info, async_arr_client): - session_id = account_info["id_placeholder"] - if self.is_live: - session_id += str(uuid.uuid4()) - - with pytest.raises(HttpResponseError) as excinfo: - # Make an invalid request (negative lease time). - session_poller = await async_arr_client.begin_rendering_session( - session_id=session_id, size=RenderingSessionSize.STANDARD, lease_time_minutes=-4) - - assert excinfo.value.status_code == 400 - exception = excinfo.value - assert "lease" in exception.message.lower() - assert "negative" in exception.message.lower() diff --git a/sdk/remoterendering/ci.yml b/sdk/remoterendering/ci.yml deleted file mode 100644 index 88b69880133f..000000000000 --- a/sdk/remoterendering/ci.yml +++ /dev/null @@ -1,35 +0,0 @@ -# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. - -trigger: - branches: - include: - - master - - main - - hotfix/* - - release/* - - restapi* - paths: - include: - - sdk/remoterendering/ - -pr: - branches: - include: - - master - - main - - feature/* - - hotfix/* - - release/* - - restapi* - paths: - include: - - sdk/remoterendering/ - -extends: - template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml - parameters: - ServiceDirectory: remoterendering - TestProxy: true - Artifacts: - - name: azure-mixedreality-remoterendering - safeName: azuremixedrealityremoterendering diff --git a/sdk/remoterendering/test-resources-post.ps1 b/sdk/remoterendering/test-resources-post.ps1 deleted file mode 100644 index af709dc67e94..000000000000 --- a/sdk/remoterendering/test-resources-post.ps1 +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. - -# This script is used to generate the Test Configuration file for Storage live tests. -# It is invoked by the https://github.com/Azure/azure-sdk-for-python/blob/master/eng/common/TestResources/New-TestResources.ps1 -# script after the ARM template, defined in https://github.com/Azure/azure-sdk-for-net/blob/arm-template-storage/sdk/storage/test-resources.json, -# is finished being deployed. The ARM template is responsible for creating the Storage accounts needed for live tests. - -param ( - [hashtable] $DeploymentOutputs, - [string] $TenantId, - [string] $TestApplicationId -) - -# outputs from the ARM deployment passed in from New-TestResources -$StorageAccountName = $DeploymentOutputs['REMOTERENDERING_ARR_STORAGE_ACCOUNT_NAME'] -$StorageAccountKey = $DeploymentOutputs['REMOTERENDERING_ARR_STORAGE_ACCOUNT_KEY'] -$BlobContainerName = $DeploymentOutputs['REMOTERENDERING_ARR_BLOB_CONTAINER_NAME'] - -$LocalFilePath = Join-Path $PSScriptRoot "TestResources\testBox.fbx" -$TargetBlob = "Input/testBox.fbx" - -Write-Verbose ( "Copying test asset to blob storage") - -$StorageContext = New-AzStorageContext -StorageAccountName $StorageAccountName -StorageAccountKey $StorageAccountKey - -$blob = Set-AzStorageBlobContent -File $LocalFilePath -Blob $TargetBlob -Container $BlobContainerName -Context $StorageContext -Force - -Write-Verbose ("Test asset successfully copied to blob storage") diff --git a/sdk/remoterendering/test-resources.json b/sdk/remoterendering/test-resources.json deleted file mode 100644 index 3c2d9c663c83..000000000000 --- a/sdk/remoterendering/test-resources.json +++ /dev/null @@ -1,125 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "baseName": { - "type": "string", - "defaultValue": "[resourceGroup().name]", - "metadata": { - "description": "The base resource name." - } - }, - "tenantId": { - "type": "string", - "defaultValue": "72f988bf-86f1-41af-91ab-2d7cd011db47", - "metadata": { - "description": "The tenant ID to which the application and resources belong." - } - }, - "location": { - "type": "string", - "defaultValue": "[resourceGroup().location]", - "metadata": { - "description": "The location of the resource. By default, this is the same as the resource group." - } - }, - "baseTime": { - "type": "string", - "defaultValue": "[utcNow('u')]" - } - }, - "variables": { - "apiVersion": "2020-05-01", - "arrApiVersion": "2021-03-01-preview", - "arrAccountName": "[concat(parameters('baseName'), '-arr-account')]", - "storageApiVersion": "2019-06-01", - "storageAccountName": "[parameters('baseName')]", - "blobContainerName": "test", - "blobContainerResourceName": "[concat(variables('storageAccountName'), '/default/', variables('blobContainerName'))]", - "sasProperties": { - "signedPermission": "rwl", - "signedExpiry": "[dateTimeAdd(parameters('baseTime'), 'P1D')]", - "signedResource": "c", - "canonicalizedResource": "[concat('/blob/', variables('storageAccountName'), '/', variables('blobContainerName'))]" - } - }, - "resources": [ - { - "type": "Microsoft.MixedReality/remoteRenderingAccounts", - "name": "[variables('arrAccountName')]", - "apiVersion": "[variables('arrApiVersion')]", - "location": "[parameters('location')]", - "properties": {}, - "identity": { "type": "systemAssigned" } - }, - { - "type": "Microsoft.Storage/storageAccounts", - "apiVersion": "[variables('storageApiVersion')]", - "name": "[variables('storageAccountName')]", - "location": "[parameters('location')]", - "sku": { - "name": "Standard_RAGRS", - "tier": "Standard" - }, - "kind": "StorageV2", - "properties": { - "supportsHttpsTrafficOnly": true, - "encryption": { - "keySource": "Microsoft.Storage", - "services": { - "blob": { - "enabled": true - } - } - }, - "accessTier": "Hot" - } - }, - { - "type": "Microsoft.Storage/storageAccounts/blobServices/containers", - "apiVersion": "[variables('storageApiVersion')]", - "name": "[variables('blobContainerResourceName')]", - "dependsOn": [ - "[variables('storageAccountName')]" - ] - } - ], - "outputs": { - "REMOTERENDERING_ARR_ACCOUNT_ID": { - "type": "string", - "value": "[reference(variables('arrAccountName')).accountId]" - }, - "REMOTERENDERING_ARR_ACCOUNT_DOMAIN": { - "type": "string", - "value": "[reference(variables('arrAccountName')).accountDomain]" - }, - "REMOTERENDERING_ARR_ACCOUNT_KEY": { - "type": "string", - "value": "[listKeys(resourceId('Microsoft.MixedReality/remoteRenderingAccounts', variables('arrAccountName')), variables('arrApiVersion')).primaryKey]" - }, - "REMOTERENDERING_ARR_STORAGE_ACCOUNT_NAME": { - "type": "string", - "value": "[variables('storageAccountName')]" - }, - "REMOTERENDERING_ARR_STORAGE_ACCOUNT_KEY": { - "type": "string", - "value": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), variables('storageApiVersion')).keys[0].value]" - }, - "REMOTERENDERING_ARR_BLOB_CONTAINER_NAME": { - "type": "string", - "value": "[variables('blobContainerName')]" - }, - "REMOTERENDERING_ARR_SAS_TOKEN": { - "type": "string", - "value": "[listServiceSas(variables('storageAccountName'), variables('storageApiVersion'), variables('sasProperties')).serviceSasToken]" - }, - "REMOTERENDERING_ARR_SERVICE_ENDPOINT": { - "type": "string", - "value": "[concat('https://remoterendering.', parameters('location'), '.mixedreality.azure.com')]" - }, - "REMOTERENDERING_STORAGE_ENDPOINT_SUFFIX": { - "type": "string", - "value": "core.windows.net" - } - } -} diff --git a/sdk/remoterendering/tests.yml b/sdk/remoterendering/tests.yml deleted file mode 100644 index deb9a377c97f..000000000000 --- a/sdk/remoterendering/tests.yml +++ /dev/null @@ -1,11 +0,0 @@ -trigger: none - -extends: - template: /eng/pipelines/templates/stages/archetype-sdk-tests.yml - parameters: - ServiceDirectory: remoterendering - Location: westus2 - EnvVars: - TEST_MODE: 'RunLiveNoRecord' - AZURE_SKIP_LIVE_RECORDING: 'true' - AZURE_TEST_RUN_LIVE: 'true' diff --git a/shared_requirements.txt b/shared_requirements.txt index b5e1b85f184a..5ae6ee561a23 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -61,7 +61,6 @@ azure-nspkg azure-ai-nspkg azure-cognitiveservices-nspkg azure-mgmt-nspkg -azure-mixedreality-authentication azure-schemaregistry websocket-client avro