From 169c109c4c34a348df45338f4627be1c82e94363 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 5 Jan 2022 11:02:33 +0000 Subject: [PATCH] =?UTF-8?q?CodeGen=20from=20PR=2017052=20in=20Azure/azure-?= =?UTF-8?q?rest-api-specs=20added=20propertied=20to=20classicaccount=20whi?= =?UTF-8?q?ch=20contains=20the=20media=20services=20=E2=80=A6=20(#17052)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * added propertied to classicaccount which contains the media services inside of it * prettier --- .../azure-mgmt-videoindexer/CHANGELOG.md | 5 + .../azure-mgmt-videoindexer/LICENSE | 21 + .../azure-mgmt-videoindexer/MANIFEST.in | 6 + .../azure-mgmt-videoindexer/README.md | 30 + .../azure-mgmt-videoindexer/_meta.json | 11 + .../azure-mgmt-videoindexer/azure/__init__.py | 1 + .../azure/mgmt/__init__.py | 1 + .../azure/mgmt/videoindexer/__init__.py | 18 + .../azure/mgmt/videoindexer/_configuration.py | 68 ++ .../azure/mgmt/videoindexer/_metadata.json | 106 ++ .../azure/mgmt/videoindexer/_patch.py | 31 + .../azure/mgmt/videoindexer/_vendor.py | 27 + .../azure/mgmt/videoindexer/_version.py | 9 + .../videoindexer/_vi_management_client.py | 103 ++ .../azure/mgmt/videoindexer/aio/__init__.py | 15 + .../mgmt/videoindexer/aio/_configuration.py | 67 + .../azure/mgmt/videoindexer/aio/_patch.py | 31 + .../videoindexer/aio/_vi_management_client.py | 101 ++ .../videoindexer/aio/operations/__init__.py | 21 + .../aio/operations/_accounts_operations.py | 472 +++++++ .../_classic_accounts_operations.py | 100 ++ .../aio/operations/_generate_operations.py | 122 ++ .../aio/operations/_operations.py | 110 ++ .../_user_classic_accounts_operations.py | 119 ++ .../mgmt/videoindexer/models/__init__.py | 77 ++ .../mgmt/videoindexer/models/_models_py3.py | 1079 +++++++++++++++++ .../models/_vi_management_client_enums.py | 70 ++ .../mgmt/videoindexer/operations/__init__.py | 21 + .../operations/_accounts_operations.py | 736 +++++++++++ .../_classic_accounts_operations.py | 135 +++ .../operations/_generate_operations.py | 169 +++ .../videoindexer/operations/_operations.py | 135 +++ .../_user_classic_accounts_operations.py | 150 +++ .../azure/mgmt/videoindexer/py.typed | 1 + .../sdk_packaging.toml | 9 + .../azure-mgmt-videoindexer/setup.py | 72 ++ sdk/videoindexer/ci.yml | 33 + 37 files changed, 4282 insertions(+) create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/CHANGELOG.md create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/LICENSE create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/MANIFEST.in create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/README.md create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/_meta.json create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/azure/__init__.py create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/__init__.py create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/__init__.py create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/_configuration.py create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/_metadata.json create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/_patch.py create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/_vendor.py create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/_version.py create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/_vi_management_client.py create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/__init__.py create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/_configuration.py create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/_patch.py create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/_vi_management_client.py create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/operations/__init__.py create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/operations/_accounts_operations.py create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/operations/_classic_accounts_operations.py create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/operations/_generate_operations.py create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/operations/_operations.py create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/operations/_user_classic_accounts_operations.py create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/models/__init__.py create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/models/_models_py3.py create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/models/_vi_management_client_enums.py create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/operations/__init__.py create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/operations/_accounts_operations.py create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/operations/_classic_accounts_operations.py create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/operations/_generate_operations.py create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/operations/_operations.py create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/operations/_user_classic_accounts_operations.py create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/py.typed create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/sdk_packaging.toml create mode 100644 sdk/videoindexer/azure-mgmt-videoindexer/setup.py create mode 100644 sdk/videoindexer/ci.yml diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/CHANGELOG.md b/sdk/videoindexer/azure-mgmt-videoindexer/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/LICENSE b/sdk/videoindexer/azure-mgmt-videoindexer/LICENSE new file mode 100644 index 000000000000..b2f52a2bad4e --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/LICENSE @@ -0,0 +1,21 @@ +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/videoindexer/azure-mgmt-videoindexer/MANIFEST.in b/sdk/videoindexer/azure-mgmt-videoindexer/MANIFEST.in new file mode 100644 index 000000000000..2c31e8da0cb1 --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/MANIFEST.in @@ -0,0 +1,6 @@ +include _meta.json +recursive-include tests *.py *.yaml +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py +include LICENSE diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/README.md b/sdk/videoindexer/azure-mgmt-videoindexer/README.md new file mode 100644 index 000000000000..f2c870261090 --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/README.md @@ -0,0 +1,30 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService 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 [MyService 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. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-videoindexer%2FREADME.png) diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/_meta.json b/sdk/videoindexer/azure-mgmt-videoindexer/_meta.json new file mode 100644 index 000000000000..868fcae4b2a3 --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.7.2", + "use": [ + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" + ], + "commit": "abd1cc92a8b6138bfded6a987c03b974f326589f", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/vi/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "readme": "specification/vi/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/azure/__init__.py b/sdk/videoindexer/azure-mgmt-videoindexer/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/__init__.py b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/__init__.py b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/__init__.py new file mode 100644 index 000000000000..3ab9b5f63766 --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/__init__.py @@ -0,0 +1,18 @@ +# 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 ._vi_management_client import ViManagementClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['ViManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/_configuration.py b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/_configuration.py new file mode 100644 index 000000000000..17b656cc44ac --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/_configuration.py @@ -0,0 +1,68 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class ViManagementClientConfiguration(Configuration): + """Configuration for ViManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ViManagementClientConfiguration, self).__init__(**kwargs) + 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 = "2021-11-10-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-videoindexer/{}'.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/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/_metadata.json b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/_metadata.json new file mode 100644 index 000000000000..7c00cd94487a --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/_metadata.json @@ -0,0 +1,106 @@ +{ + "chosen_version": "2021-11-10-preview", + "total_api_version_list": ["2021-11-10-preview"], + "client": { + "name": "ViManagementClient", + "filename": "_vi_management_client", + "description": "Microsoft Azure Video Analyzer for Media.", + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, + "azure_arm": true, + "has_lro_operations": false, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ViManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ViManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=\"https://management.azure.com\", # type: str", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "operations": "Operations", + "accounts": "AccountsOperations", + "user_classic_accounts": "UserClassicAccountsOperations", + "classic_accounts": "ClassicAccountsOperations", + "generate": "GenerateOperations" + } +} \ No newline at end of file diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/_patch.py b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# 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. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/_vendor.py b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# 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.pipeline.transport import HttpRequest + +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) diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/_version.py b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/_version.py @@ -0,0 +1,9 @@ +# 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.0.0b1" diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/_vi_management_client.py b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/_vi_management_client.py new file mode 100644 index 000000000000..735974e91b3b --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/_vi_management_client.py @@ -0,0 +1,103 @@ +# 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, Optional, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +from . import models +from ._configuration import ViManagementClientConfiguration +from .operations import AccountsOperations, ClassicAccountsOperations, GenerateOperations, Operations, UserClassicAccountsOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + +class ViManagementClient: + """Microsoft Azure Video Analyzer for Media. + + :ivar operations: Operations operations + :vartype operations: vi_management_client.operations.Operations + :ivar accounts: AccountsOperations operations + :vartype accounts: vi_management_client.operations.AccountsOperations + :ivar user_classic_accounts: UserClassicAccountsOperations operations + :vartype user_classic_accounts: vi_management_client.operations.UserClassicAccountsOperations + :ivar classic_accounts: ClassicAccountsOperations operations + :vartype classic_accounts: vi_management_client.operations.ClassicAccountsOperations + :ivar generate: GenerateOperations operations + :vartype generate: vi_management_client.operations.GenerateOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ViManagementClientConfiguration(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.accounts = AccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.user_classic_accounts = UserClassicAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.classic_accounts = ClassicAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.generate = GenerateOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: 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/python/protocol/quickstart + + :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: () -> ViManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/__init__.py b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/__init__.py new file mode 100644 index 000000000000..ae57724f8f33 --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/__init__.py @@ -0,0 +1,15 @@ +# 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 ._vi_management_client import ViManagementClient +__all__ = ['ViManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/_configuration.py b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/_configuration.py new file mode 100644 index 000000000000..95ae8506910e --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/_configuration.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class ViManagementClientConfiguration(Configuration): + """Configuration for ViManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ViManagementClientConfiguration, self).__init__(**kwargs) + 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 = "2021-11-10-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-videoindexer/{}'.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/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/_patch.py b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# 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. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/_vi_management_client.py b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/_vi_management_client.py new file mode 100644 index 000000000000..aaa442f42183 --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/_vi_management_client.py @@ -0,0 +1,101 @@ +# 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, Optional, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +from .. import models +from ._configuration import ViManagementClientConfiguration +from .operations import AccountsOperations, ClassicAccountsOperations, GenerateOperations, Operations, UserClassicAccountsOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +class ViManagementClient: + """Microsoft Azure Video Analyzer for Media. + + :ivar operations: Operations operations + :vartype operations: vi_management_client.aio.operations.Operations + :ivar accounts: AccountsOperations operations + :vartype accounts: vi_management_client.aio.operations.AccountsOperations + :ivar user_classic_accounts: UserClassicAccountsOperations operations + :vartype user_classic_accounts: + vi_management_client.aio.operations.UserClassicAccountsOperations + :ivar classic_accounts: ClassicAccountsOperations operations + :vartype classic_accounts: vi_management_client.aio.operations.ClassicAccountsOperations + :ivar generate: GenerateOperations operations + :vartype generate: vi_management_client.aio.operations.GenerateOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ViManagementClientConfiguration(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.accounts = AccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.user_classic_accounts = UserClassicAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.classic_accounts = ClassicAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.generate = GenerateOperations(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/python/protocol/quickstart + + :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) -> "ViManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/operations/__init__.py b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/operations/__init__.py new file mode 100644 index 000000000000..c549fbd52417 --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/operations/__init__.py @@ -0,0 +1,21 @@ +# 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 ._accounts_operations import AccountsOperations +from ._user_classic_accounts_operations import UserClassicAccountsOperations +from ._classic_accounts_operations import ClassicAccountsOperations +from ._generate_operations import GenerateOperations + +__all__ = [ + 'Operations', + 'AccountsOperations', + 'UserClassicAccountsOperations', + 'ClassicAccountsOperations', + 'GenerateOperations', +] diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/operations/_accounts_operations.py b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/operations/_accounts_operations.py new file mode 100644 index 000000000000..76d9be78239e --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/operations/_accounts_operations.py @@ -0,0 +1,472 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._accounts_operations import build_check_name_availability_request, build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AccountsOperations: + """AccountsOperations 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: ~vi_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def check_name_availability( + self, + check_name_availability_parameters: "_models.AccountCheckNameAvailabilityParameters", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": + """Checks that the Video Indexer account name is valid and is not already in use. + + :param check_name_availability_parameters: The name of the Video Indexer account. Name must be + unique globally. + :type check_name_availability_parameters: + ~vi_management_client.models.AccountCheckNameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~vi_management_client.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(check_name_availability_parameters, 'AccountCheckNameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VideoIndexer/checkNameAvailability'} # type: ignore + + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.AccountList"]: + """List all Azure Video Analyzer for Media accounts available under the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AccountList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~vi_management_client.models.AccountList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccountList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AccountList", 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VideoIndexer/accounts'} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.AccountList"]: + """List all Azure Video Analyzer for Media accounts available under the resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :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 AccountList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~vi_management_client.models.AccountList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccountList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AccountList", 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VideoIndexer/accounts'} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.Account": + """Gets the properties of an Azure Video Analyzer for Media account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the Azure Video Analyzer for Media account. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Account, or the result of cls(response) + :rtype: ~vi_management_client.models.Account + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Account"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Account', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VideoIndexer/accounts/{accountName}'} # type: ignore + + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + account_name: str, + parameters: Optional["_models.AccountPatch"] = None, + **kwargs: Any + ) -> "_models.Account": + """Updates the properties of an existing Azure Video Analyzer for Media account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the Azure Video Analyzer for Media account. + :type account_name: str + :param parameters: The parameters to provide for the current Azure Video Analyzer for Media + account. + :type parameters: ~vi_management_client.models.AccountPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Account, or the result of cls(response) + :rtype: ~vi_management_client.models.Account + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Account"] + error_map = { + 401: ClientAuthenticationError, + 409: ResourceExistsError, + 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if parameters is not None: + _json = self._serialize.body(parameters, 'AccountPatch') + else: + _json = None + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Account', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VideoIndexer/accounts/{accountName}'} # type: ignore + + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + parameters: Optional["_models.Account"] = None, + **kwargs: Any + ) -> "_models.Account": + """Creates or updates an Azure Video Analyzer for Media account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the Azure Video Analyzer for Media account. + :type account_name: str + :param parameters: The parameters to provide for the Azure Video Analyzer for Media account. + :type parameters: ~vi_management_client.models.Account + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Account, or the result of cls(response) + :rtype: ~vi_management_client.models.Account + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Account"] + error_map = { + 401: ClientAuthenticationError, + 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if parameters is not None: + _json = self._serialize.body(parameters, 'Account') + else: + _json = None + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Account', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VideoIndexer/accounts/{accountName}'} # type: ignore + + + @distributed_trace_async + async def delete( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: + """Delete an Azure Video Analyzer for Media account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the Azure Video Analyzer for Media account. + :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 + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VideoIndexer/accounts/{accountName}'} # type: ignore + diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/operations/_classic_accounts_operations.py b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/operations/_classic_accounts_operations.py new file mode 100644 index 000000000000..c1f11bdf6aa4 --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/operations/_classic_accounts_operations.py @@ -0,0 +1,100 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._classic_accounts_operations import build_get_details_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ClassicAccountsOperations: + """ClassicAccountsOperations 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: ~vi_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get_details( + self, + location: str, + account_name: str, + **kwargs: Any + ) -> "_models.ClassicAccount": + """Gets the properties of an Azure Video Analyzer for Media Classic account. + + :param location: The name of Azure region. + :type location: str + :param account_name: The name of the Azure Video Analyzer for Media account. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ClassicAccount, or the result of cls(response) + :rtype: ~vi_management_client.models.ClassicAccount + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClassicAccount"] + error_map = { + 409: ResourceExistsError, + 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 401: lambda response: ClientAuthenticationError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_details_request( + location=location, + account_name=account_name, + template_url=self.get_details.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ClassicAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_details.metadata = {'url': '/providers/Microsoft.VideoIndexer/locations/{location}/classicAccounts/{accountName}'} # type: ignore + diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/operations/_generate_operations.py b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/operations/_generate_operations.py new file mode 100644 index 000000000000..0f7f4e27f106 --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/operations/_generate_operations.py @@ -0,0 +1,122 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._generate_operations import build_access_token_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class GenerateOperations: + """GenerateOperations 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: ~vi_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def access_token( + self, + resource_group_name: str, + account_name: str, + permission_type: Union[str, "_models.PermissionType"], + scope: Union[str, "_models.Scope"], + video_id: Optional[str] = None, + project_id: Optional[str] = None, + **kwargs: Any + ) -> "_models.AccessToken": + """Generate an Azure Video Analyzer for Media access token. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the Azure Video Analyzer for Media account. + :type account_name: str + :param permission_type: The requested permission. + :type permission_type: str or ~vi_management_client.models.PermissionType + :param scope: The requested media type. + :type scope: str or ~vi_management_client.models.Scope + :param video_id: The video ID. + :type video_id: str + :param project_id: The project ID. + :type project_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessToken, or the result of cls(response) + :rtype: ~vi_management_client.models.AccessToken + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessToken"] + error_map = { + 401: ClientAuthenticationError, + 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _parameters = _models.GenerateAccessTokenParameters(permission_type=permission_type, scope=scope, video_id=video_id, project_id=project_id) + if _parameters is not None: + _json = self._serialize.body(_parameters, 'GenerateAccessTokenParameters') + else: + _json = None + + request = build_access_token_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + content_type=content_type, + json=_json, + template_url=self.access_token.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessToken', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + access_token.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VideoIndexer/accounts/{accountName}/generateAccessToken'} # type: ignore + diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/operations/_operations.py b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/operations/_operations.py new file mode 100644 index 000000000000..e17cf2cfa388 --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/operations/_operations.py @@ -0,0 +1,110 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~vi_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.OperationListResult"]: + """Lists all of the available Azure Video Analyzer for Media provider operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~vi_management_client.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.VideoIndexer/operations'} # type: ignore diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/operations/_user_classic_accounts_operations.py b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/operations/_user_classic_accounts_operations.py new file mode 100644 index 000000000000..30ff6039ab1f --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/aio/operations/_user_classic_accounts_operations.py @@ -0,0 +1,119 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._user_classic_accounts_operations import build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class UserClassicAccountsOperations: + """UserClassicAccountsOperations 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: ~vi_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + location: str, + **kwargs: Any + ) -> AsyncIterable["_models.UserClassicAccountList"]: + """Lists all Azure Video Analyzer for Media classic accounts. + + :param location: The name of Azure region. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UserClassicAccountList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~vi_management_client.models.UserClassicAccountList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UserClassicAccountList"] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + location=location, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + location=location, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("UserClassicAccountList", 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.VideoIndexer/locations/{location}/userClassicAccounts'} # type: ignore diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/models/__init__.py b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/models/__init__.py new file mode 100644 index 000000000000..55d7df77e670 --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/models/__init__.py @@ -0,0 +1,77 @@ +# 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 AccessToken +from ._models_py3 import Account +from ._models_py3 import AccountCheckNameAvailabilityParameters +from ._models_py3 import AccountList +from ._models_py3 import AccountPatch +from ._models_py3 import CheckNameAvailabilityResult +from ._models_py3 import ClassicAccount +from ._models_py3 import ClassicAccountMediaServices +from ._models_py3 import ClassicAccountSlim +from ._models_py3 import ErrorDefinition +from ._models_py3 import ErrorResponse +from ._models_py3 import GenerateAccessTokenParameters +from ._models_py3 import ManagedServiceIdentity +from ._models_py3 import MediaServicesForPatchRequest +from ._models_py3 import MediaServicesForPutRequest +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import Resource +from ._models_py3 import SystemData +from ._models_py3 import Tags +from ._models_py3 import TrackedResource +from ._models_py3 import UserAssignedIdentity +from ._models_py3 import UserClassicAccountList + + +from ._vi_management_client_enums import ( + CreatedByType, + ManagedServiceIdentityType, + PermissionType, + ProvisioningState, + Reason, + Scope, + Type, +) + +__all__ = [ + 'AccessToken', + 'Account', + 'AccountCheckNameAvailabilityParameters', + 'AccountList', + 'AccountPatch', + 'CheckNameAvailabilityResult', + 'ClassicAccount', + 'ClassicAccountMediaServices', + 'ClassicAccountSlim', + 'ErrorDefinition', + 'ErrorResponse', + 'GenerateAccessTokenParameters', + 'ManagedServiceIdentity', + 'MediaServicesForPatchRequest', + 'MediaServicesForPutRequest', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'Resource', + 'SystemData', + 'Tags', + 'TrackedResource', + 'UserAssignedIdentity', + 'UserClassicAccountList', + 'CreatedByType', + 'ManagedServiceIdentityType', + 'PermissionType', + 'ProvisioningState', + 'Reason', + 'Scope', + 'Type', +] diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/models/_models_py3.py b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/models/_models_py3.py new file mode 100644 index 000000000000..a85940f7b608 --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/models/_models_py3.py @@ -0,0 +1,1079 @@ +# 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 Dict, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._vi_management_client_enums import * + + +class AccessToken(msrest.serialization.Model): + """Azure Video Analyzer for Media access token. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar access_token: The access token. + :vartype access_token: str + """ + + _validation = { + 'access_token': {'readonly': True}, + } + + _attribute_map = { + 'access_token': {'key': 'accessToken', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(AccessToken, self).__init__(**kwargs) + self.access_token = None + + +class Resource(msrest.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(Resource, self).__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: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :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: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ + super(TrackedResource, self).__init__(**kwargs) + self.tags = tags + self.location = location + + +class Account(TrackedResource): + """An Azure Video Analyzer for Media account. + + 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: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~vi_management_client.models.ManagedServiceIdentity + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~vi_management_client.models.SystemData + :ivar tenant_id: The account's tenant id. + :vartype tenant_id: str + :ivar account_id: The account's data-plane ID. + :vartype account_id: str + :ivar account_name: The account's name. + :vartype account_name: str + :ivar media_services: The media services details. + :vartype media_services: ~vi_management_client.models.MediaServicesForPutRequest + :ivar total_seconds_indexed: An integer representing the total seconds that have been indexed + on the account. + :vartype total_seconds_indexed: int + :ivar provisioning_state: Gets the status of the account at the time the operation was called. + Possible values include: "Succeeded", "Failed", "Canceled", "Accepted", "Provisioning", + "Deleting". + :vartype provisioning_state: str or ~vi_management_client.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'tenant_id': {'readonly': True}, + 'account_name': {'readonly': True}, + 'total_seconds_indexed': {'readonly': True}, + 'provisioning_state': {'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': 'ManagedServiceIdentity'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'account_id': {'key': 'properties.accountId', 'type': 'str'}, + 'account_name': {'key': 'properties.accountName', 'type': 'str'}, + 'media_services': {'key': 'properties.mediaServices', 'type': 'MediaServicesForPutRequest'}, + 'total_seconds_indexed': {'key': 'properties.totalSecondsIndexed', 'type': 'int'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional["ManagedServiceIdentity"] = None, + account_id: Optional[str] = None, + media_services: Optional["MediaServicesForPutRequest"] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~vi_management_client.models.ManagedServiceIdentity + :keyword account_id: The account's data-plane ID. + :paramtype account_id: str + :keyword media_services: The media services details. + :paramtype media_services: ~vi_management_client.models.MediaServicesForPutRequest + """ + super(Account, self).__init__(tags=tags, location=location, **kwargs) + self.identity = identity + self.system_data = None + self.tenant_id = None + self.account_id = account_id + self.account_name = None + self.media_services = media_services + self.total_seconds_indexed = None + self.provisioning_state = None + + +class AccountCheckNameAvailabilityParameters(msrest.serialization.Model): + """The parameters used to check the availability of the Video Indexer account name. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The VideoIndexer account name. + :vartype name: str + :ivar type: Required. The type of resource, Microsoft.VideoIndexer/accounts. Possible values + include: "Microsoft.VideoIndexer/accounts". + :vartype type: str or ~vi_management_client.models.Type + """ + + _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: Union[str, "Type"], + **kwargs + ): + """ + :keyword name: Required. The VideoIndexer account name. + :paramtype name: str + :keyword type: Required. The type of resource, Microsoft.VideoIndexer/accounts. Possible values + include: "Microsoft.VideoIndexer/accounts". + :paramtype type: str or ~vi_management_client.models.Type + """ + super(AccountCheckNameAvailabilityParameters, self).__init__(**kwargs) + self.name = name + self.type = type + + +class AccountList(msrest.serialization.Model): + """The list operation response, that contains the data pools and their properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of accounts and their properties. + :vartype value: list[~vi_management_client.models.Account] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Account]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ + super(AccountList, self).__init__(**kwargs) + self.value = None + self.next_link = next_link + + +class Tags(msrest.serialization.Model): + """Resource tags. + + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ + super(Tags, self).__init__(**kwargs) + self.tags = tags + + +class AccountPatch(Tags): + """Azure Video Analyzer for Media account. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~vi_management_client.models.ManagedServiceIdentity + :ivar tenant_id: The account's tenant id. + :vartype tenant_id: str + :ivar account_id: The account's data-plane ID. + :vartype account_id: str + :ivar media_services: The media services details. + :vartype media_services: ~vi_management_client.models.MediaServicesForPatchRequest + :ivar provisioning_state: Gets the status of the account at the time the operation was called. + Possible values include: "Succeeded", "Failed", "Canceled", "Accepted", "Provisioning", + "Deleting". + :vartype provisioning_state: str or ~vi_management_client.models.ProvisioningState + """ + + _validation = { + 'tenant_id': {'readonly': True}, + 'account_id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'account_id': {'key': 'properties.accountId', 'type': 'str'}, + 'media_services': {'key': 'properties.mediaServices', 'type': 'MediaServicesForPatchRequest'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["ManagedServiceIdentity"] = None, + media_services: Optional["MediaServicesForPatchRequest"] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~vi_management_client.models.ManagedServiceIdentity + :keyword media_services: The media services details. + :paramtype media_services: ~vi_management_client.models.MediaServicesForPatchRequest + """ + super(AccountPatch, self).__init__(tags=tags, **kwargs) + self.identity = identity + self.tenant_id = None + self.account_id = None + self.media_services = media_services + self.provisioning_state = None + + +class CheckNameAvailabilityResult(msrest.serialization.Model): + """The CheckNameAvailability operation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name_available: Gets a boolean value that indicates whether the name is available for you + to use. If true, the name is available. If false, the name has already been taken. + :vartype name_available: bool + :ivar reason: Gets the reason that a Video Indexer account name could not be used. The Reason + element is only returned if NameAvailable is false. Possible values include: "AlreadyExists". + :vartype reason: str or ~vi_management_client.models.Reason + :ivar message: Gets an error message explaining the Reason value in more detail. + :vartype message: str + """ + + _validation = { + 'name_available': {'readonly': True}, + 'reason': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(CheckNameAvailabilityResult, self).__init__(**kwargs) + self.name_available = None + self.reason = None + self.message = None + + +class ClassicAccount(msrest.serialization.Model): + """An Azure Video Analyzer for Media classic account. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The account's name. + :vartype name: str + :ivar location: The account's location. + :vartype location: str + :ivar media_services: The media services details. + :vartype media_services: ~vi_management_client.models.ClassicAccountMediaServices + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'media_services': {'key': 'properties.mediaServices', 'type': 'ClassicAccountMediaServices'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + media_services: Optional["ClassicAccountMediaServices"] = None, + **kwargs + ): + """ + :keyword location: The account's location. + :paramtype location: str + :keyword media_services: The media services details. + :paramtype media_services: ~vi_management_client.models.ClassicAccountMediaServices + """ + super(ClassicAccount, self).__init__(**kwargs) + self.name = None + self.location = location + self.media_services = media_services + + +class ClassicAccountMediaServices(msrest.serialization.Model): + """Azure Video Analyzer for Media classic account properties. + + :ivar aad_application_id: The aad application id. + :vartype aad_application_id: str + :ivar aad_tenant_id: The aad tenant id. + :vartype aad_tenant_id: str + :ivar connected: Represents wether the media services is connected or not. + :vartype connected: bool + :ivar event_grid_provider_registered: Represents if the media services event grid is connected + or not. + :vartype event_grid_provider_registered: bool + :ivar name: The media services name. + :vartype name: str + :ivar resource_group: The resource group that the media services belong to. + :vartype resource_group: str + :ivar streaming_endpoint_started: Represents wether the media services streaming endpoint has + started. + :vartype streaming_endpoint_started: bool + :ivar subscription_id: The media services subscriptionId. + :vartype subscription_id: str + """ + + _attribute_map = { + 'aad_application_id': {'key': 'aadApplicationId', 'type': 'str'}, + 'aad_tenant_id': {'key': 'aadTenantId', 'type': 'str'}, + 'connected': {'key': 'connected', 'type': 'bool'}, + 'event_grid_provider_registered': {'key': 'eventGridProviderRegistered', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + 'streaming_endpoint_started': {'key': 'streamingEndpointStarted', 'type': 'bool'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + } + + def __init__( + self, + *, + aad_application_id: Optional[str] = None, + aad_tenant_id: Optional[str] = None, + connected: Optional[bool] = None, + event_grid_provider_registered: Optional[bool] = None, + name: Optional[str] = None, + resource_group: Optional[str] = None, + streaming_endpoint_started: Optional[bool] = None, + subscription_id: Optional[str] = None, + **kwargs + ): + """ + :keyword aad_application_id: The aad application id. + :paramtype aad_application_id: str + :keyword aad_tenant_id: The aad tenant id. + :paramtype aad_tenant_id: str + :keyword connected: Represents wether the media services is connected or not. + :paramtype connected: bool + :keyword event_grid_provider_registered: Represents if the media services event grid is + connected or not. + :paramtype event_grid_provider_registered: bool + :keyword name: The media services name. + :paramtype name: str + :keyword resource_group: The resource group that the media services belong to. + :paramtype resource_group: str + :keyword streaming_endpoint_started: Represents wether the media services streaming endpoint + has started. + :paramtype streaming_endpoint_started: bool + :keyword subscription_id: The media services subscriptionId. + :paramtype subscription_id: str + """ + super(ClassicAccountMediaServices, self).__init__(**kwargs) + self.aad_application_id = aad_application_id + self.aad_tenant_id = aad_tenant_id + self.connected = connected + self.event_grid_provider_registered = event_grid_provider_registered + self.name = name + self.resource_group = resource_group + self.streaming_endpoint_started = streaming_endpoint_started + self.subscription_id = subscription_id + + +class ClassicAccountSlim(msrest.serialization.Model): + """An Azure Video Analyzer for Media classic account. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The account's name. + :vartype name: str + :ivar location: The account's location. + :vartype location: str + """ + + _validation = { + 'name': {'readonly': True}, + 'location': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ClassicAccountSlim, self).__init__(**kwargs) + self.name = None + self.location = None + + +class ErrorDefinition(msrest.serialization.Model): + """Error definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Service specific error code which serves as the substatus for the HTTP error code. + :vartype code: str + :ivar message: Description of the error. + :vartype message: str + :ivar details: Internal error details. + :vartype details: list[~vi_management_client.models.ErrorDefinition] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'details': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDefinition]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ErrorDefinition, self).__init__(**kwargs) + self.code = None + self.message = None + self.details = None + + +class ErrorResponse(msrest.serialization.Model): + """Error response. + + :ivar error: The error details. + :vartype error: ~vi_management_client.models.ErrorDefinition + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDefinition"] = None, + **kwargs + ): + """ + :keyword error: The error details. + :paramtype error: ~vi_management_client.models.ErrorDefinition + """ + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class GenerateAccessTokenParameters(msrest.serialization.Model): + """Access token generation request's parameters. + + All required parameters must be populated in order to send to Azure. + + :ivar permission_type: Required. The requested permission. Possible values include: + "Contributor", "Reader". + :vartype permission_type: str or ~vi_management_client.models.PermissionType + :ivar scope: Required. The requested media type. Possible values include: "Video", "Account", + "Project". + :vartype scope: str or ~vi_management_client.models.Scope + :ivar video_id: The video ID. + :vartype video_id: str + :ivar project_id: The project ID. + :vartype project_id: str + """ + + _validation = { + 'permission_type': {'required': True}, + 'scope': {'required': True}, + } + + _attribute_map = { + 'permission_type': {'key': 'permissionType', 'type': 'str'}, + 'scope': {'key': 'scope', 'type': 'str'}, + 'video_id': {'key': 'videoId', 'type': 'str'}, + 'project_id': {'key': 'projectId', 'type': 'str'}, + } + + def __init__( + self, + *, + permission_type: Union[str, "PermissionType"], + scope: Union[str, "Scope"], + video_id: Optional[str] = None, + project_id: Optional[str] = None, + **kwargs + ): + """ + :keyword permission_type: Required. The requested permission. Possible values include: + "Contributor", "Reader". + :paramtype permission_type: str or ~vi_management_client.models.PermissionType + :keyword scope: Required. The requested media type. Possible values include: "Video", + "Account", "Project". + :paramtype scope: str or ~vi_management_client.models.Scope + :keyword video_id: The video ID. + :paramtype video_id: str + :keyword project_id: The project ID. + :paramtype project_id: str + """ + super(GenerateAccessTokenParameters, self).__init__(**kwargs) + self.permission_type = permission_type + self.scope = scope + self.video_id = video_id + self.project_id = project_id + + +class ManagedServiceIdentity(msrest.serialization.Model): + """Managed service identity (system assigned and/or user assigned identities). + + 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 principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: Required. Type of managed service identity (where both SystemAssigned and + UserAssigned types are allowed). Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :vartype type: str or ~vi_management_client.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :vartype user_assigned_identities: dict[str, ~vi_management_client.models.UserAssignedIdentity] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentity}'}, + } + + def __init__( + self, + *, + type: Union[str, "ManagedServiceIdentityType"], + user_assigned_identities: Optional[Dict[str, "UserAssignedIdentity"]] = None, + **kwargs + ): + """ + :keyword type: Required. Type of managed service identity (where both SystemAssigned and + UserAssigned types are allowed). Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :paramtype type: str or ~vi_management_client.models.ManagedServiceIdentityType + :keyword user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :paramtype user_assigned_identities: dict[str, + ~vi_management_client.models.UserAssignedIdentity] + """ + super(ManagedServiceIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class MediaServicesForPatchRequest(msrest.serialization.Model): + """The media services details. + + :ivar user_assigned_identity: The user assigned identity to be used to grant permissions. + :vartype user_assigned_identity: str + """ + + _attribute_map = { + 'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, + } + + def __init__( + self, + *, + user_assigned_identity: Optional[str] = None, + **kwargs + ): + """ + :keyword user_assigned_identity: The user assigned identity to be used to grant permissions. + :paramtype user_assigned_identity: str + """ + super(MediaServicesForPatchRequest, self).__init__(**kwargs) + self.user_assigned_identity = user_assigned_identity + + +class MediaServicesForPutRequest(msrest.serialization.Model): + """The media services details. + + :ivar resource_id: The media services resource id. + :vartype resource_id: str + :ivar user_assigned_identity: The user assigned identity to be used to grant permissions. + :vartype user_assigned_identity: str + """ + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, + } + + def __init__( + self, + *, + resource_id: Optional[str] = None, + user_assigned_identity: Optional[str] = None, + **kwargs + ): + """ + :keyword resource_id: The media services resource id. + :paramtype resource_id: str + :keyword user_assigned_identity: The user assigned identity to be used to grant permissions. + :paramtype user_assigned_identity: str + """ + super(MediaServicesForPutRequest, self).__init__(**kwargs) + self.resource_id = resource_id + self.user_assigned_identity = user_assigned_identity + + +class Operation(msrest.serialization.Model): + """Operation detail payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the operation. + :vartype name: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar action_type: Indicates the action type. + :vartype action_type: str + :ivar display: Display of the operation. + :vartype display: ~vi_management_client.models.OperationDisplay + :ivar origin: Origin of the operation. + :vartype origin: str + """ + + _validation = { + 'name': {'readonly': True}, + 'is_data_action': {'readonly': True}, + 'action_type': {'readonly': True}, + 'display': {'readonly': True}, + 'origin': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(Operation, self).__init__(**kwargs) + self.name = None + self.is_data_action = None + self.action_type = None + self.display = None + self.origin = None + + +class OperationDisplay(msrest.serialization.Model): + """Operation display payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Resource provider of the operation. + :vartype provider: str + :ivar resource: Resource of the operation. + :vartype resource: str + :ivar operation: Localized friendly name for the operation. + :vartype operation: str + :ivar description: Localized friendly description for the operation. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': 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, + **kwargs + ): + """ + """ + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +class OperationListResult(msrest.serialization.Model): + """Available operations of the service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of operations supported by the Resource Provider. + :vartype value: list[~vi_management_client.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class SystemData(msrest.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. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~vi_management_client.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. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :vartype last_modified_by_type: str or ~vi_management_client.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, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "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. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~vi_management_client.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. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~vi_management_client.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super(SystemData, self).__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 + + +class UserAssignedIdentity(msrest.serialization.Model): + """User assigned identity properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of the assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(UserAssignedIdentity, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class UserClassicAccountList(msrest.serialization.Model): + """The list of user classic accounts. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of classic account names and their location. + :vartype value: list[~vi_management_client.models.ClassicAccountSlim] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ClassicAccountSlim]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ + super(UserClassicAccountList, self).__init__(**kwargs) + self.value = None + self.next_link = next_link diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/models/_vi_management_client_enums.py b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/models/_vi_management_client_enums.py new file mode 100644 index 000000000000..e9fe12d9f62f --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/models/_vi_management_client_enums.py @@ -0,0 +1,70 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum +from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta + + +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class ManagedServiceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Type of managed service identity (where both SystemAssigned and UserAssigned types are + allowed). + """ + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" + +class PermissionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The requested permission + """ + + CONTRIBUTOR = "Contributor" + READER = "Reader" + +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Gets the status of the account at the time the operation was called. + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + ACCEPTED = "Accepted" + PROVISIONING = "Provisioning" + DELETING = "Deleting" + +class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Gets the reason that a Video Indexer account name could not be used. The Reason element is only + returned if NameAvailable is false. + """ + + ALREADY_EXISTS = "AlreadyExists" + +class Scope(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The requested media type + """ + + VIDEO = "Video" + ACCOUNT = "Account" + PROJECT = "Project" + +class Type(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of resource, Microsoft.VideoIndexer/accounts + """ + + MICROSOFT_VIDEO_INDEXER_ACCOUNTS = "Microsoft.VideoIndexer/accounts" diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/operations/__init__.py b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/operations/__init__.py new file mode 100644 index 000000000000..c549fbd52417 --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/operations/__init__.py @@ -0,0 +1,21 @@ +# 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 ._accounts_operations import AccountsOperations +from ._user_classic_accounts_operations import UserClassicAccountsOperations +from ._classic_accounts_operations import ClassicAccountsOperations +from ._generate_operations import GenerateOperations + +__all__ = [ + 'Operations', + 'AccountsOperations', + 'UserClassicAccountsOperations', + 'ClassicAccountsOperations', + 'GenerateOperations', +] diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/operations/_accounts_operations.py b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/operations/_accounts_operations.py new file mode 100644 index 000000000000..2c71c77f0f84 --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/operations/_accounts_operations.py @@ -0,0 +1,736 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_check_name_availability_request( + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-11-10-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.VideoIndexer/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-10-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.VideoIndexer/accounts') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-10-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VideoIndexer/accounts') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-10-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VideoIndexer/accounts/{accountName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-11-10-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VideoIndexer/accounts/{accountName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-11-10-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VideoIndexer/accounts/{accountName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-10-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VideoIndexer/accounts/{accountName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class AccountsOperations(object): + """AccountsOperations 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: ~vi_management_client.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 + + @distributed_trace + def check_name_availability( + self, + check_name_availability_parameters: "_models.AccountCheckNameAvailabilityParameters", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": + """Checks that the Video Indexer account name is valid and is not already in use. + + :param check_name_availability_parameters: The name of the Video Indexer account. Name must be + unique globally. + :type check_name_availability_parameters: + ~vi_management_client.models.AccountCheckNameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~vi_management_client.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(check_name_availability_parameters, 'AccountCheckNameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VideoIndexer/checkNameAvailability'} # type: ignore + + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable["_models.AccountList"]: + """List all Azure Video Analyzer for Media accounts available under the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AccountList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~vi_management_client.models.AccountList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccountList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AccountList", 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.VideoIndexer/accounts'} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.AccountList"]: + """List all Azure Video Analyzer for Media accounts available under the resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :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 AccountList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~vi_management_client.models.AccountList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccountList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AccountList", 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VideoIndexer/accounts'} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.Account": + """Gets the properties of an Azure Video Analyzer for Media account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the Azure Video Analyzer for Media account. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Account, or the result of cls(response) + :rtype: ~vi_management_client.models.Account + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Account"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Account', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VideoIndexer/accounts/{accountName}'} # type: ignore + + + @distributed_trace + def update( + self, + resource_group_name: str, + account_name: str, + parameters: Optional["_models.AccountPatch"] = None, + **kwargs: Any + ) -> "_models.Account": + """Updates the properties of an existing Azure Video Analyzer for Media account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the Azure Video Analyzer for Media account. + :type account_name: str + :param parameters: The parameters to provide for the current Azure Video Analyzer for Media + account. + :type parameters: ~vi_management_client.models.AccountPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Account, or the result of cls(response) + :rtype: ~vi_management_client.models.Account + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Account"] + error_map = { + 401: ClientAuthenticationError, + 409: ResourceExistsError, + 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if parameters is not None: + _json = self._serialize.body(parameters, 'AccountPatch') + else: + _json = None + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Account', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VideoIndexer/accounts/{accountName}'} # type: ignore + + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + account_name: str, + parameters: Optional["_models.Account"] = None, + **kwargs: Any + ) -> "_models.Account": + """Creates or updates an Azure Video Analyzer for Media account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the Azure Video Analyzer for Media account. + :type account_name: str + :param parameters: The parameters to provide for the Azure Video Analyzer for Media account. + :type parameters: ~vi_management_client.models.Account + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Account, or the result of cls(response) + :rtype: ~vi_management_client.models.Account + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Account"] + error_map = { + 401: ClientAuthenticationError, + 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if parameters is not None: + _json = self._serialize.body(parameters, 'Account') + else: + _json = None + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Account', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VideoIndexer/accounts/{accountName}'} # type: ignore + + + @distributed_trace + def delete( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: + """Delete an Azure Video Analyzer for Media account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the Azure Video Analyzer for Media account. + :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 + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VideoIndexer/accounts/{accountName}'} # type: ignore + diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/operations/_classic_accounts_operations.py b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/operations/_classic_accounts_operations.py new file mode 100644 index 000000000000..da051bd105cd --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/operations/_classic_accounts_operations.py @@ -0,0 +1,135 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_details_request( + location: str, + account_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-10-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.VideoIndexer/locations/{location}/classicAccounts/{accountName}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', min_length=1), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class ClassicAccountsOperations(object): + """ClassicAccountsOperations 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: ~vi_management_client.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 + + @distributed_trace + def get_details( + self, + location: str, + account_name: str, + **kwargs: Any + ) -> "_models.ClassicAccount": + """Gets the properties of an Azure Video Analyzer for Media Classic account. + + :param location: The name of Azure region. + :type location: str + :param account_name: The name of the Azure Video Analyzer for Media account. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ClassicAccount, or the result of cls(response) + :rtype: ~vi_management_client.models.ClassicAccount + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClassicAccount"] + error_map = { + 409: ResourceExistsError, + 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 401: lambda response: ClientAuthenticationError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_details_request( + location=location, + account_name=account_name, + template_url=self.get_details.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ClassicAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_details.metadata = {'url': '/providers/Microsoft.VideoIndexer/locations/{location}/classicAccounts/{accountName}'} # type: ignore + diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/operations/_generate_operations.py b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/operations/_generate_operations.py new file mode 100644 index 000000000000..43f52a8fe1a1 --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/operations/_generate_operations.py @@ -0,0 +1,169 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +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 HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_access_token_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-11-10-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VideoIndexer/accounts/{accountName}/generateAccessToken') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "accountName": _SERIALIZER.url("account_name", account_name, 'str', max_length=50, min_length=0, pattern=r'^[a-z0-9]+(-[a-z0-9]+)*'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + +class GenerateOperations(object): + """GenerateOperations 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: ~vi_management_client.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 + + @distributed_trace + def access_token( + self, + resource_group_name: str, + account_name: str, + permission_type: Union[str, "_models.PermissionType"], + scope: Union[str, "_models.Scope"], + video_id: Optional[str] = None, + project_id: Optional[str] = None, + **kwargs: Any + ) -> "_models.AccessToken": + """Generate an Azure Video Analyzer for Media access token. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the Azure Video Analyzer for Media account. + :type account_name: str + :param permission_type: The requested permission. + :type permission_type: str or ~vi_management_client.models.PermissionType + :param scope: The requested media type. + :type scope: str or ~vi_management_client.models.Scope + :param video_id: The video ID. + :type video_id: str + :param project_id: The project ID. + :type project_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessToken, or the result of cls(response) + :rtype: ~vi_management_client.models.AccessToken + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessToken"] + error_map = { + 401: ClientAuthenticationError, + 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _parameters = _models.GenerateAccessTokenParameters(permission_type=permission_type, scope=scope, video_id=video_id, project_id=project_id) + if _parameters is not None: + _json = self._serialize.body(_parameters, 'GenerateAccessTokenParameters') + else: + _json = None + + request = build_access_token_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + content_type=content_type, + json=_json, + template_url=self.access_token.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessToken', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + access_token.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VideoIndexer/accounts/{accountName}/generateAccessToken'} # type: ignore + diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/operations/_operations.py b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/operations/_operations.py new file mode 100644 index 000000000000..a5e040c4daf2 --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/operations/_operations.py @@ -0,0 +1,135 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request +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: + api_version = "2021-11-10-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.VideoIndexer/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class Operations(object): + """Operations 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: ~vi_management_client.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 + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: + """Lists all of the available Azure Video Analyzer for Media provider operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~vi_management_client.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.VideoIndexer/operations'} # type: ignore diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/operations/_user_classic_accounts_operations.py b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/operations/_user_classic_accounts_operations.py new file mode 100644 index 000000000000..e9285e566260 --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/operations/_user_classic_accounts_operations.py @@ -0,0 +1,150 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +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( + location: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-10-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.VideoIndexer/locations/{location}/userClassicAccounts') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class UserClassicAccountsOperations(object): + """UserClassicAccountsOperations 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: ~vi_management_client.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 + + @distributed_trace + def list( + self, + location: str, + **kwargs: Any + ) -> Iterable["_models.UserClassicAccountList"]: + """Lists all Azure Video Analyzer for Media classic accounts. + + :param location: The name of Azure region. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UserClassicAccountList or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~vi_management_client.models.UserClassicAccountList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UserClassicAccountList"] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + location=location, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + location=location, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("UserClassicAccountList", 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(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.VideoIndexer/locations/{location}/userClassicAccounts'} # type: ignore diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/py.typed b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/azure/mgmt/videoindexer/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/sdk_packaging.toml b/sdk/videoindexer/azure-mgmt-videoindexer/sdk_packaging.toml new file mode 100644 index 000000000000..c0ba23ed283f --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +package_name = "azure-mgmt-videoindexer" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true diff --git a/sdk/videoindexer/azure-mgmt-videoindexer/setup.py b/sdk/videoindexer/azure-mgmt-videoindexer/setup.py new file mode 100644 index 000000000000..394d44f146be --- /dev/null +++ b/sdk/videoindexer/azure-mgmt-videoindexer/setup.py @@ -0,0 +1,72 @@ +#!/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-videoindexer" +PACKAGE_PPRINT_NAME = "MyService 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', + 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', + ]), + install_requires=[ + 'msrest>=0.6.21', + 'azure-common~=1.1', + 'azure-mgmt-core>=1.3.0,<2.0.0', + ], + python_requires=">=3.7" +) diff --git a/sdk/videoindexer/ci.yml b/sdk/videoindexer/ci.yml new file mode 100644 index 000000000000..83bfc7487081 --- /dev/null +++ b/sdk/videoindexer/ci.yml @@ -0,0 +1,33 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/videoindexer/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/videoindexer/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: videoindexer + Artifacts: + - name: azure-mgmt-videoindexer + safeName: azuremgmtvideoindexer