From 07987062b019b77a6218c3dc10a391284a0f3a30 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 5 Jan 2022 11:34:29 +0000 Subject: [PATCH] CodeGen from PR 17080 in Azure/azure-rest-api-specs videoanalyzer-readme-update (#17080) --- .../azure-mgmt-videoanalyzer/_meta.json | 10 +- .../azure/mgmt/videoanalyzer/__init__.py | 13 +- .../mgmt/videoanalyzer/_configuration.py | 23 +- .../azure/mgmt/videoanalyzer/_metadata.json | 25 +- .../azure/mgmt/videoanalyzer/_patch.py | 31 + .../azure/mgmt/videoanalyzer/_vendor.py | 27 + .../azure/mgmt/videoanalyzer/_version.py | 2 +- .../_video_analyzer_management_client.py | 150 ++ .../azure/mgmt/videoanalyzer/aio/__init__.py | 9 +- .../mgmt/videoanalyzer/aio/_configuration.py | 10 +- .../azure/mgmt/videoanalyzer/aio/_patch.py | 31 + .../aio/_video_analyzer_management_client.py | 150 ++ .../operations/_access_policies_operations.py | 235 +- .../operations/_edge_modules_operations.py | 235 +- ..._pipeline_operation_statuses_operations.py | 49 +- .../operations/_live_pipelines_operations.py | 355 ++- .../aio/operations/_locations_operations.py | 53 +- .../_operation_results_operations.py | 49 +- .../_operation_statuses_operations.py | 50 +- .../aio/operations/_operations.py | 36 +- ...eline_job_operation_statuses_operations.py | 49 +- .../operations/_pipeline_jobs_operations.py | 297 ++- .../_pipeline_topologies_operations.py | 239 +- ...private_endpoint_connections_operations.py | 164 +- .../_private_link_resources_operations.py | 82 +- ...o_analyzer_operation_results_operations.py | 45 +- ..._analyzer_operation_statuses_operations.py | 45 +- .../operations/_video_analyzers_operations.py | 295 ++- .../aio/operations/_videos_operations.py | 272 +-- .../mgmt/videoanalyzer/models/__init__.py | 317 +-- .../mgmt/videoanalyzer/models/_models_py3.py | 1994 ++++++++++++----- ..._video_analyzer_management_client_enums.py | 285 +++ .../operations/_access_policies_operations.py | 511 +++-- .../operations/_edge_modules_operations.py | 511 +++-- ..._pipeline_operation_statuses_operations.py | 113 +- .../operations/_live_pipelines_operations.py | 754 ++++--- .../operations/_locations_operations.py | 117 +- .../_operation_results_operations.py | 113 +- .../_operation_statuses_operations.py | 114 +- .../videoanalyzer/operations/_operations.py | 78 +- ...eline_job_operation_statuses_operations.py | 113 +- .../operations/_pipeline_jobs_operations.py | 637 ++++-- .../_pipeline_topologies_operations.py | 520 +++-- ...private_endpoint_connections_operations.py | 376 ++-- .../_private_link_resources_operations.py | 186 +- ...o_analyzer_operation_results_operations.py | 101 +- ..._analyzer_operation_statuses_operations.py | 101 +- .../operations/_video_analyzers_operations.py | 602 +++-- .../operations/_videos_operations.py | 596 +++-- 49 files changed, 7036 insertions(+), 4134 deletions(-) create mode 100644 sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/_patch.py create mode 100644 sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/_vendor.py create mode 100644 sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/_video_analyzer_management_client.py create mode 100644 sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/_patch.py create mode 100644 sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/_video_analyzer_management_client.py create mode 100644 sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/models/_video_analyzer_management_client_enums.py diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/_meta.json b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/_meta.json index 4b1621a97952f..dc70b738864d8 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/_meta.json +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.5", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.4", - "@autorest/modelerfour@4.19.2" + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "6959ec51046a91ffe26627ba8df2ead27c5ffd46", + "commit": "74827a5df713d16f2ed179bb7b7d94ce2b439ce0", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/videoanalyzer/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "autorest_command": "autorest specification/videoanalyzer/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/videoanalyzer/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/__init__.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/__init__.py index 462679904b97e..026bb499fdb1b 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/__init__.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/__init__.py @@ -6,14 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._video_analyzer import VideoAnalyzer +from ._video_analyzer_management_client import VideoAnalyzerManagementClient from ._version import VERSION __version__ = VERSION -__all__ = ['VideoAnalyzer'] +__all__ = ['VideoAnalyzerManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._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/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/_configuration.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/_configuration.py index 2bab80227252d..09d47daa54036 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/_configuration.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/_configuration.py @@ -6,23 +6,21 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential -class VideoAnalyzerConfiguration(Configuration): - """Configuration for VideoAnalyzer. +class VideoAnalyzerManagementClientConfiguration(Configuration): + """Configuration for VideoAnalyzerManagementClient. Note that all parameters used to create this instance are saved as instance attributes. @@ -35,16 +33,15 @@ class VideoAnalyzerConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(VideoAnalyzerManagementClientConfiguration, 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.") - super(VideoAnalyzerConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/_metadata.json b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/_metadata.json index f0468762497e6..dcaf27196f07c 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/_metadata.json +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/_metadata.json @@ -2,16 +2,16 @@ "chosen_version": "2021-11-01-preview", "total_api_version_list": ["2021-11-01-preview"], "client": { - "name": "VideoAnalyzer", - "filename": "_video_analyzer", + "name": "VideoAnalyzerManagementClient", + "filename": "_video_analyzer_management_client", "description": "Azure Video Analyzer provides a platform for you to build intelligent video applications that span the edge and the cloud.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "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\": [\"VideoAnalyzerConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"VideoAnalyzerConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "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\": [\"VideoAnalyzerManagementClientConfiguration\"]}}, \"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\": [\"VideoAnalyzerManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "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": { "edge_modules": "EdgeModulesOperations", diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/_patch.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/_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/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/_vendor.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/_vendor.py new file mode 100644 index 0000000000000..138f663c53a4e --- /dev/null +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/_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/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/_version.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/_version.py index 20971492f1291..e5754a47ce68f 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/_version.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b3" +VERSION = "1.0.0b1" diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/_video_analyzer_management_client.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/_video_analyzer_management_client.py new file mode 100644 index 0000000000000..ddfed5b6dcadd --- /dev/null +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/_video_analyzer_management_client.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. +# -------------------------------------------------------------------------- + +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 VideoAnalyzerManagementClientConfiguration +from .operations import AccessPoliciesOperations, EdgeModulesOperations, LivePipelineOperationStatusesOperations, LivePipelinesOperations, LocationsOperations, OperationResultsOperations, OperationStatusesOperations, Operations, PipelineJobOperationStatusesOperations, PipelineJobsOperations, PipelineTopologiesOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, VideoAnalyzerOperationResultsOperations, VideoAnalyzerOperationStatusesOperations, VideoAnalyzersOperations, VideosOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + +class VideoAnalyzerManagementClient: + """Azure Video Analyzer provides a platform for you to build intelligent video applications that span the edge and the cloud. + + :ivar edge_modules: EdgeModulesOperations operations + :vartype edge_modules: video_analyzer_management_client.operations.EdgeModulesOperations + :ivar pipeline_topologies: PipelineTopologiesOperations operations + :vartype pipeline_topologies: + video_analyzer_management_client.operations.PipelineTopologiesOperations + :ivar live_pipelines: LivePipelinesOperations operations + :vartype live_pipelines: video_analyzer_management_client.operations.LivePipelinesOperations + :ivar pipeline_jobs: PipelineJobsOperations operations + :vartype pipeline_jobs: video_analyzer_management_client.operations.PipelineJobsOperations + :ivar live_pipeline_operation_statuses: LivePipelineOperationStatusesOperations operations + :vartype live_pipeline_operation_statuses: + video_analyzer_management_client.operations.LivePipelineOperationStatusesOperations + :ivar pipeline_job_operation_statuses: PipelineJobOperationStatusesOperations operations + :vartype pipeline_job_operation_statuses: + video_analyzer_management_client.operations.PipelineJobOperationStatusesOperations + :ivar operations: Operations operations + :vartype operations: video_analyzer_management_client.operations.Operations + :ivar video_analyzers: VideoAnalyzersOperations operations + :vartype video_analyzers: video_analyzer_management_client.operations.VideoAnalyzersOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: + video_analyzer_management_client.operations.PrivateLinkResourcesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + video_analyzer_management_client.operations.PrivateEndpointConnectionsOperations + :ivar operation_statuses: OperationStatusesOperations operations + :vartype operation_statuses: + video_analyzer_management_client.operations.OperationStatusesOperations + :ivar operation_results: OperationResultsOperations operations + :vartype operation_results: + video_analyzer_management_client.operations.OperationResultsOperations + :ivar video_analyzer_operation_statuses: VideoAnalyzerOperationStatusesOperations operations + :vartype video_analyzer_operation_statuses: + video_analyzer_management_client.operations.VideoAnalyzerOperationStatusesOperations + :ivar video_analyzer_operation_results: VideoAnalyzerOperationResultsOperations operations + :vartype video_analyzer_operation_results: + video_analyzer_management_client.operations.VideoAnalyzerOperationResultsOperations + :ivar locations: LocationsOperations operations + :vartype locations: video_analyzer_management_client.operations.LocationsOperations + :ivar videos: VideosOperations operations + :vartype videos: video_analyzer_management_client.operations.VideosOperations + :ivar access_policies: AccessPoliciesOperations operations + :vartype access_policies: video_analyzer_management_client.operations.AccessPoliciesOperations + :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 + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = VideoAnalyzerManagementClientConfiguration(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.edge_modules = EdgeModulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.pipeline_topologies = PipelineTopologiesOperations(self._client, self._config, self._serialize, self._deserialize) + self.live_pipelines = LivePipelinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.pipeline_jobs = PipelineJobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.live_pipeline_operation_statuses = LivePipelineOperationStatusesOperations(self._client, self._config, self._serialize, self._deserialize) + self.pipeline_job_operation_statuses = PipelineJobOperationStatusesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.video_analyzers = VideoAnalyzersOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_statuses = OperationStatusesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_results = OperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.video_analyzer_operation_statuses = VideoAnalyzerOperationStatusesOperations(self._client, self._config, self._serialize, self._deserialize) + self.video_analyzer_operation_results = VideoAnalyzerOperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.videos = VideosOperations(self._client, self._config, self._serialize, self._deserialize) + self.access_policies = AccessPoliciesOperations(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: () -> VideoAnalyzerManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/__init__.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/__init__.py index 155fee12a2421..3c153d4bc16fa 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/__init__.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/__init__.py @@ -6,5 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._video_analyzer import VideoAnalyzer -__all__ = ['VideoAnalyzer'] +from ._video_analyzer_management_client import VideoAnalyzerManagementClient +__all__ = ['VideoAnalyzerManagementClient'] + +# `._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/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/_configuration.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/_configuration.py index 38c602c95f7f2..3092258a61c92 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/_configuration.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -19,8 +19,8 @@ from azure.core.credentials_async import AsyncTokenCredential -class VideoAnalyzerConfiguration(Configuration): - """Configuration for VideoAnalyzer. +class VideoAnalyzerManagementClientConfiguration(Configuration): + """Configuration for VideoAnalyzerManagementClient. Note that all parameters used to create this instance are saved as instance attributes. @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(VideoAnalyzerManagementClientConfiguration, 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.") - super(VideoAnalyzerConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/_patch.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/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/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/_video_analyzer_management_client.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/_video_analyzer_management_client.py new file mode 100644 index 0000000000000..ef7d8f4e96175 --- /dev/null +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/_video_analyzer_management_client.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. +# -------------------------------------------------------------------------- + +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 VideoAnalyzerManagementClientConfiguration +from .operations import AccessPoliciesOperations, EdgeModulesOperations, LivePipelineOperationStatusesOperations, LivePipelinesOperations, LocationsOperations, OperationResultsOperations, OperationStatusesOperations, Operations, PipelineJobOperationStatusesOperations, PipelineJobsOperations, PipelineTopologiesOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, VideoAnalyzerOperationResultsOperations, VideoAnalyzerOperationStatusesOperations, VideoAnalyzersOperations, VideosOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +class VideoAnalyzerManagementClient: + """Azure Video Analyzer provides a platform for you to build intelligent video applications that span the edge and the cloud. + + :ivar edge_modules: EdgeModulesOperations operations + :vartype edge_modules: video_analyzer_management_client.aio.operations.EdgeModulesOperations + :ivar pipeline_topologies: PipelineTopologiesOperations operations + :vartype pipeline_topologies: + video_analyzer_management_client.aio.operations.PipelineTopologiesOperations + :ivar live_pipelines: LivePipelinesOperations operations + :vartype live_pipelines: + video_analyzer_management_client.aio.operations.LivePipelinesOperations + :ivar pipeline_jobs: PipelineJobsOperations operations + :vartype pipeline_jobs: video_analyzer_management_client.aio.operations.PipelineJobsOperations + :ivar live_pipeline_operation_statuses: LivePipelineOperationStatusesOperations operations + :vartype live_pipeline_operation_statuses: + video_analyzer_management_client.aio.operations.LivePipelineOperationStatusesOperations + :ivar pipeline_job_operation_statuses: PipelineJobOperationStatusesOperations operations + :vartype pipeline_job_operation_statuses: + video_analyzer_management_client.aio.operations.PipelineJobOperationStatusesOperations + :ivar operations: Operations operations + :vartype operations: video_analyzer_management_client.aio.operations.Operations + :ivar video_analyzers: VideoAnalyzersOperations operations + :vartype video_analyzers: + video_analyzer_management_client.aio.operations.VideoAnalyzersOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: + video_analyzer_management_client.aio.operations.PrivateLinkResourcesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + video_analyzer_management_client.aio.operations.PrivateEndpointConnectionsOperations + :ivar operation_statuses: OperationStatusesOperations operations + :vartype operation_statuses: + video_analyzer_management_client.aio.operations.OperationStatusesOperations + :ivar operation_results: OperationResultsOperations operations + :vartype operation_results: + video_analyzer_management_client.aio.operations.OperationResultsOperations + :ivar video_analyzer_operation_statuses: VideoAnalyzerOperationStatusesOperations operations + :vartype video_analyzer_operation_statuses: + video_analyzer_management_client.aio.operations.VideoAnalyzerOperationStatusesOperations + :ivar video_analyzer_operation_results: VideoAnalyzerOperationResultsOperations operations + :vartype video_analyzer_operation_results: + video_analyzer_management_client.aio.operations.VideoAnalyzerOperationResultsOperations + :ivar locations: LocationsOperations operations + :vartype locations: video_analyzer_management_client.aio.operations.LocationsOperations + :ivar videos: VideosOperations operations + :vartype videos: video_analyzer_management_client.aio.operations.VideosOperations + :ivar access_policies: AccessPoliciesOperations operations + :vartype access_policies: + video_analyzer_management_client.aio.operations.AccessPoliciesOperations + :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 + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = VideoAnalyzerManagementClientConfiguration(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.edge_modules = EdgeModulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.pipeline_topologies = PipelineTopologiesOperations(self._client, self._config, self._serialize, self._deserialize) + self.live_pipelines = LivePipelinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.pipeline_jobs = PipelineJobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.live_pipeline_operation_statuses = LivePipelineOperationStatusesOperations(self._client, self._config, self._serialize, self._deserialize) + self.pipeline_job_operation_statuses = PipelineJobOperationStatusesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.video_analyzers = VideoAnalyzersOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_statuses = OperationStatusesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_results = OperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.video_analyzer_operation_statuses = VideoAnalyzerOperationStatusesOperations(self._client, self._config, self._serialize, self._deserialize) + self.video_analyzer_operation_results = VideoAnalyzerOperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.videos = VideosOperations(self._client, self._config, self._serialize, self._deserialize) + self.access_policies = AccessPoliciesOperations(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) -> "VideoAnalyzerManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_access_policies_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_access_policies_operations.py index 919cb8290d9bc..6bb62c35a3d50 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_access_policies_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_access_policies_operations.py @@ -5,17 +5,22 @@ # 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, Union 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, HttpRequest +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._access_policies_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,7 +31,7 @@ class AccessPoliciesOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -61,8 +67,10 @@ def list( specified value n. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AccessPolicyEntityCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~video_analyzer.models.AccessPolicyEntityCollection] + :return: An iterator like instance of either AccessPolicyEntityCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~video_analyzer_management_client.models.AccessPolicyEntityCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessPolicyEntityCollection"] @@ -70,38 +78,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + top=top, + 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('AccessPolicyEntityCollection', pipeline_response) + deserialized = self._deserialize("AccessPolicyEntityCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,17 +119,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/accessPolicies'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -144,7 +151,7 @@ async def get( :type access_policy_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessPolicyEntity, or the result of cls(response) - :rtype: ~video_analyzer.models.AccessPolicyEntity + :rtype: ~video_analyzer_management_client.models.AccessPolicyEntity :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessPolicyEntity"] @@ -152,34 +159,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'accessPolicyName': self._serialize.url("access_policy_name", access_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + access_policy_name=access_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AccessPolicyEntity', pipeline_response) @@ -188,8 +185,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/accessPolicies/{accessPolicyName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -209,10 +209,10 @@ async def create_or_update( :param access_policy_name: The Access Policy name. :type access_policy_name: str :param parameters: The request parameters. - :type parameters: ~video_analyzer.models.AccessPolicyEntity + :type parameters: ~video_analyzer_management_client.models.AccessPolicyEntity :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessPolicyEntity, or the result of cls(response) - :rtype: ~video_analyzer.models.AccessPolicyEntity + :rtype: ~video_analyzer_management_client.models.AccessPolicyEntity :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessPolicyEntity"] @@ -220,39 +220,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'accessPolicyName': self._serialize.url("access_policy_name", access_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AccessPolicyEntity') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + access_policy_name=access_policy_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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccessPolicyEntity') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -265,8 +255,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/accessPolicies/{accessPolicyName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -294,34 +287,24 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'accessPolicyName': self._serialize.url("access_policy_name", access_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + access_policy_name=access_policy_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -329,6 +312,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/accessPolicies/{accessPolicyName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -348,10 +333,10 @@ async def update( :param access_policy_name: The Access Policy name. :type access_policy_name: str :param parameters: The request parameters. - :type parameters: ~video_analyzer.models.AccessPolicyEntity + :type parameters: ~video_analyzer_management_client.models.AccessPolicyEntity :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessPolicyEntity, or the result of cls(response) - :rtype: ~video_analyzer.models.AccessPolicyEntity + :rtype: ~video_analyzer_management_client.models.AccessPolicyEntity :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessPolicyEntity"] @@ -359,39 +344,29 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'accessPolicyName': self._serialize.url("access_policy_name", access_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AccessPolicyEntity') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + access_policy_name=access_policy_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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccessPolicyEntity') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AccessPolicyEntity', pipeline_response) @@ -400,4 +375,6 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/accessPolicies/{accessPolicyName}'} # type: ignore + diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_edge_modules_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_edge_modules_operations.py index 903012e620888..eb57e62c96e9e 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_edge_modules_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_edge_modules_operations.py @@ -5,17 +5,22 @@ # 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, Union 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, HttpRequest +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._edge_modules_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_provisioning_token_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,7 +31,7 @@ class EdgeModulesOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -61,8 +67,10 @@ def list( specified value n. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EdgeModuleEntityCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~video_analyzer.models.EdgeModuleEntityCollection] + :return: An iterator like instance of either EdgeModuleEntityCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~video_analyzer_management_client.models.EdgeModuleEntityCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EdgeModuleEntityCollection"] @@ -70,38 +78,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + top=top, + 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('EdgeModuleEntityCollection', pipeline_response) + deserialized = self._deserialize("EdgeModuleEntityCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,17 +119,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/edgeModules'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -144,7 +151,7 @@ async def get( :type edge_module_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EdgeModuleEntity, or the result of cls(response) - :rtype: ~video_analyzer.models.EdgeModuleEntity + :rtype: ~video_analyzer_management_client.models.EdgeModuleEntity :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EdgeModuleEntity"] @@ -152,34 +159,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'edgeModuleName': self._serialize.url("edge_module_name", edge_module_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + edge_module_name=edge_module_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EdgeModuleEntity', pipeline_response) @@ -188,8 +185,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/edgeModules/{edgeModuleName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -215,10 +215,10 @@ async def create_or_update( :param edge_module_name: The Edge Module name. :type edge_module_name: str :param parameters: The request parameters. - :type parameters: ~video_analyzer.models.EdgeModuleEntity + :type parameters: ~video_analyzer_management_client.models.EdgeModuleEntity :keyword callable cls: A custom type or function that will be passed the direct response :return: EdgeModuleEntity, or the result of cls(response) - :rtype: ~video_analyzer.models.EdgeModuleEntity + :rtype: ~video_analyzer_management_client.models.EdgeModuleEntity :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EdgeModuleEntity"] @@ -226,39 +226,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'edgeModuleName': self._serialize.url("edge_module_name", edge_module_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'EdgeModuleEntity') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + edge_module_name=edge_module_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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'EdgeModuleEntity') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -271,8 +261,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/edgeModules/{edgeModuleName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -302,34 +295,24 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'edgeModuleName': self._serialize.url("edge_module_name", edge_module_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + edge_module_name=edge_module_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -337,6 +320,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/edgeModules/{edgeModuleName}'} # type: ignore + + @distributed_trace_async async def list_provisioning_token( self, resource_group_name: str, @@ -362,10 +347,10 @@ async def list_provisioning_token( :param edge_module_name: The Edge Module name. :type edge_module_name: str :param parameters: The request parameters. - :type parameters: ~video_analyzer.models.ListProvisioningTokenInput + :type parameters: ~video_analyzer_management_client.models.ListProvisioningTokenInput :keyword callable cls: A custom type or function that will be passed the direct response :return: EdgeModuleProvisioningToken, or the result of cls(response) - :rtype: ~video_analyzer.models.EdgeModuleProvisioningToken + :rtype: ~video_analyzer_management_client.models.EdgeModuleProvisioningToken :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EdgeModuleProvisioningToken"] @@ -373,39 +358,29 @@ async def list_provisioning_token( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_provisioning_token.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'edgeModuleName': self._serialize.url("edge_module_name", edge_module_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ListProvisioningTokenInput') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_list_provisioning_token_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + edge_module_name=edge_module_name, + content_type=content_type, + json=_json, + template_url=self.list_provisioning_token.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ListProvisioningTokenInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EdgeModuleProvisioningToken', pipeline_response) @@ -414,4 +389,6 @@ async def list_provisioning_token( return cls(pipeline_response, deserialized, {}) return deserialized + list_provisioning_token.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/edgeModules/{edgeModuleName}/listProvisioningToken'} # type: ignore + diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_live_pipeline_operation_statuses_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_live_pipeline_operation_statuses_operations.py index 0bc9c78b712dc..12d0508bc22a6 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_live_pipeline_operation_statuses_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_live_pipeline_operation_statuses_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._live_pipeline_operation_statuses_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -25,7 +29,7 @@ class LivePipelineOperationStatusesOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -62,7 +67,7 @@ async def get( :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: LivePipelineOperationStatus, or the result of cls(response) - :rtype: ~video_analyzer.models.LivePipelineOperationStatus + :rtype: ~video_analyzer_management_client.models.LivePipelineOperationStatus :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.LivePipelineOperationStatus"] @@ -70,35 +75,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'livePipelineName': self._serialize.url("live_pipeline_name", live_pipeline_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_pipeline_name=live_pipeline_name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LivePipelineOperationStatus', pipeline_response) @@ -107,4 +102,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/livePipelines/{livePipelineName}/operationStatuses/{operationId}'} # type: ignore + diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_live_pipelines_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_live_pipelines_operations.py index 62e6a76d6e6d6..8bc8473a26ca9 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_live_pipelines_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_live_pipelines_operations.py @@ -5,19 +5,24 @@ # 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, Union 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, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._live_pipelines_operations import build_activate_request_initial, build_create_or_update_request, build_deactivate_request_initial, build_delete_request, build_get_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -28,7 +33,7 @@ class LivePipelinesOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -67,8 +73,10 @@ def list( specified value n. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either LivePipelineCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~video_analyzer.models.LivePipelineCollection] + :return: An iterator like instance of either LivePipelineCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~video_analyzer_management_client.models.LivePipelineCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.LivePipelineCollection"] @@ -76,40 +84,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + filter=filter, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + filter=filter, + top=top, + 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('LivePipelineCollection', pipeline_response) + deserialized = self._deserialize("LivePipelineCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -122,17 +127,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/livePipelines'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -153,7 +160,7 @@ async def get( :type live_pipeline_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: LivePipeline, or the result of cls(response) - :rtype: ~video_analyzer.models.LivePipeline + :rtype: ~video_analyzer_management_client.models.LivePipeline :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.LivePipeline"] @@ -161,34 +168,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'livePipelineName': self._serialize.url("live_pipeline_name", live_pipeline_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_pipeline_name=live_pipeline_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LivePipeline', pipeline_response) @@ -197,8 +194,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/livePipelines/{livePipelineName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -218,10 +218,10 @@ async def create_or_update( :param live_pipeline_name: Live pipeline unique identifier. :type live_pipeline_name: str :param parameters: The request parameters. - :type parameters: ~video_analyzer.models.LivePipeline + :type parameters: ~video_analyzer_management_client.models.LivePipeline :keyword callable cls: A custom type or function that will be passed the direct response :return: LivePipeline, or the result of cls(response) - :rtype: ~video_analyzer.models.LivePipeline + :rtype: ~video_analyzer_management_client.models.LivePipeline :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.LivePipeline"] @@ -229,39 +229,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'livePipelineName': self._serialize.url("live_pipeline_name", live_pipeline_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'LivePipeline') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_pipeline_name=live_pipeline_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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'LivePipeline') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -274,8 +264,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/livePipelines/{livePipelineName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -303,34 +296,24 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'livePipelineName': self._serialize.url("live_pipeline_name", live_pipeline_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_pipeline_name=live_pipeline_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -338,6 +321,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/livePipelines/{livePipelineName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -359,10 +344,10 @@ async def update( :param live_pipeline_name: Live pipeline unique identifier. :type live_pipeline_name: str :param parameters: The request parameters. - :type parameters: ~video_analyzer.models.LivePipelineUpdate + :type parameters: ~video_analyzer_management_client.models.LivePipelineUpdate :keyword callable cls: A custom type or function that will be passed the direct response :return: LivePipeline, or the result of cls(response) - :rtype: ~video_analyzer.models.LivePipeline + :rtype: ~video_analyzer_management_client.models.LivePipeline :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.LivePipeline"] @@ -370,39 +355,29 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'livePipelineName': self._serialize.url("live_pipeline_name", live_pipeline_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'LivePipelineUpdate') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_pipeline_name=live_pipeline_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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'LivePipelineUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LivePipeline', pipeline_response) @@ -411,8 +386,10 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/livePipelines/{livePipelineName}'} # type: ignore + async def _activate_initial( self, resource_group_name: str, @@ -425,41 +402,32 @@ async def _activate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._activate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'livePipelineName': self._serialize.url("live_pipeline_name", live_pipeline_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_activate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_pipeline_name=live_pipeline_name, + template_url=self._activate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _activate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/livePipelines/{livePipelineName}/activate'} # type: ignore + + @distributed_trace_async async def begin_activate( self, resource_group_name: str, @@ -479,15 +447,17 @@ async def begin_activate( :type live_pipeline_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -502,22 +472,14 @@ async def begin_activate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'livePipelineName': self._serialize.url("live_pipeline_name", live_pipeline_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -529,6 +491,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_activate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/livePipelines/{livePipelineName}/activate'} # type: ignore async def _deactivate_initial( @@ -543,41 +506,32 @@ async def _deactivate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._deactivate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'livePipelineName': self._serialize.url("live_pipeline_name", live_pipeline_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_deactivate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_pipeline_name=live_pipeline_name, + template_url=self._deactivate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _deactivate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/livePipelines/{livePipelineName}/deactivate'} # type: ignore + + @distributed_trace_async async def begin_deactivate( self, resource_group_name: str, @@ -597,15 +551,17 @@ async def begin_deactivate( :type live_pipeline_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -620,22 +576,14 @@ async def begin_deactivate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'livePipelineName': self._serialize.url("live_pipeline_name", live_pipeline_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -647,4 +595,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_deactivate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/livePipelines/{livePipelineName}/deactivate'} # type: ignore diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_locations_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_locations_operations.py index 14693f0b4139d..9453aef43264a 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_locations_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_locations_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._locations_operations import build_check_name_availability_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -25,7 +29,7 @@ class LocationsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_name_availability( self, location_name: str, @@ -53,10 +58,10 @@ async def check_name_availability( :param location_name: Location Name. :type location_name: str :param parameters: The request parameters. - :type parameters: ~video_analyzer.models.CheckNameAvailabilityRequest + :type parameters: ~video_analyzer_management_client.models.CheckNameAvailabilityRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResponse, or the result of cls(response) - :rtype: ~video_analyzer.models.CheckNameAvailabilityResponse + :rtype: ~video_analyzer_management_client.models.CheckNameAvailabilityResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResponse"] @@ -64,37 +69,27 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'locationName': self._serialize.url("location_name", location_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'CheckNameAvailabilityRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location_name=location_name, + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CheckNameAvailabilityRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckNameAvailabilityResponse', pipeline_response) @@ -103,4 +98,6 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Media/locations/{locationName}/checkNameAvailability'} # type: ignore + diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_operation_results_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_operation_results_operations.py index c5156f79a9bc2..a644affaeafee 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_operation_results_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_operation_results_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._operation_results_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -25,7 +29,7 @@ class OperationResultsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -62,7 +67,7 @@ async def get( :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection, or the result of cls(response) - :rtype: ~video_analyzer.models.PrivateEndpointConnection or None + :rtype: ~video_analyzer_management_client.models.PrivateEndpointConnection or None :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] @@ -70,35 +75,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + name=name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -109,4 +104,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/privateEndpointConnections/{name}/operationResults/{operationId}'} # type: ignore + diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_operation_statuses_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_operation_statuses_operations.py index 5e58c11175ea9..8f5f6470c7a07 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_operation_statuses_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_operation_statuses_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._operation_statuses_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -25,7 +29,7 @@ class OperationStatusesOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -62,7 +67,8 @@ async def get( :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VideoAnalyzerPrivateEndpointConnectionOperationStatus, or the result of cls(response) - :rtype: ~video_analyzer.models.VideoAnalyzerPrivateEndpointConnectionOperationStatus + :rtype: + ~video_analyzer_management_client.models.VideoAnalyzerPrivateEndpointConnectionOperationStatus :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VideoAnalyzerPrivateEndpointConnectionOperationStatus"] @@ -70,35 +76,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + name=name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('VideoAnalyzerPrivateEndpointConnectionOperationStatus', pipeline_response) @@ -107,4 +103,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/privateEndpointConnections/{name}/operationStatuses/{operationId}'} # type: ignore + diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_operations.py index a832bb39898d8..9ddcdae53f670 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -25,7 +29,7 @@ class Operations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, **kwargs: Any @@ -50,7 +55,7 @@ async def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationCollection, or the result of cls(response) - :rtype: ~video_analyzer.models.OperationCollection + :rtype: ~video_analyzer_management_client.models.OperationCollection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationCollection"] @@ -58,27 +63,20 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationCollection', pipeline_response) @@ -87,4 +85,6 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/providers/Microsoft.Media/operations'} # type: ignore + diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_pipeline_job_operation_statuses_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_pipeline_job_operation_statuses_operations.py index 8709efef2199e..57aac161b9104 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_pipeline_job_operation_statuses_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_pipeline_job_operation_statuses_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._pipeline_job_operation_statuses_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -25,7 +29,7 @@ class PipelineJobOperationStatusesOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -62,7 +67,7 @@ async def get( :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PipelineJobOperationStatus, or the result of cls(response) - :rtype: ~video_analyzer.models.PipelineJobOperationStatus + :rtype: ~video_analyzer_management_client.models.PipelineJobOperationStatus :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineJobOperationStatus"] @@ -70,35 +75,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'pipelineJobName': self._serialize.url("pipeline_job_name", pipeline_job_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pipeline_job_name=pipeline_job_name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PipelineJobOperationStatus', pipeline_response) @@ -107,4 +102,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineJobs/{pipelineJobName}/operationStatuses/{operationId}'} # type: ignore + diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_pipeline_jobs_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_pipeline_jobs_operations.py index 516fa720eb048..144327612806e 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_pipeline_jobs_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_pipeline_jobs_operations.py @@ -5,19 +5,24 @@ # 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, Union 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, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._pipeline_jobs_operations import build_cancel_request_initial, build_create_or_update_request, build_delete_request, build_get_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -28,7 +33,7 @@ class PipelineJobsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -67,8 +73,10 @@ def list( specified value n. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PipelineJobCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~video_analyzer.models.PipelineJobCollection] + :return: An iterator like instance of either PipelineJobCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~video_analyzer_management_client.models.PipelineJobCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineJobCollection"] @@ -76,40 +84,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + filter=filter, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + filter=filter, + top=top, + 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('PipelineJobCollection', pipeline_response) + deserialized = self._deserialize("PipelineJobCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -122,17 +127,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineJobs'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -153,7 +160,7 @@ async def get( :type pipeline_job_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PipelineJob, or the result of cls(response) - :rtype: ~video_analyzer.models.PipelineJob + :rtype: ~video_analyzer_management_client.models.PipelineJob :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineJob"] @@ -161,34 +168,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'pipelineJobName': self._serialize.url("pipeline_job_name", pipeline_job_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pipeline_job_name=pipeline_job_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PipelineJob', pipeline_response) @@ -197,8 +194,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineJobs/{pipelineJobName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -218,10 +218,10 @@ async def create_or_update( :param pipeline_job_name: The pipeline job name. :type pipeline_job_name: str :param parameters: The request parameters. - :type parameters: ~video_analyzer.models.PipelineJob + :type parameters: ~video_analyzer_management_client.models.PipelineJob :keyword callable cls: A custom type or function that will be passed the direct response :return: PipelineJob, or the result of cls(response) - :rtype: ~video_analyzer.models.PipelineJob + :rtype: ~video_analyzer_management_client.models.PipelineJob :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineJob"] @@ -229,39 +229,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'pipelineJobName': self._serialize.url("pipeline_job_name", pipeline_job_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'PipelineJob') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pipeline_job_name=pipeline_job_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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PipelineJob') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -274,8 +264,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineJobs/{pipelineJobName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -303,34 +296,24 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'pipelineJobName': self._serialize.url("pipeline_job_name", pipeline_job_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pipeline_job_name=pipeline_job_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -338,6 +321,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineJobs/{pipelineJobName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -358,10 +343,10 @@ async def update( :param pipeline_job_name: The pipeline job name. :type pipeline_job_name: str :param parameters: The request parameters. - :type parameters: ~video_analyzer.models.PipelineJobUpdate + :type parameters: ~video_analyzer_management_client.models.PipelineJobUpdate :keyword callable cls: A custom type or function that will be passed the direct response :return: PipelineJob, or the result of cls(response) - :rtype: ~video_analyzer.models.PipelineJob + :rtype: ~video_analyzer_management_client.models.PipelineJob :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineJob"] @@ -369,39 +354,29 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'pipelineJobName': self._serialize.url("pipeline_job_name", pipeline_job_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PipelineJobUpdate') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pipeline_job_name=pipeline_job_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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PipelineJobUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PipelineJob', pipeline_response) @@ -410,8 +385,10 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineJobs/{pipelineJobName}'} # type: ignore + async def _cancel_initial( self, resource_group_name: str, @@ -424,41 +401,32 @@ async def _cancel_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._cancel_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'pipelineJobName': self._serialize.url("pipeline_job_name", pipeline_job_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_cancel_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pipeline_job_name=pipeline_job_name, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineJobs/{pipelineJobName}/cancel'} # type: ignore + + @distributed_trace_async async def begin_cancel( self, resource_group_name: str, @@ -478,15 +446,17 @@ async def begin_cancel( :type pipeline_job_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -501,22 +471,14 @@ async def begin_cancel( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'pipelineJobName': self._serialize.url("pipeline_job_name", pipeline_job_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -528,4 +490,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineJobs/{pipelineJobName}/cancel'} # type: ignore diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_pipeline_topologies_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_pipeline_topologies_operations.py index f98c82443f10c..75ea87e38c61d 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_pipeline_topologies_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_pipeline_topologies_operations.py @@ -5,17 +5,22 @@ # 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, Union 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, HttpRequest +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._pipeline_topologies_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,7 +31,7 @@ class PipelineTopologiesOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -65,8 +71,10 @@ def list( specified value n. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PipelineTopologyCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~video_analyzer.models.PipelineTopologyCollection] + :return: An iterator like instance of either PipelineTopologyCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~video_analyzer_management_client.models.PipelineTopologyCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineTopologyCollection"] @@ -74,40 +82,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + filter=filter, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + filter=filter, + top=top, + 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('PipelineTopologyCollection', pipeline_response) + deserialized = self._deserialize("PipelineTopologyCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -120,17 +125,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineTopologies'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -151,7 +158,7 @@ async def get( :type pipeline_topology_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PipelineTopology, or the result of cls(response) - :rtype: ~video_analyzer.models.PipelineTopology + :rtype: ~video_analyzer_management_client.models.PipelineTopology :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineTopology"] @@ -159,34 +166,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'pipelineTopologyName': self._serialize.url("pipeline_topology_name", pipeline_topology_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pipeline_topology_name=pipeline_topology_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PipelineTopology', pipeline_response) @@ -195,8 +192,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineTopologies/{pipelineTopologyName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -219,10 +219,10 @@ async def create_or_update( :param pipeline_topology_name: Pipeline topology unique identifier. :type pipeline_topology_name: str :param parameters: The request parameters. - :type parameters: ~video_analyzer.models.PipelineTopology + :type parameters: ~video_analyzer_management_client.models.PipelineTopology :keyword callable cls: A custom type or function that will be passed the direct response :return: PipelineTopology, or the result of cls(response) - :rtype: ~video_analyzer.models.PipelineTopology + :rtype: ~video_analyzer_management_client.models.PipelineTopology :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineTopology"] @@ -230,39 +230,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'pipelineTopologyName': self._serialize.url("pipeline_topology_name", pipeline_topology_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PipelineTopology') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pipeline_topology_name=pipeline_topology_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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PipelineTopology') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -275,8 +265,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineTopologies/{pipelineTopologyName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -305,34 +298,24 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'pipelineTopologyName': self._serialize.url("pipeline_topology_name", pipeline_topology_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pipeline_topology_name=pipeline_topology_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -340,6 +323,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineTopologies/{pipelineTopologyName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -362,10 +347,10 @@ async def update( :param pipeline_topology_name: Pipeline topology unique identifier. :type pipeline_topology_name: str :param parameters: The request parameters. - :type parameters: ~video_analyzer.models.PipelineTopologyUpdate + :type parameters: ~video_analyzer_management_client.models.PipelineTopologyUpdate :keyword callable cls: A custom type or function that will be passed the direct response :return: PipelineTopology, or the result of cls(response) - :rtype: ~video_analyzer.models.PipelineTopology + :rtype: ~video_analyzer_management_client.models.PipelineTopology :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineTopology"] @@ -373,39 +358,29 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'pipelineTopologyName': self._serialize.url("pipeline_topology_name", pipeline_topology_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PipelineTopologyUpdate') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pipeline_topology_name=pipeline_topology_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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PipelineTopologyUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PipelineTopology', pipeline_response) @@ -414,4 +389,6 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineTopologies/{pipelineTopologyName}'} # type: ignore + diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_private_endpoint_connections_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_private_endpoint_connections_operations.py index 525355f49003f..6baeb6f1c7bf1 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_private_endpoint_connections_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._private_endpoint_connections_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -25,7 +29,7 @@ class PrivateEndpointConnectionsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, resource_group_name: str, @@ -56,7 +61,7 @@ async def list( :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionListResult, or the result of cls(response) - :rtype: ~video_analyzer.models.PrivateEndpointConnectionListResult + :rtype: ~video_analyzer_management_client.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -64,33 +69,23 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) @@ -99,8 +94,11 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/privateEndpointConnections'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -120,7 +118,7 @@ async def get( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection, or the result of cls(response) - :rtype: ~video_analyzer.models.PrivateEndpointConnection + :rtype: ~video_analyzer_management_client.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] @@ -128,34 +126,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + name=name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -164,8 +152,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/privateEndpointConnections/{name}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -185,10 +176,10 @@ async def create_or_update( :param name: Private endpoint connection name. :type name: str :param parameters: The request parameters. - :type parameters: ~video_analyzer.models.PrivateEndpointConnection + :type parameters: ~video_analyzer_management_client.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection, or the result of cls(response) - :rtype: ~video_analyzer.models.PrivateEndpointConnection + :rtype: ~video_analyzer_management_client.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] @@ -196,53 +187,47 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PrivateEndpointConnection') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + name=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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/privateEndpointConnections/{name}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -270,37 +255,28 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + name=name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + 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.Media/videoAnalyzers/{accountName}/privateEndpointConnections/{name}'} # type: ignore + diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_private_link_resources_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_private_link_resources_operations.py index c8c38a4a8f153..8295ebaa12eae 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_private_link_resources_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_private_link_resources_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._private_link_resources_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -25,7 +29,7 @@ class PrivateLinkResourcesOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, resource_group_name: str, @@ -56,7 +61,7 @@ async def list( :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateLinkResourceListResult, or the result of cls(response) - :rtype: ~video_analyzer.models.PrivateLinkResourceListResult + :rtype: ~video_analyzer_management_client.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] @@ -64,33 +69,23 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) @@ -99,8 +94,11 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/privateLinkResources'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -120,7 +118,7 @@ async def get( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateLinkResource, or the result of cls(response) - :rtype: ~video_analyzer.models.PrivateLinkResource + :rtype: ~video_analyzer_management_client.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] @@ -128,34 +126,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + name=name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateLinkResource', pipeline_response) @@ -164,4 +152,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/privateLinkResources/{name}'} # type: ignore + diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_video_analyzer_operation_results_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_video_analyzer_operation_results_operations.py index 423a0915794b4..329c4954f7006 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_video_analyzer_operation_results_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_video_analyzer_operation_results_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._video_analyzer_operation_results_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -25,7 +29,7 @@ class VideoAnalyzerOperationResultsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location_name: str, @@ -56,7 +61,7 @@ async def get( :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VideoAnalyzer, or the result of cls(response) - :rtype: ~video_analyzer.models.VideoAnalyzer or None + :rtype: ~video_analyzer_management_client.models.VideoAnalyzer or None :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.VideoAnalyzer"]] @@ -64,33 +69,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'locationName': self._serialize.url("location_name", location_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + location_name=location_name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -101,4 +96,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Media/locations/{locationName}/videoAnalyzerOperationResults/{operationId}'} # type: ignore + diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_video_analyzer_operation_statuses_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_video_analyzer_operation_statuses_operations.py index c4b276f70f373..d699e9f4b80b7 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_video_analyzer_operation_statuses_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_video_analyzer_operation_statuses_operations.py @@ -5,16 +5,20 @@ # 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, HttpRequest +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._video_analyzer_operation_statuses_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -25,7 +29,7 @@ class VideoAnalyzerOperationStatusesOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location_name: str, @@ -56,7 +61,7 @@ async def get( :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VideoAnalyzerOperationStatus, or the result of cls(response) - :rtype: ~video_analyzer.models.VideoAnalyzerOperationStatus + :rtype: ~video_analyzer_management_client.models.VideoAnalyzerOperationStatus :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VideoAnalyzerOperationStatus"] @@ -64,33 +69,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'locationName': self._serialize.url("location_name", location_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + location_name=location_name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('VideoAnalyzerOperationStatus', pipeline_response) @@ -99,4 +94,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Media/locations/{locationName}/videoAnalyzerOperationStatuses/{operationId}'} # type: ignore + diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_video_analyzers_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_video_analyzers_operations.py index 9381a44dd49c8..b104c48c636d2 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_video_analyzers_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_video_analyzers_operations.py @@ -5,18 +5,22 @@ # 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, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._video_analyzers_operations import build_create_or_update_request_initial, build_delete_request, build_get_request, build_list_by_subscription_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -27,7 +31,7 @@ class VideoAnalyzersOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -42,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, resource_group_name: str, @@ -55,7 +60,7 @@ async def list( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VideoAnalyzerCollection, or the result of cls(response) - :rtype: ~video_analyzer.models.VideoAnalyzerCollection + :rtype: ~video_analyzer_management_client.models.VideoAnalyzerCollection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VideoAnalyzerCollection"] @@ -63,32 +68,22 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('VideoAnalyzerCollection', pipeline_response) @@ -97,8 +92,11 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -115,7 +113,7 @@ async def get( :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VideoAnalyzer, or the result of cls(response) - :rtype: ~video_analyzer.models.VideoAnalyzer + :rtype: ~video_analyzer_management_client.models.VideoAnalyzer :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VideoAnalyzer"] @@ -123,33 +121,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + 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) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('VideoAnalyzer', pipeline_response) @@ -158,8 +146,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -172,39 +162,28 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'VideoAnalyzer') + + request = build_create_or_update_request_initial( + 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_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'VideoAnalyzer') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: @@ -214,14 +193,18 @@ async def _create_or_update_initial( response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('VideoAnalyzer', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -238,18 +221,23 @@ async def begin_create_or_update( :param account_name: The Video Analyzer account name. :type account_name: str :param parameters: The request parameters. - :type parameters: ~video_analyzer.models.VideoAnalyzer + :type parameters: ~video_analyzer_management_client.models.VideoAnalyzer :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VideoAnalyzer or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~video_analyzer.models.VideoAnalyzer] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VideoAnalyzer or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~video_analyzer_management_client.models.VideoAnalyzer] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VideoAnalyzer"] lro_delay = kwargs.pop( 'polling_interval', @@ -261,27 +249,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('VideoAnalyzer', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -293,8 +275,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}'} # type: ignore + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -319,33 +303,23 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + 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) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -353,6 +327,7 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}'} # type: ignore + async def _update_initial( self, resource_group_name: str, @@ -365,52 +340,45 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'VideoAnalyzerUpdate') + + request = build_update_request_initial( + 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_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'VideoAnalyzerUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('VideoAnalyzer', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -427,18 +395,23 @@ async def begin_update( :param account_name: The Video Analyzer account name. :type account_name: str :param parameters: The request parameters. - :type parameters: ~video_analyzer.models.VideoAnalyzerUpdate + :type parameters: ~video_analyzer_management_client.models.VideoAnalyzerUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VideoAnalyzer or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~video_analyzer.models.VideoAnalyzer] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VideoAnalyzer or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~video_analyzer_management_client.models.VideoAnalyzer] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VideoAnalyzer"] lro_delay = kwargs.pop( 'polling_interval', @@ -450,12 +423,11 @@ async def begin_update( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): response_headers = {} @@ -463,19 +435,14 @@ def get_long_running_output(pipeline_response): response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('VideoAnalyzer', pipeline_response) - if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -487,8 +454,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}'} # type: ignore + @distributed_trace_async async def list_by_subscription( self, **kwargs: Any @@ -499,7 +468,7 @@ async def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: VideoAnalyzerCollection, or the result of cls(response) - :rtype: ~video_analyzer.models.VideoAnalyzerCollection + :rtype: ~video_analyzer_management_client.models.VideoAnalyzerCollection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VideoAnalyzerCollection"] @@ -507,31 +476,21 @@ async def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('VideoAnalyzerCollection', pipeline_response) @@ -540,4 +499,6 @@ async def list_by_subscription( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Media/videoAnalyzers'} # type: ignore + diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_videos_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_videos_operations.py index 5c2b6b7bf85a5..6db73fcfc1f11 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_videos_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/aio/operations/_videos_operations.py @@ -5,17 +5,22 @@ # 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, Union 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, HttpRequest +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._videos_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_content_token_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,7 +31,7 @@ class VideosOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -62,8 +68,10 @@ def list( specified value n. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VideoEntityCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~video_analyzer.models.VideoEntityCollection] + :return: An iterator like instance of either VideoEntityCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~video_analyzer_management_client.models.VideoEntityCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VideoEntityCollection"] @@ -71,38 +79,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + top=top, + 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('VideoEntityCollection', pipeline_response) + deserialized = self._deserialize("VideoEntityCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,17 +120,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/videos'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -145,7 +152,7 @@ async def get( :type video_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VideoEntity, or the result of cls(response) - :rtype: ~video_analyzer.models.VideoEntity + :rtype: ~video_analyzer_management_client.models.VideoEntity :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VideoEntity"] @@ -153,34 +160,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'videoName': self._serialize.url("video_name", video_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + video_name=video_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('VideoEntity', pipeline_response) @@ -189,8 +186,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/videos/{videoName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -210,10 +210,10 @@ async def create_or_update( :param video_name: The Video name. :type video_name: str :param parameters: The request parameters. - :type parameters: ~video_analyzer.models.VideoEntity + :type parameters: ~video_analyzer_management_client.models.VideoEntity :keyword callable cls: A custom type or function that will be passed the direct response :return: VideoEntity, or the result of cls(response) - :rtype: ~video_analyzer.models.VideoEntity + :rtype: ~video_analyzer_management_client.models.VideoEntity :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VideoEntity"] @@ -221,39 +221,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'videoName': self._serialize.url("video_name", video_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'VideoEntity') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + video_name=video_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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'VideoEntity') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -266,8 +256,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/videos/{videoName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -295,34 +288,24 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'videoName': self._serialize.url("video_name", video_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + video_name=video_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -330,6 +313,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/videos/{videoName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -349,10 +334,10 @@ async def update( :param video_name: The Video name. :type video_name: str :param parameters: The request parameters. - :type parameters: ~video_analyzer.models.VideoEntity + :type parameters: ~video_analyzer_management_client.models.VideoEntity :keyword callable cls: A custom type or function that will be passed the direct response :return: VideoEntity, or the result of cls(response) - :rtype: ~video_analyzer.models.VideoEntity + :rtype: ~video_analyzer_management_client.models.VideoEntity :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VideoEntity"] @@ -360,39 +345,29 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'videoName': self._serialize.url("video_name", video_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VideoEntity') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + video_name=video_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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'VideoEntity') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('VideoEntity', pipeline_response) @@ -401,8 +376,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/videos/{videoName}'} # type: ignore + + @distributed_trace_async async def list_content_token( self, resource_group_name: str, @@ -423,7 +401,7 @@ async def list_content_token( :type video_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VideoContentToken, or the result of cls(response) - :rtype: ~video_analyzer.models.VideoContentToken + :rtype: ~video_analyzer_management_client.models.VideoContentToken :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VideoContentToken"] @@ -431,34 +409,24 @@ async def list_content_token( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_content_token.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'videoName': self._serialize.url("video_name", video_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_content_token_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + video_name=video_name, + template_url=self.list_content_token.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('VideoContentToken', pipeline_response) @@ -467,4 +435,6 @@ async def list_content_token( return cls(pipeline_response, deserialized, {}) return deserialized + list_content_token.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/videos/{videoName}/listContentToken'} # type: ignore + diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/models/__init__.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/models/__init__.py index 780b3ad619109..5390176637b85 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/models/__init__.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/models/__init__.py @@ -6,218 +6,113 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccessPolicyEntity - from ._models_py3 import AccessPolicyEntityCollection - from ._models_py3 import AccountEncryption - from ._models_py3 import AudioEncoderAac - from ._models_py3 import AudioEncoderBase - from ._models_py3 import AuthenticationBase - from ._models_py3 import CertificateSource - from ._models_py3 import CheckNameAvailabilityRequest - from ._models_py3 import CheckNameAvailabilityResponse - from ._models_py3 import CredentialsBase - from ._models_py3 import EccTokenKey - from ._models_py3 import EdgeModuleEntity - from ._models_py3 import EdgeModuleEntityCollection - from ._models_py3 import EdgeModuleProvisioningToken - from ._models_py3 import EncoderCustomPreset - from ._models_py3 import EncoderPresetBase - from ._models_py3 import EncoderProcessor - from ._models_py3 import EncoderSystemPreset - from ._models_py3 import Endpoint - from ._models_py3 import EndpointBase - from ._models_py3 import ErrorAdditionalInfo - from ._models_py3 import ErrorDetail - from ._models_py3 import ErrorResponse - from ._models_py3 import GroupLevelAccessControl - from ._models_py3 import IotHub - from ._models_py3 import JwtAuthentication - from ._models_py3 import KeyVaultProperties - from ._models_py3 import ListProvisioningTokenInput - from ._models_py3 import LivePipeline - from ._models_py3 import LivePipelineCollection - from ._models_py3 import LivePipelineOperationStatus - from ._models_py3 import LivePipelineUpdate - from ._models_py3 import LogSpecification - from ._models_py3 import MetricDimension - from ._models_py3 import MetricSpecification - from ._models_py3 import NetworkAccessControl - from ._models_py3 import NodeBase - from ._models_py3 import NodeInput - from ._models_py3 import Operation - from ._models_py3 import OperationCollection - from ._models_py3 import OperationDisplay - from ._models_py3 import ParameterDeclaration - from ._models_py3 import ParameterDefinition - from ._models_py3 import PemCertificateList - from ._models_py3 import PipelineJob - from ._models_py3 import PipelineJobCollection - from ._models_py3 import PipelineJobError - from ._models_py3 import PipelineJobOperationStatus - from ._models_py3 import PipelineJobUpdate - from ._models_py3 import PipelineTopology - from ._models_py3 import PipelineTopologyCollection - from ._models_py3 import PipelineTopologyUpdate - from ._models_py3 import PrivateEndpoint - from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateEndpointConnectionListResult - from ._models_py3 import PrivateLinkResource - from ._models_py3 import PrivateLinkResourceListResult - from ._models_py3 import PrivateLinkServiceConnectionState - from ._models_py3 import ProcessorNodeBase - from ._models_py3 import Properties - from ._models_py3 import ProxyResource - from ._models_py3 import Resource - from ._models_py3 import ResourceIdentity - from ._models_py3 import RsaTokenKey - from ._models_py3 import RtspSource - from ._models_py3 import SecureIotDeviceRemoteTunnel - from ._models_py3 import ServiceSpecification - from ._models_py3 import SinkNodeBase - from ._models_py3 import Sku - from ._models_py3 import SourceNodeBase - from ._models_py3 import StorageAccount - from ._models_py3 import SystemData - from ._models_py3 import TimeSequenceBase - from ._models_py3 import TlsEndpoint - from ._models_py3 import TlsValidationOptions - from ._models_py3 import TokenClaim - from ._models_py3 import TokenKey - from ._models_py3 import TrackedResource - from ._models_py3 import TunnelBase - from ._models_py3 import UnsecuredEndpoint - from ._models_py3 import UserAssignedManagedIdentity - from ._models_py3 import UsernamePasswordCredentials - from ._models_py3 import VideoAnalyzer - from ._models_py3 import VideoAnalyzerCollection - from ._models_py3 import VideoAnalyzerIdentity - from ._models_py3 import VideoAnalyzerOperationStatus - from ._models_py3 import VideoAnalyzerPrivateEndpointConnectionOperationStatus - from ._models_py3 import VideoAnalyzerUpdate - from ._models_py3 import VideoArchival - from ._models_py3 import VideoContentToken - from ._models_py3 import VideoContentUrls - from ._models_py3 import VideoCreationProperties - from ._models_py3 import VideoEncoderBase - from ._models_py3 import VideoEncoderH264 - from ._models_py3 import VideoEntity - from ._models_py3 import VideoEntityCollection - from ._models_py3 import VideoFlags - from ._models_py3 import VideoMediaInfo - from ._models_py3 import VideoPreviewImageUrls - from ._models_py3 import VideoPublishingOptions - from ._models_py3 import VideoScale - from ._models_py3 import VideoSequenceAbsoluteTimeMarkers - from ._models_py3 import VideoSink - from ._models_py3 import VideoSource -except (SyntaxError, ImportError): - from ._models import AccessPolicyEntity # type: ignore - from ._models import AccessPolicyEntityCollection # type: ignore - from ._models import AccountEncryption # type: ignore - from ._models import AudioEncoderAac # type: ignore - from ._models import AudioEncoderBase # type: ignore - from ._models import AuthenticationBase # type: ignore - from ._models import CertificateSource # type: ignore - from ._models import CheckNameAvailabilityRequest # type: ignore - from ._models import CheckNameAvailabilityResponse # type: ignore - from ._models import CredentialsBase # type: ignore - from ._models import EccTokenKey # type: ignore - from ._models import EdgeModuleEntity # type: ignore - from ._models import EdgeModuleEntityCollection # type: ignore - from ._models import EdgeModuleProvisioningToken # type: ignore - from ._models import EncoderCustomPreset # type: ignore - from ._models import EncoderPresetBase # type: ignore - from ._models import EncoderProcessor # type: ignore - from ._models import EncoderSystemPreset # type: ignore - from ._models import Endpoint # type: ignore - from ._models import EndpointBase # type: ignore - from ._models import ErrorAdditionalInfo # type: ignore - from ._models import ErrorDetail # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import GroupLevelAccessControl # type: ignore - from ._models import IotHub # type: ignore - from ._models import JwtAuthentication # type: ignore - from ._models import KeyVaultProperties # type: ignore - from ._models import ListProvisioningTokenInput # type: ignore - from ._models import LivePipeline # type: ignore - from ._models import LivePipelineCollection # type: ignore - from ._models import LivePipelineOperationStatus # type: ignore - from ._models import LivePipelineUpdate # type: ignore - from ._models import LogSpecification # type: ignore - from ._models import MetricDimension # type: ignore - from ._models import MetricSpecification # type: ignore - from ._models import NetworkAccessControl # type: ignore - from ._models import NodeBase # type: ignore - from ._models import NodeInput # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationCollection # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import ParameterDeclaration # type: ignore - from ._models import ParameterDefinition # type: ignore - from ._models import PemCertificateList # type: ignore - from ._models import PipelineJob # type: ignore - from ._models import PipelineJobCollection # type: ignore - from ._models import PipelineJobError # type: ignore - from ._models import PipelineJobOperationStatus # type: ignore - from ._models import PipelineJobUpdate # type: ignore - from ._models import PipelineTopology # type: ignore - from ._models import PipelineTopologyCollection # type: ignore - from ._models import PipelineTopologyUpdate # type: ignore - from ._models import PrivateEndpoint # type: ignore - from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateEndpointConnectionListResult # type: ignore - from ._models import PrivateLinkResource # type: ignore - from ._models import PrivateLinkResourceListResult # type: ignore - from ._models import PrivateLinkServiceConnectionState # type: ignore - from ._models import ProcessorNodeBase # type: ignore - from ._models import Properties # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceIdentity # type: ignore - from ._models import RsaTokenKey # type: ignore - from ._models import RtspSource # type: ignore - from ._models import SecureIotDeviceRemoteTunnel # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import SinkNodeBase # type: ignore - from ._models import Sku # type: ignore - from ._models import SourceNodeBase # type: ignore - from ._models import StorageAccount # type: ignore - from ._models import SystemData # type: ignore - from ._models import TimeSequenceBase # type: ignore - from ._models import TlsEndpoint # type: ignore - from ._models import TlsValidationOptions # type: ignore - from ._models import TokenClaim # type: ignore - from ._models import TokenKey # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import TunnelBase # type: ignore - from ._models import UnsecuredEndpoint # type: ignore - from ._models import UserAssignedManagedIdentity # type: ignore - from ._models import UsernamePasswordCredentials # type: ignore - from ._models import VideoAnalyzer # type: ignore - from ._models import VideoAnalyzerCollection # type: ignore - from ._models import VideoAnalyzerIdentity # type: ignore - from ._models import VideoAnalyzerOperationStatus # type: ignore - from ._models import VideoAnalyzerPrivateEndpointConnectionOperationStatus # type: ignore - from ._models import VideoAnalyzerUpdate # type: ignore - from ._models import VideoArchival # type: ignore - from ._models import VideoContentToken # type: ignore - from ._models import VideoContentUrls # type: ignore - from ._models import VideoCreationProperties # type: ignore - from ._models import VideoEncoderBase # type: ignore - from ._models import VideoEncoderH264 # type: ignore - from ._models import VideoEntity # type: ignore - from ._models import VideoEntityCollection # type: ignore - from ._models import VideoFlags # type: ignore - from ._models import VideoMediaInfo # type: ignore - from ._models import VideoPreviewImageUrls # type: ignore - from ._models import VideoPublishingOptions # type: ignore - from ._models import VideoScale # type: ignore - from ._models import VideoSequenceAbsoluteTimeMarkers # type: ignore - from ._models import VideoSink # type: ignore - from ._models import VideoSource # type: ignore +from ._models_py3 import AccessPolicyEntity +from ._models_py3 import AccessPolicyEntityCollection +from ._models_py3 import AccountEncryption +from ._models_py3 import AudioEncoderAac +from ._models_py3 import AudioEncoderBase +from ._models_py3 import AuthenticationBase +from ._models_py3 import CertificateSource +from ._models_py3 import CheckNameAvailabilityRequest +from ._models_py3 import CheckNameAvailabilityResponse +from ._models_py3 import CredentialsBase +from ._models_py3 import EccTokenKey +from ._models_py3 import EdgeModuleEntity +from ._models_py3 import EdgeModuleEntityCollection +from ._models_py3 import EdgeModuleProvisioningToken +from ._models_py3 import EncoderCustomPreset +from ._models_py3 import EncoderPresetBase +from ._models_py3 import EncoderProcessor +from ._models_py3 import EncoderSystemPreset +from ._models_py3 import Endpoint +from ._models_py3 import EndpointBase +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import GroupLevelAccessControl +from ._models_py3 import IotHub +from ._models_py3 import JwtAuthentication +from ._models_py3 import KeyVaultProperties +from ._models_py3 import ListProvisioningTokenInput +from ._models_py3 import LivePipeline +from ._models_py3 import LivePipelineCollection +from ._models_py3 import LivePipelineOperationStatus +from ._models_py3 import LivePipelineUpdate +from ._models_py3 import LogSpecification +from ._models_py3 import MetricDimension +from ._models_py3 import MetricSpecification +from ._models_py3 import NetworkAccessControl +from ._models_py3 import NodeBase +from ._models_py3 import NodeInput +from ._models_py3 import Operation +from ._models_py3 import OperationCollection +from ._models_py3 import OperationDisplay +from ._models_py3 import ParameterDeclaration +from ._models_py3 import ParameterDefinition +from ._models_py3 import PemCertificateList +from ._models_py3 import PipelineJob +from ._models_py3 import PipelineJobCollection +from ._models_py3 import PipelineJobError +from ._models_py3 import PipelineJobOperationStatus +from ._models_py3 import PipelineJobUpdate +from ._models_py3 import PipelineTopology +from ._models_py3 import PipelineTopologyCollection +from ._models_py3 import PipelineTopologyUpdate +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import ProcessorNodeBase +from ._models_py3 import Properties +from ._models_py3 import ProxyResource +from ._models_py3 import Resource +from ._models_py3 import ResourceIdentity +from ._models_py3 import RsaTokenKey +from ._models_py3 import RtspSource +from ._models_py3 import SecureIotDeviceRemoteTunnel +from ._models_py3 import ServiceSpecification +from ._models_py3 import SinkNodeBase +from ._models_py3 import Sku +from ._models_py3 import SourceNodeBase +from ._models_py3 import StorageAccount +from ._models_py3 import SystemData +from ._models_py3 import TimeSequenceBase +from ._models_py3 import TlsEndpoint +from ._models_py3 import TlsValidationOptions +from ._models_py3 import TokenClaim +from ._models_py3 import TokenKey +from ._models_py3 import TrackedResource +from ._models_py3 import TunnelBase +from ._models_py3 import UnsecuredEndpoint +from ._models_py3 import UserAssignedManagedIdentity +from ._models_py3 import UsernamePasswordCredentials +from ._models_py3 import VideoAnalyzer +from ._models_py3 import VideoAnalyzerCollection +from ._models_py3 import VideoAnalyzerIdentity +from ._models_py3 import VideoAnalyzerOperationStatus +from ._models_py3 import VideoAnalyzerPrivateEndpointConnectionOperationStatus +from ._models_py3 import VideoAnalyzerUpdate +from ._models_py3 import VideoArchival +from ._models_py3 import VideoContentToken +from ._models_py3 import VideoContentUrls +from ._models_py3 import VideoCreationProperties +from ._models_py3 import VideoEncoderBase +from ._models_py3 import VideoEncoderH264 +from ._models_py3 import VideoEntity +from ._models_py3 import VideoEntityCollection +from ._models_py3 import VideoFlags +from ._models_py3 import VideoMediaInfo +from ._models_py3 import VideoPreviewImageUrls +from ._models_py3 import VideoPublishingOptions +from ._models_py3 import VideoScale +from ._models_py3 import VideoSequenceAbsoluteTimeMarkers +from ._models_py3 import VideoSink +from ._models_py3 import VideoSource -from ._video_analyzer_enums import ( + +from ._video_analyzer_management_client_enums import ( AccessPolicyEccAlgo, AccessPolicyRole, AccessPolicyRsaAlgo, diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/models/_models_py3.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/models/_models_py3.py index ef25e8dafefc6..312b4fdb0714d 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/models/_models_py3.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/models/_models_py3.py @@ -12,7 +12,7 @@ from azure.core.exceptions import HttpResponseError import msrest.serialization -from ._video_analyzer_enums import * +from ._video_analyzer_management_client_enums import * class Resource(msrest.serialization.Model): @@ -30,7 +30,7 @@ class Resource(msrest.serialization.Model): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~video_analyzer.models.SystemData + :vartype system_data: ~video_analyzer_management_client.models.SystemData """ _validation = { @@ -51,6 +51,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -73,7 +75,7 @@ class ProxyResource(Resource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~video_analyzer.models.SystemData + :vartype system_data: ~video_analyzer_management_client.models.SystemData """ _validation = { @@ -94,6 +96,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -112,12 +116,11 @@ class AccessPolicyEntity(ProxyResource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~video_analyzer.models.SystemData - :param role: Defines the access level granted by this policy. Possible values include: - "Reader". - :type role: str or ~video_analyzer.models.AccessPolicyRole - :param authentication: Authentication method to be used when validating client API access. - :type authentication: ~video_analyzer.models.AuthenticationBase + :vartype system_data: ~video_analyzer_management_client.models.SystemData + :ivar role: Defines the access level granted by this policy. Possible values include: "Reader". + :vartype role: str or ~video_analyzer_management_client.models.AccessPolicyRole + :ivar authentication: Authentication method to be used when validating client API access. + :vartype authentication: ~video_analyzer_management_client.models.AuthenticationBase """ _validation = { @@ -143,6 +146,13 @@ def __init__( authentication: Optional["AuthenticationBase"] = None, **kwargs ): + """ + :keyword role: Defines the access level granted by this policy. Possible values include: + "Reader". + :paramtype role: str or ~video_analyzer_management_client.models.AccessPolicyRole + :keyword authentication: Authentication method to be used when validating client API access. + :paramtype authentication: ~video_analyzer_management_client.models.AuthenticationBase + """ super(AccessPolicyEntity, self).__init__(**kwargs) self.role = role self.authentication = authentication @@ -151,11 +161,11 @@ def __init__( class AccessPolicyEntityCollection(msrest.serialization.Model): """A collection of AccessPolicyEntity items. - :param value: A collection of AccessPolicyEntity items. - :type value: list[~video_analyzer.models.AccessPolicyEntity] - :param next_link: A link to the next page of the collection (when the collection contains too + :ivar value: A collection of AccessPolicyEntity items. + :vartype value: list[~video_analyzer_management_client.models.AccessPolicyEntity] + :ivar next_link: A link to the next page of the collection (when the collection contains too many results to return in one response). - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -170,6 +180,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: A collection of AccessPolicyEntity items. + :paramtype value: list[~video_analyzer_management_client.models.AccessPolicyEntity] + :keyword next_link: A link to the next page of the collection (when the collection contains too + many results to return in one response). + :paramtype next_link: str + """ super(AccessPolicyEntityCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -182,13 +199,13 @@ class AccountEncryption(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of key used to encrypt the Account Key. Possible values - include: "SystemKey", "CustomerKey". - :type type: str or ~video_analyzer.models.AccountEncryptionKeyType - :param key_vault_properties: The properties of the key used to encrypt the account. - :type key_vault_properties: ~video_analyzer.models.KeyVaultProperties - :param identity: The Key Vault identity. - :type identity: ~video_analyzer.models.ResourceIdentity + :ivar type: Required. The type of key used to encrypt the Account Key. Possible values include: + "SystemKey", "CustomerKey". + :vartype type: str or ~video_analyzer_management_client.models.AccountEncryptionKeyType + :ivar key_vault_properties: The properties of the key used to encrypt the account. + :vartype key_vault_properties: ~video_analyzer_management_client.models.KeyVaultProperties + :ivar identity: The Key Vault identity. + :vartype identity: ~video_analyzer_management_client.models.ResourceIdentity :ivar status: The current status of the Key Vault mapping. :vartype status: str """ @@ -213,6 +230,15 @@ def __init__( identity: Optional["ResourceIdentity"] = None, **kwargs ): + """ + :keyword type: Required. The type of key used to encrypt the Account Key. Possible values + include: "SystemKey", "CustomerKey". + :paramtype type: str or ~video_analyzer_management_client.models.AccountEncryptionKeyType + :keyword key_vault_properties: The properties of the key used to encrypt the account. + :paramtype key_vault_properties: ~video_analyzer_management_client.models.KeyVaultProperties + :keyword identity: The Key Vault identity. + :paramtype identity: ~video_analyzer_management_client.models.ResourceIdentity + """ super(AccountEncryption, self).__init__(**kwargs) self.type = type self.key_vault_properties = key_vault_properties @@ -228,12 +254,12 @@ class AudioEncoderBase(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The discriminator for derived types.Constant filled by server. - :type type: str - :param bitrate_kbps: Bitrate, in kilobits per second or Kbps, at which audio should be encoded + :ivar type: Required. The discriminator for derived types.Constant filled by server. + :vartype type: str + :ivar bitrate_kbps: Bitrate, in kilobits per second or Kbps, at which audio should be encoded (2-channel stereo audio at a sampling rate of 48 kHz). Allowed values are 96, 112, 128, 160, 192, 224, and 256. If omitted, the bitrate of the input audio is used. - :type bitrate_kbps: str + :vartype bitrate_kbps: str """ _validation = { @@ -255,6 +281,12 @@ def __init__( bitrate_kbps: Optional[str] = None, **kwargs ): + """ + :keyword bitrate_kbps: Bitrate, in kilobits per second or Kbps, at which audio should be + encoded (2-channel stereo audio at a sampling rate of 48 kHz). Allowed values are 96, 112, 128, + 160, 192, 224, and 256. If omitted, the bitrate of the input audio is used. + :paramtype bitrate_kbps: str + """ super(AudioEncoderBase, self).__init__(**kwargs) self.type = None # type: Optional[str] self.bitrate_kbps = bitrate_kbps @@ -265,12 +297,12 @@ class AudioEncoderAac(AudioEncoderBase): All required parameters must be populated in order to send to Azure. - :param type: Required. The discriminator for derived types.Constant filled by server. - :type type: str - :param bitrate_kbps: Bitrate, in kilobits per second or Kbps, at which audio should be encoded + :ivar type: Required. The discriminator for derived types.Constant filled by server. + :vartype type: str + :ivar bitrate_kbps: Bitrate, in kilobits per second or Kbps, at which audio should be encoded (2-channel stereo audio at a sampling rate of 48 kHz). Allowed values are 96, 112, 128, 160, 192, 224, and 256. If omitted, the bitrate of the input audio is used. - :type bitrate_kbps: str + :vartype bitrate_kbps: str """ _validation = { @@ -288,6 +320,12 @@ def __init__( bitrate_kbps: Optional[str] = None, **kwargs ): + """ + :keyword bitrate_kbps: Bitrate, in kilobits per second or Kbps, at which audio should be + encoded (2-channel stereo audio at a sampling rate of 48 kHz). Allowed values are 96, 112, 128, + 160, 192, 224, and 256. If omitted, the bitrate of the input audio is used. + :paramtype bitrate_kbps: str + """ super(AudioEncoderAac, self).__init__(bitrate_kbps=bitrate_kbps, **kwargs) self.type = '#Microsoft.VideoAnalyzer.AudioEncoderAac' # type: str @@ -300,8 +338,8 @@ class AuthenticationBase(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The discriminator for derived types.Constant filled by server. - :type type: str + :ivar type: Required. The discriminator for derived types.Constant filled by server. + :vartype type: str """ _validation = { @@ -320,6 +358,8 @@ def __init__( self, **kwargs ): + """ + """ super(AuthenticationBase, self).__init__(**kwargs) self.type = None # type: Optional[str] @@ -332,8 +372,8 @@ class CertificateSource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The discriminator for derived types.Constant filled by server. - :type type: str + :ivar type: Required. The discriminator for derived types.Constant filled by server. + :vartype type: str """ _validation = { @@ -352,6 +392,8 @@ def __init__( self, **kwargs ): + """ + """ super(CertificateSource, self).__init__(**kwargs) self.type = None # type: Optional[str] @@ -359,10 +401,10 @@ def __init__( class CheckNameAvailabilityRequest(msrest.serialization.Model): """The check availability request body. - :param name: The name of the resource for which availability needs to be checked. - :type name: str - :param type: The resource type. - :type type: str + :ivar name: The name of the resource for which availability needs to be checked. + :vartype name: str + :ivar type: The resource type. + :vartype type: str """ _attribute_map = { @@ -377,6 +419,12 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword name: The name of the resource for which availability needs to be checked. + :paramtype name: str + :keyword type: The resource type. + :paramtype type: str + """ super(CheckNameAvailabilityRequest, self).__init__(**kwargs) self.name = name self.type = type @@ -385,13 +433,13 @@ def __init__( class CheckNameAvailabilityResponse(msrest.serialization.Model): """The check availability result. - :param name_available: Indicates if the resource name is available. - :type name_available: bool - :param reason: The reason why the given name is not available. Possible values include: + :ivar name_available: Indicates if the resource name is available. + :vartype name_available: bool + :ivar reason: The reason why the given name is not available. Possible values include: "Invalid", "AlreadyExists". - :type reason: str or ~video_analyzer.models.CheckNameAvailabilityReason - :param message: Detailed reason why the given name is available. - :type message: str + :vartype reason: str or ~video_analyzer_management_client.models.CheckNameAvailabilityReason + :ivar message: Detailed reason why the given name is available. + :vartype message: str """ _attribute_map = { @@ -408,6 +456,15 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword name_available: Indicates if the resource name is available. + :paramtype name_available: bool + :keyword reason: The reason why the given name is not available. Possible values include: + "Invalid", "AlreadyExists". + :paramtype reason: str or ~video_analyzer_management_client.models.CheckNameAvailabilityReason + :keyword message: Detailed reason why the given name is available. + :paramtype message: str + """ super(CheckNameAvailabilityResponse, self).__init__(**kwargs) self.name_available = name_available self.reason = reason @@ -422,8 +479,8 @@ class CredentialsBase(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The discriminator for derived types.Constant filled by server. - :type type: str + :ivar type: Required. The discriminator for derived types.Constant filled by server. + :vartype type: str """ _validation = { @@ -442,6 +499,8 @@ def __init__( self, **kwargs ): + """ + """ super(CredentialsBase, self).__init__(**kwargs) self.type = None # type: Optional[str] @@ -454,11 +513,11 @@ class TokenKey(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The discriminator for derived types.Constant filled by server. - :type type: str - :param kid: Required. JWT token key id. Validation keys are looked up based on the key id + :ivar type: Required. The discriminator for derived types.Constant filled by server. + :vartype type: str + :ivar kid: Required. JWT token key id. Validation keys are looked up based on the key id present on the JWT token header. - :type kid: str + :vartype kid: str """ _validation = { @@ -481,6 +540,11 @@ def __init__( kid: str, **kwargs ): + """ + :keyword kid: Required. JWT token key id. Validation keys are looked up based on the key id + present on the JWT token header. + :paramtype kid: str + """ super(TokenKey, self).__init__(**kwargs) self.type = None # type: Optional[str] self.kid = kid @@ -491,18 +555,18 @@ class EccTokenKey(TokenKey): All required parameters must be populated in order to send to Azure. - :param type: Required. The discriminator for derived types.Constant filled by server. - :type type: str - :param kid: Required. JWT token key id. Validation keys are looked up based on the key id + :ivar type: Required. The discriminator for derived types.Constant filled by server. + :vartype type: str + :ivar kid: Required. JWT token key id. Validation keys are looked up based on the key id present on the JWT token header. - :type kid: str - :param alg: Required. Elliptical curve algorithm to be used: ES256, ES384 or ES512. Possible + :vartype kid: str + :ivar alg: Required. Elliptical curve algorithm to be used: ES256, ES384 or ES512. Possible values include: "ES256", "ES384", "ES512". - :type alg: str or ~video_analyzer.models.AccessPolicyEccAlgo - :param x: Required. X coordinate. - :type x: str - :param y: Required. Y coordinate. - :type y: str + :vartype alg: str or ~video_analyzer_management_client.models.AccessPolicyEccAlgo + :ivar x: Required. X coordinate. + :vartype x: str + :ivar y: Required. Y coordinate. + :vartype y: str """ _validation = { @@ -530,6 +594,18 @@ def __init__( y: str, **kwargs ): + """ + :keyword kid: Required. JWT token key id. Validation keys are looked up based on the key id + present on the JWT token header. + :paramtype kid: str + :keyword alg: Required. Elliptical curve algorithm to be used: ES256, ES384 or ES512. Possible + values include: "ES256", "ES384", "ES512". + :paramtype alg: str or ~video_analyzer_management_client.models.AccessPolicyEccAlgo + :keyword x: Required. X coordinate. + :paramtype x: str + :keyword y: Required. Y coordinate. + :paramtype y: str + """ super(EccTokenKey, self).__init__(kid=kid, **kwargs) self.type = '#Microsoft.VideoAnalyzer.EccTokenKey' # type: str self.alg = alg @@ -552,7 +628,7 @@ class EdgeModuleEntity(ProxyResource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~video_analyzer.models.SystemData + :vartype system_data: ~video_analyzer_management_client.models.SystemData :ivar edge_module_id: Internal ID generated for the instance of the Video Analyzer edge module. :vartype edge_module_id: str """ @@ -577,6 +653,8 @@ def __init__( self, **kwargs ): + """ + """ super(EdgeModuleEntity, self).__init__(**kwargs) self.edge_module_id = None @@ -584,11 +662,11 @@ def __init__( class EdgeModuleEntityCollection(msrest.serialization.Model): """A collection of EdgeModuleEntity items. - :param value: A collection of EdgeModuleEntity items. - :type value: list[~video_analyzer.models.EdgeModuleEntity] - :param next_link: A link to the next page of the collection (when the collection contains too + :ivar value: A collection of EdgeModuleEntity items. + :vartype value: list[~video_analyzer_management_client.models.EdgeModuleEntity] + :ivar next_link: A link to the next page of the collection (when the collection contains too many results to return in one response). - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -603,6 +681,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: A collection of EdgeModuleEntity items. + :paramtype value: list[~video_analyzer_management_client.models.EdgeModuleEntity] + :keyword next_link: A link to the next page of the collection (when the collection contains too + many results to return in one response). + :paramtype next_link: str + """ super(EdgeModuleEntityCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -636,6 +721,8 @@ def __init__( self, **kwargs ): + """ + """ super(EdgeModuleProvisioningToken, self).__init__(**kwargs) self.expiration_date = None self.token = None @@ -649,8 +736,8 @@ class EncoderPresetBase(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The discriminator for derived types.Constant filled by server. - :type type: str + :ivar type: Required. The discriminator for derived types.Constant filled by server. + :vartype type: str """ _validation = { @@ -669,6 +756,8 @@ def __init__( self, **kwargs ): + """ + """ super(EncoderPresetBase, self).__init__(**kwargs) self.type = None # type: Optional[str] @@ -678,12 +767,12 @@ class EncoderCustomPreset(EncoderPresetBase): All required parameters must be populated in order to send to Azure. - :param type: Required. The discriminator for derived types.Constant filled by server. - :type type: str - :param audio_encoder: Describes a custom preset for encoding audio. - :type audio_encoder: ~video_analyzer.models.AudioEncoderBase - :param video_encoder: Describes a custom preset for encoding video. - :type video_encoder: ~video_analyzer.models.VideoEncoderBase + :ivar type: Required. The discriminator for derived types.Constant filled by server. + :vartype type: str + :ivar audio_encoder: Describes a custom preset for encoding audio. + :vartype audio_encoder: ~video_analyzer_management_client.models.AudioEncoderBase + :ivar video_encoder: Describes a custom preset for encoding video. + :vartype video_encoder: ~video_analyzer_management_client.models.VideoEncoderBase """ _validation = { @@ -703,6 +792,12 @@ def __init__( video_encoder: Optional["VideoEncoderBase"] = None, **kwargs ): + """ + :keyword audio_encoder: Describes a custom preset for encoding audio. + :paramtype audio_encoder: ~video_analyzer_management_client.models.AudioEncoderBase + :keyword video_encoder: Describes a custom preset for encoding video. + :paramtype video_encoder: ~video_analyzer_management_client.models.VideoEncoderBase + """ super(EncoderCustomPreset, self).__init__(**kwargs) self.type = '#Microsoft.VideoAnalyzer.EncoderCustomPreset' # type: str self.audio_encoder = audio_encoder @@ -717,10 +812,10 @@ class NodeBase(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The discriminator for derived types.Constant filled by server. - :type type: str - :param name: Required. Node name. Must be unique within the topology. - :type name: str + :ivar type: Required. The discriminator for derived types.Constant filled by server. + :vartype type: str + :ivar name: Required. Node name. Must be unique within the topology. + :vartype name: str """ _validation = { @@ -743,6 +838,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. Node name. Must be unique within the topology. + :paramtype name: str + """ super(NodeBase, self).__init__(**kwargs) self.type = None # type: Optional[str] self.name = name @@ -756,13 +855,13 @@ class ProcessorNodeBase(NodeBase): All required parameters must be populated in order to send to Azure. - :param type: Required. The discriminator for derived types.Constant filled by server. - :type type: str - :param name: Required. Node name. Must be unique within the topology. - :type name: str - :param inputs: Required. An array of upstream node references within the topology to be used as + :ivar type: Required. The discriminator for derived types.Constant filled by server. + :vartype type: str + :ivar name: Required. Node name. Must be unique within the topology. + :vartype name: str + :ivar inputs: Required. An array of upstream node references within the topology to be used as inputs for this node. - :type inputs: list[~video_analyzer.models.NodeInput] + :vartype inputs: list[~video_analyzer_management_client.models.NodeInput] """ _validation = { @@ -788,6 +887,13 @@ def __init__( inputs: List["NodeInput"], **kwargs ): + """ + :keyword name: Required. Node name. Must be unique within the topology. + :paramtype name: str + :keyword inputs: Required. An array of upstream node references within the topology to be used + as inputs for this node. + :paramtype inputs: list[~video_analyzer_management_client.models.NodeInput] + """ super(ProcessorNodeBase, self).__init__(name=name, **kwargs) self.type = '#Microsoft.VideoAnalyzer.ProcessorNodeBase' # type: str self.inputs = inputs @@ -798,16 +904,16 @@ class EncoderProcessor(ProcessorNodeBase): All required parameters must be populated in order to send to Azure. - :param type: Required. The discriminator for derived types.Constant filled by server. - :type type: str - :param name: Required. Node name. Must be unique within the topology. - :type name: str - :param inputs: Required. An array of upstream node references within the topology to be used as + :ivar type: Required. The discriminator for derived types.Constant filled by server. + :vartype type: str + :ivar name: Required. Node name. Must be unique within the topology. + :vartype name: str + :ivar inputs: Required. An array of upstream node references within the topology to be used as inputs for this node. - :type inputs: list[~video_analyzer.models.NodeInput] - :param preset: Required. The encoder preset, which defines the recipe or instructions on how - the input content should be processed. - :type preset: ~video_analyzer.models.EncoderPresetBase + :vartype inputs: list[~video_analyzer_management_client.models.NodeInput] + :ivar preset: Required. The encoder preset, which defines the recipe or instructions on how the + input content should be processed. + :vartype preset: ~video_analyzer_management_client.models.EncoderPresetBase """ _validation = { @@ -832,6 +938,16 @@ def __init__( preset: "EncoderPresetBase", **kwargs ): + """ + :keyword name: Required. Node name. Must be unique within the topology. + :paramtype name: str + :keyword inputs: Required. An array of upstream node references within the topology to be used + as inputs for this node. + :paramtype inputs: list[~video_analyzer_management_client.models.NodeInput] + :keyword preset: Required. The encoder preset, which defines the recipe or instructions on how + the input content should be processed. + :paramtype preset: ~video_analyzer_management_client.models.EncoderPresetBase + """ super(EncoderProcessor, self).__init__(name=name, inputs=inputs, **kwargs) self.type = '#Microsoft.VideoAnalyzer.EncoderProcessor' # type: str self.preset = preset @@ -842,12 +958,12 @@ class EncoderSystemPreset(EncoderPresetBase): All required parameters must be populated in order to send to Azure. - :param type: Required. The discriminator for derived types.Constant filled by server. - :type type: str - :param name: Required. Name of the built-in encoding preset. Possible values include: + :ivar type: Required. The discriminator for derived types.Constant filled by server. + :vartype type: str + :ivar name: Required. Name of the built-in encoding preset. Possible values include: "SingleLayer_540p_H264_AAC", "SingleLayer_720p_H264_AAC", "SingleLayer_1080p_H264_AAC", "SingleLayer_2160p_H264_AAC". - :type name: str or ~video_analyzer.models.EncoderSystemPresetType + :vartype name: str or ~video_analyzer_management_client.models.EncoderSystemPresetType """ _validation = { @@ -866,6 +982,12 @@ def __init__( name: Union[str, "EncoderSystemPresetType"], **kwargs ): + """ + :keyword name: Required. Name of the built-in encoding preset. Possible values include: + "SingleLayer_540p_H264_AAC", "SingleLayer_720p_H264_AAC", "SingleLayer_1080p_H264_AAC", + "SingleLayer_2160p_H264_AAC". + :paramtype name: str or ~video_analyzer_management_client.models.EncoderSystemPresetType + """ super(EncoderSystemPreset, self).__init__(**kwargs) self.type = '#Microsoft.VideoAnalyzer.EncoderSystemPreset' # type: str self.name = name @@ -876,10 +998,10 @@ class Endpoint(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param endpoint_url: The URL of the endpoint. - :type endpoint_url: str - :param type: Required. The type of the endpoint. Possible values include: "ClientApi". - :type type: str or ~video_analyzer.models.VideoAnalyzerEndpointType + :ivar endpoint_url: The URL of the endpoint. + :vartype endpoint_url: str + :ivar type: Required. The type of the endpoint. Possible values include: "ClientApi". + :vartype type: str or ~video_analyzer_management_client.models.VideoAnalyzerEndpointType """ _validation = { @@ -898,6 +1020,12 @@ def __init__( endpoint_url: Optional[str] = None, **kwargs ): + """ + :keyword endpoint_url: The URL of the endpoint. + :paramtype endpoint_url: str + :keyword type: Required. The type of the endpoint. Possible values include: "ClientApi". + :paramtype type: str or ~video_analyzer_management_client.models.VideoAnalyzerEndpointType + """ super(Endpoint, self).__init__(**kwargs) self.endpoint_url = endpoint_url self.type = type @@ -911,15 +1039,15 @@ class EndpointBase(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The discriminator for derived types.Constant filled by server. - :type type: str - :param credentials: Required. Credentials to be presented to the endpoint. - :type credentials: ~video_analyzer.models.CredentialsBase - :param url: Required. The endpoint URL for Video Analyzer to connect to. - :type url: str - :param tunnel: Describes the tunnel through which Video Analyzer can connect to the endpoint + :ivar type: Required. The discriminator for derived types.Constant filled by server. + :vartype type: str + :ivar credentials: Required. Credentials to be presented to the endpoint. + :vartype credentials: ~video_analyzer_management_client.models.CredentialsBase + :ivar url: Required. The endpoint URL for Video Analyzer to connect to. + :vartype url: str + :ivar tunnel: Describes the tunnel through which Video Analyzer can connect to the endpoint URL. This is an optional property, typically used when the endpoint is behind a firewall. - :type tunnel: ~video_analyzer.models.TunnelBase + :vartype tunnel: ~video_analyzer_management_client.models.TunnelBase """ _validation = { @@ -947,6 +1075,15 @@ def __init__( tunnel: Optional["TunnelBase"] = None, **kwargs ): + """ + :keyword credentials: Required. Credentials to be presented to the endpoint. + :paramtype credentials: ~video_analyzer_management_client.models.CredentialsBase + :keyword url: Required. The endpoint URL for Video Analyzer to connect to. + :paramtype url: str + :keyword tunnel: Describes the tunnel through which Video Analyzer can connect to the endpoint + URL. This is an optional property, typically used when the endpoint is behind a firewall. + :paramtype tunnel: ~video_analyzer_management_client.models.TunnelBase + """ super(EndpointBase, self).__init__(**kwargs) self.type = None # type: Optional[str] self.credentials = credentials @@ -979,6 +1116,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorAdditionalInfo, self).__init__(**kwargs) self.type = None self.info = None @@ -996,9 +1135,9 @@ class ErrorDetail(msrest.serialization.Model): :ivar target: The error target. :vartype target: str :ivar details: The error details. - :vartype details: list[~video_analyzer.models.ErrorDetail] + :vartype details: list[~video_analyzer_management_client.models.ErrorDetail] :ivar additional_info: The error additional info. - :vartype additional_info: list[~video_analyzer.models.ErrorAdditionalInfo] + :vartype additional_info: list[~video_analyzer_management_client.models.ErrorAdditionalInfo] """ _validation = { @@ -1021,6 +1160,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorDetail, self).__init__(**kwargs) self.code = None self.message = None @@ -1032,8 +1173,8 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - :param error: The error object. - :type error: ~video_analyzer.models.ErrorDetail + :ivar error: The error object. + :vartype error: ~video_analyzer_management_client.models.ErrorDetail """ _attribute_map = { @@ -1046,6 +1187,10 @@ def __init__( error: Optional["ErrorDetail"] = None, **kwargs ): + """ + :keyword error: The error object. + :paramtype error: ~video_analyzer_management_client.models.ErrorDetail + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -1053,9 +1198,10 @@ def __init__( class GroupLevelAccessControl(msrest.serialization.Model): """Group level network access control. - :param public_network_access: Whether or not public network access is allowed for specified + :ivar public_network_access: Whether or not public network access is allowed for specified resources under the Video Analyzer account. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or ~video_analyzer.models.PublicNetworkAccess + :vartype public_network_access: str or + ~video_analyzer_management_client.models.PublicNetworkAccess """ _attribute_map = { @@ -1068,6 +1214,12 @@ def __init__( public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, **kwargs ): + """ + :keyword public_network_access: Whether or not public network access is allowed for specified + resources under the Video Analyzer account. Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or + ~video_analyzer_management_client.models.PublicNetworkAccess + """ super(GroupLevelAccessControl, self).__init__(**kwargs) self.public_network_access = public_network_access @@ -1079,10 +1231,10 @@ class IotHub(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. The IoT Hub resource identifier. - :type id: str - :param identity: Required. The IoT Hub identity. - :type identity: ~video_analyzer.models.ResourceIdentity + :ivar id: Required. The IoT Hub resource identifier. + :vartype id: str + :ivar identity: Required. The IoT Hub identity. + :vartype identity: ~video_analyzer_management_client.models.ResourceIdentity :ivar status: The current status of the Iot Hub mapping. :vartype status: str """ @@ -1106,6 +1258,12 @@ def __init__( identity: "ResourceIdentity", **kwargs ): + """ + :keyword id: Required. The IoT Hub resource identifier. + :paramtype id: str + :keyword identity: Required. The IoT Hub identity. + :paramtype identity: ~video_analyzer_management_client.models.ResourceIdentity + """ super(IotHub, self).__init__(**kwargs) self.id = id self.identity = identity @@ -1117,21 +1275,21 @@ class JwtAuthentication(AuthenticationBase): All required parameters must be populated in order to send to Azure. - :param type: Required. The discriminator for derived types.Constant filled by server. - :type type: str - :param issuers: List of expected token issuers. Token issuer is valid if it matches at least - one of the given values. - :type issuers: list[str] - :param audiences: List of expected token audiences. Token audience is valid if it matches at + :ivar type: Required. The discriminator for derived types.Constant filled by server. + :vartype type: str + :ivar issuers: List of expected token issuers. Token issuer is valid if it matches at least one + of the given values. + :vartype issuers: list[str] + :ivar audiences: List of expected token audiences. Token audience is valid if it matches at least one of the given values. - :type audiences: list[str] - :param claims: List of additional token claims to be validated. Token must contains all claims + :vartype audiences: list[str] + :ivar claims: List of additional token claims to be validated. Token must contains all claims and respective values for it to be valid. - :type claims: list[~video_analyzer.models.TokenClaim] - :param keys: List of keys which can be used to validate access tokens. Having multiple keys + :vartype claims: list[~video_analyzer_management_client.models.TokenClaim] + :ivar keys: List of keys which can be used to validate access tokens. Having multiple keys allow for seamless key rotation of the token signing key. Token signature must match exactly one key. - :type keys: list[~video_analyzer.models.TokenKey] + :vartype keys: list[~video_analyzer_management_client.models.TokenKey] """ _validation = { @@ -1155,6 +1313,21 @@ def __init__( keys: Optional[List["TokenKey"]] = None, **kwargs ): + """ + :keyword issuers: List of expected token issuers. Token issuer is valid if it matches at least + one of the given values. + :paramtype issuers: list[str] + :keyword audiences: List of expected token audiences. Token audience is valid if it matches at + least one of the given values. + :paramtype audiences: list[str] + :keyword claims: List of additional token claims to be validated. Token must contains all + claims and respective values for it to be valid. + :paramtype claims: list[~video_analyzer_management_client.models.TokenClaim] + :keyword keys: List of keys which can be used to validate access tokens. Having multiple keys + allow for seamless key rotation of the token signing key. Token signature must match exactly + one key. + :paramtype keys: list[~video_analyzer_management_client.models.TokenKey] + """ super(JwtAuthentication, self).__init__(**kwargs) self.type = '#Microsoft.VideoAnalyzer.JwtAuthentication' # type: str self.issuers = issuers @@ -1170,10 +1343,10 @@ class KeyVaultProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_identifier: Required. The URL of the Key Vault key used to encrypt the account. The + :ivar key_identifier: Required. The URL of the Key Vault key used to encrypt the account. The key may either be versioned (for example https://vault/keys/mykey/version1) or reference a key without a version (for example https://vault/keys/mykey). - :type key_identifier: str + :vartype key_identifier: str :ivar current_key_identifier: The current key used to encrypt Video Analyzer account, including the key version. :vartype current_key_identifier: str @@ -1195,6 +1368,12 @@ def __init__( key_identifier: str, **kwargs ): + """ + :keyword key_identifier: Required. The URL of the Key Vault key used to encrypt the account. + The key may either be versioned (for example https://vault/keys/mykey/version1) or reference a + key without a version (for example https://vault/keys/mykey). + :paramtype key_identifier: str + """ super(KeyVaultProperties, self).__init__(**kwargs) self.key_identifier = key_identifier self.current_key_identifier = None @@ -1205,10 +1384,10 @@ class ListProvisioningTokenInput(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param expiration_date: Required. The desired expiration date of the registration token. The + :ivar expiration_date: Required. The desired expiration date of the registration token. The Azure Video Analyzer IoT edge module must be initialized and connected to the Internet prior to the token expiration date. - :type expiration_date: ~datetime.datetime + :vartype expiration_date: ~datetime.datetime """ _validation = { @@ -1225,6 +1404,12 @@ def __init__( expiration_date: datetime.datetime, **kwargs ): + """ + :keyword expiration_date: Required. The desired expiration date of the registration token. The + Azure Video Analyzer IoT edge module must be initialized and connected to the Internet prior to + the token expiration date. + :paramtype expiration_date: ~datetime.datetime + """ super(ListProvisioningTokenInput, self).__init__(**kwargs) self.expiration_date = expiration_date @@ -1244,28 +1429,28 @@ class LivePipeline(ProxyResource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~video_analyzer.models.SystemData - :param topology_name: The reference to an existing pipeline topology defined for real-time + :vartype system_data: ~video_analyzer_management_client.models.SystemData + :ivar topology_name: The reference to an existing pipeline topology defined for real-time content processing. When activated, this live pipeline will process content according to the pipeline topology definition. - :type topology_name: str - :param description: An optional description for the pipeline. - :type description: str - :param bitrate_kbps: Maximum bitrate capacity in Kbps reserved for the live pipeline. The + :vartype topology_name: str + :ivar description: An optional description for the pipeline. + :vartype description: str + :ivar bitrate_kbps: Maximum bitrate capacity in Kbps reserved for the live pipeline. The allowed range is from 500 to 3000 Kbps in increments of 100 Kbps. If the RTSP camera exceeds this capacity, then the service will disconnect temporarily from the camera. It will retry to re-establish connection (with exponential backoff), checking to see if the camera bitrate is now below the reserved capacity. Doing so will ensure that one 'noisy neighbor' does not affect other live pipelines in your account. - :type bitrate_kbps: int + :vartype bitrate_kbps: int :ivar state: Current state of the pipeline (read-only). Possible values include: "Inactive", "Activating", "Active", "Deactivating". - :vartype state: str or ~video_analyzer.models.LivePipelineState - :param parameters: List of the instance level parameter values for the user-defined topology + :vartype state: str or ~video_analyzer_management_client.models.LivePipelineState + :ivar parameters: List of the instance level parameter values for the user-defined topology parameters. A pipeline can only define or override parameters values for parameters which have been declared in the referenced topology. Topology parameters without a default value must be defined. Topology parameters with a default value can be optionally be overridden. - :type parameters: list[~video_analyzer.models.ParameterDefinition] + :vartype parameters: list[~video_analyzer_management_client.models.ParameterDefinition] """ _validation = { @@ -1297,6 +1482,26 @@ def __init__( parameters: Optional[List["ParameterDefinition"]] = None, **kwargs ): + """ + :keyword topology_name: The reference to an existing pipeline topology defined for real-time + content processing. When activated, this live pipeline will process content according to the + pipeline topology definition. + :paramtype topology_name: str + :keyword description: An optional description for the pipeline. + :paramtype description: str + :keyword bitrate_kbps: Maximum bitrate capacity in Kbps reserved for the live pipeline. The + allowed range is from 500 to 3000 Kbps in increments of 100 Kbps. If the RTSP camera exceeds + this capacity, then the service will disconnect temporarily from the camera. It will retry to + re-establish connection (with exponential backoff), checking to see if the camera bitrate is + now below the reserved capacity. Doing so will ensure that one 'noisy neighbor' does not affect + other live pipelines in your account. + :paramtype bitrate_kbps: int + :keyword parameters: List of the instance level parameter values for the user-defined topology + parameters. A pipeline can only define or override parameters values for parameters which have + been declared in the referenced topology. Topology parameters without a default value must be + defined. Topology parameters with a default value can be optionally be overridden. + :paramtype parameters: list[~video_analyzer_management_client.models.ParameterDefinition] + """ super(LivePipeline, self).__init__(**kwargs) self.topology_name = topology_name self.description = description @@ -1308,11 +1513,11 @@ def __init__( class LivePipelineCollection(msrest.serialization.Model): """A collection of LivePipeline items. - :param value: A collection of LivePipeline items. - :type value: list[~video_analyzer.models.LivePipeline] - :param next_link: A link to the next page of the collection (when the collection contains too + :ivar value: A collection of LivePipeline items. + :vartype value: list[~video_analyzer_management_client.models.LivePipeline] + :ivar next_link: A link to the next page of the collection (when the collection contains too many results to return in one response). - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -1327,6 +1532,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: A collection of LivePipeline items. + :paramtype value: list[~video_analyzer_management_client.models.LivePipeline] + :keyword next_link: A link to the next page of the collection (when the collection contains too + many results to return in one response). + :paramtype next_link: str + """ super(LivePipelineCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1342,7 +1554,7 @@ class LivePipelineOperationStatus(msrest.serialization.Model): :ivar status: The status of the live pipeline operation. :vartype status: str :ivar error: The error details for the live pipeline operation. - :vartype error: ~video_analyzer.models.ErrorDetail + :vartype error: ~video_analyzer_management_client.models.ErrorDetail """ _validation = { @@ -1361,6 +1573,8 @@ def __init__( self, **kwargs ): + """ + """ super(LivePipelineOperationStatus, self).__init__(**kwargs) self.name = None self.status = None @@ -1382,28 +1596,28 @@ class LivePipelineUpdate(ProxyResource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~video_analyzer.models.SystemData - :param topology_name: The reference to an existing pipeline topology defined for real-time + :vartype system_data: ~video_analyzer_management_client.models.SystemData + :ivar topology_name: The reference to an existing pipeline topology defined for real-time content processing. When activated, this live pipeline will process content according to the pipeline topology definition. - :type topology_name: str - :param description: An optional description for the pipeline. - :type description: str - :param bitrate_kbps: Maximum bitrate capacity in Kbps reserved for the live pipeline. The + :vartype topology_name: str + :ivar description: An optional description for the pipeline. + :vartype description: str + :ivar bitrate_kbps: Maximum bitrate capacity in Kbps reserved for the live pipeline. The allowed range is from 500 to 3000 Kbps in increments of 100 Kbps. If the RTSP camera exceeds this capacity, then the service will disconnect temporarily from the camera. It will retry to re-establish connection (with exponential backoff), checking to see if the camera bitrate is now below the reserved capacity. Doing so will ensure that one 'noisy neighbor' does not affect other live pipelines in your account. - :type bitrate_kbps: int + :vartype bitrate_kbps: int :ivar state: Current state of the pipeline (read-only). Possible values include: "Inactive", "Activating", "Active", "Deactivating". - :vartype state: str or ~video_analyzer.models.LivePipelineState - :param parameters: List of the instance level parameter values for the user-defined topology + :vartype state: str or ~video_analyzer_management_client.models.LivePipelineState + :ivar parameters: List of the instance level parameter values for the user-defined topology parameters. A pipeline can only define or override parameters values for parameters which have been declared in the referenced topology. Topology parameters without a default value must be defined. Topology parameters with a default value can be optionally be overridden. - :type parameters: list[~video_analyzer.models.ParameterDefinition] + :vartype parameters: list[~video_analyzer_management_client.models.ParameterDefinition] """ _validation = { @@ -1435,6 +1649,26 @@ def __init__( parameters: Optional[List["ParameterDefinition"]] = None, **kwargs ): + """ + :keyword topology_name: The reference to an existing pipeline topology defined for real-time + content processing. When activated, this live pipeline will process content according to the + pipeline topology definition. + :paramtype topology_name: str + :keyword description: An optional description for the pipeline. + :paramtype description: str + :keyword bitrate_kbps: Maximum bitrate capacity in Kbps reserved for the live pipeline. The + allowed range is from 500 to 3000 Kbps in increments of 100 Kbps. If the RTSP camera exceeds + this capacity, then the service will disconnect temporarily from the camera. It will retry to + re-establish connection (with exponential backoff), checking to see if the camera bitrate is + now below the reserved capacity. Doing so will ensure that one 'noisy neighbor' does not affect + other live pipelines in your account. + :paramtype bitrate_kbps: int + :keyword parameters: List of the instance level parameter values for the user-defined topology + parameters. A pipeline can only define or override parameters values for parameters which have + been declared in the referenced topology. Topology parameters without a default value must be + defined. Topology parameters with a default value can be optionally be overridden. + :paramtype parameters: list[~video_analyzer_management_client.models.ParameterDefinition] + """ super(LivePipelineUpdate, self).__init__(**kwargs) self.topology_name = topology_name self.description = description @@ -1472,6 +1706,8 @@ def __init__( self, **kwargs ): + """ + """ super(LogSpecification, self).__init__(**kwargs) self.name = None self.display_name = None @@ -1507,6 +1743,8 @@ def __init__( self, **kwargs ): + """ + """ super(MetricDimension, self).__init__(**kwargs) self.name = None self.display_name = None @@ -1525,17 +1763,19 @@ class MetricSpecification(msrest.serialization.Model): :ivar display_description: The metric display description. :vartype display_description: str :ivar unit: The metric unit. Possible values include: "Bytes", "Count", "Milliseconds". - :vartype unit: str or ~video_analyzer.models.MetricUnit + :vartype unit: str or ~video_analyzer_management_client.models.MetricUnit :ivar aggregation_type: The metric aggregation type. Possible values include: "Average", "Count", "Total". - :vartype aggregation_type: str or ~video_analyzer.models.MetricAggregationType + :vartype aggregation_type: str or + ~video_analyzer_management_client.models.MetricAggregationType :ivar lock_aggregation_type: The metric lock aggregation type. Possible values include: "Average", "Count", "Total". - :vartype lock_aggregation_type: str or ~video_analyzer.models.MetricAggregationType - :param supported_aggregation_types: Supported aggregation types. - :type supported_aggregation_types: list[str] + :vartype lock_aggregation_type: str or + ~video_analyzer_management_client.models.MetricAggregationType + :ivar supported_aggregation_types: Supported aggregation types. + :vartype supported_aggregation_types: list[str] :ivar dimensions: The metric dimensions. - :vartype dimensions: list[~video_analyzer.models.MetricDimension] + :vartype dimensions: list[~video_analyzer_management_client.models.MetricDimension] :ivar enable_regional_mdm_account: Indicates whether regional MDM account is enabled. :vartype enable_regional_mdm_account: bool :ivar source_mdm_account: The source MDM account. @@ -1581,6 +1821,10 @@ def __init__( supported_aggregation_types: Optional[List[str]] = None, **kwargs ): + """ + :keyword supported_aggregation_types: Supported aggregation types. + :paramtype supported_aggregation_types: list[str] + """ super(MetricSpecification, self).__init__(**kwargs) self.name = None self.display_name = None @@ -1599,12 +1843,12 @@ def __init__( class NetworkAccessControl(msrest.serialization.Model): """Network access control for video analyzer account. - :param integration: Public network access for integration group. - :type integration: ~video_analyzer.models.GroupLevelAccessControl - :param ingestion: Public network access for ingestion group. - :type ingestion: ~video_analyzer.models.GroupLevelAccessControl - :param consumption: Public network access for consumption group. - :type consumption: ~video_analyzer.models.GroupLevelAccessControl + :ivar integration: Public network access for integration group. + :vartype integration: ~video_analyzer_management_client.models.GroupLevelAccessControl + :ivar ingestion: Public network access for ingestion group. + :vartype ingestion: ~video_analyzer_management_client.models.GroupLevelAccessControl + :ivar consumption: Public network access for consumption group. + :vartype consumption: ~video_analyzer_management_client.models.GroupLevelAccessControl """ _attribute_map = { @@ -1621,6 +1865,14 @@ def __init__( consumption: Optional["GroupLevelAccessControl"] = None, **kwargs ): + """ + :keyword integration: Public network access for integration group. + :paramtype integration: ~video_analyzer_management_client.models.GroupLevelAccessControl + :keyword ingestion: Public network access for ingestion group. + :paramtype ingestion: ~video_analyzer_management_client.models.GroupLevelAccessControl + :keyword consumption: Public network access for consumption group. + :paramtype consumption: ~video_analyzer_management_client.models.GroupLevelAccessControl + """ super(NetworkAccessControl, self).__init__(**kwargs) self.integration = integration self.ingestion = ingestion @@ -1632,9 +1884,9 @@ class NodeInput(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param node_name: Required. The name of the upstream node in the pipeline which output is used + :ivar node_name: Required. The name of the upstream node in the pipeline which output is used as input of the current node. - :type node_name: str + :vartype node_name: str """ _validation = { @@ -1651,6 +1903,11 @@ def __init__( node_name: str, **kwargs ): + """ + :keyword node_name: Required. The name of the upstream node in the pipeline which output is + used as input of the current node. + :paramtype node_name: str + """ super(NodeInput, self).__init__(**kwargs) self.node_name = node_name @@ -1660,18 +1917,18 @@ class Operation(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The operation name. - :type name: str - :param display: The operation display name. - :type display: ~video_analyzer.models.OperationDisplay - :param origin: Origin of the operation. - :type origin: str - :param properties: Operation properties format. - :type properties: ~video_analyzer.models.Properties - :param is_data_action: Whether the operation applies to data-plane. - :type is_data_action: bool - :param action_type: Indicates the action type. Possible values include: "Internal". - :type action_type: str or ~video_analyzer.models.ActionType + :ivar name: Required. The operation name. + :vartype name: str + :ivar display: The operation display name. + :vartype display: ~video_analyzer_management_client.models.OperationDisplay + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar properties: Operation properties format. + :vartype properties: ~video_analyzer_management_client.models.Properties + :ivar is_data_action: Whether the operation applies to data-plane. + :vartype is_data_action: bool + :ivar action_type: Indicates the action type. Possible values include: "Internal". + :vartype action_type: str or ~video_analyzer_management_client.models.ActionType """ _validation = { @@ -1698,6 +1955,20 @@ def __init__( action_type: Optional[Union[str, "ActionType"]] = None, **kwargs ): + """ + :keyword name: Required. The operation name. + :paramtype name: str + :keyword display: The operation display name. + :paramtype display: ~video_analyzer_management_client.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword properties: Operation properties format. + :paramtype properties: ~video_analyzer_management_client.models.Properties + :keyword is_data_action: Whether the operation applies to data-plane. + :paramtype is_data_action: bool + :keyword action_type: Indicates the action type. Possible values include: "Internal". + :paramtype action_type: str or ~video_analyzer_management_client.models.ActionType + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -1710,8 +1981,8 @@ def __init__( class OperationCollection(msrest.serialization.Model): """A collection of Operation items. - :param value: A collection of Operation items. - :type value: list[~video_analyzer.models.Operation] + :ivar value: A collection of Operation items. + :vartype value: list[~video_analyzer_management_client.models.Operation] """ _attribute_map = { @@ -1724,6 +1995,10 @@ def __init__( value: Optional[List["Operation"]] = None, **kwargs ): + """ + :keyword value: A collection of Operation items. + :paramtype value: list[~video_analyzer_management_client.models.Operation] + """ super(OperationCollection, self).__init__(**kwargs) self.value = value @@ -1731,14 +2006,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Operation details. - :param provider: The service provider. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: The operation type. - :type operation: str - :param description: The operation description. - :type description: str + :ivar provider: The service provider. + :vartype provider: str + :ivar resource: Resource on which the operation is performed. + :vartype resource: str + :ivar operation: The operation type. + :vartype operation: str + :ivar description: The operation description. + :vartype description: str """ _attribute_map = { @@ -1757,6 +2032,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: The service provider. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed. + :paramtype resource: str + :keyword operation: The operation type. + :paramtype operation: str + :keyword description: The operation description. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1769,16 +2054,16 @@ class ParameterDeclaration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the parameter. - :type name: str - :param type: Required. Type of the parameter. Possible values include: "String", - "SecretString", "Int", "Double", "Bool". - :type type: str or ~video_analyzer.models.ParameterType - :param description: Description of the parameter. - :type description: str - :param default: The default value for the parameter to be used if the pipeline does not specify + :ivar name: Required. Name of the parameter. + :vartype name: str + :ivar type: Required. Type of the parameter. Possible values include: "String", "SecretString", + "Int", "Double", "Bool". + :vartype type: str or ~video_analyzer_management_client.models.ParameterType + :ivar description: Description of the parameter. + :vartype description: str + :ivar default: The default value for the parameter to be used if the pipeline does not specify a value. - :type default: str + :vartype default: str """ _validation = { @@ -1802,6 +2087,18 @@ def __init__( default: Optional[str] = None, **kwargs ): + """ + :keyword name: Required. Name of the parameter. + :paramtype name: str + :keyword type: Required. Type of the parameter. Possible values include: "String", + "SecretString", "Int", "Double", "Bool". + :paramtype type: str or ~video_analyzer_management_client.models.ParameterType + :keyword description: Description of the parameter. + :paramtype description: str + :keyword default: The default value for the parameter to be used if the pipeline does not + specify a value. + :paramtype default: str + """ super(ParameterDeclaration, self).__init__(**kwargs) self.name = name self.type = type @@ -1814,10 +2111,10 @@ class ParameterDefinition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the parameter declared in the pipeline topology. - :type name: str - :param value: Parameter value to be applied on this specific pipeline. - :type value: str + :ivar name: Required. Name of the parameter declared in the pipeline topology. + :vartype name: str + :ivar value: Parameter value to be applied on this specific pipeline. + :vartype value: str """ _validation = { @@ -1836,6 +2133,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: Required. Name of the parameter declared in the pipeline topology. + :paramtype name: str + :keyword value: Parameter value to be applied on this specific pipeline. + :paramtype value: str + """ super(ParameterDefinition, self).__init__(**kwargs) self.name = name self.value = value @@ -1846,10 +2149,10 @@ class PemCertificateList(CertificateSource): All required parameters must be populated in order to send to Azure. - :param type: Required. The discriminator for derived types.Constant filled by server. - :type type: str - :param certificates: Required. PEM formatted public certificates. One certificate per entry. - :type certificates: list[str] + :ivar type: Required. The discriminator for derived types.Constant filled by server. + :vartype type: str + :ivar certificates: Required. PEM formatted public certificates. One certificate per entry. + :vartype certificates: list[str] """ _validation = { @@ -1868,6 +2171,10 @@ def __init__( certificates: List[str], **kwargs ): + """ + :keyword certificates: Required. PEM formatted public certificates. One certificate per entry. + :paramtype certificates: list[str] + """ super(PemCertificateList, self).__init__(**kwargs) self.type = '#Microsoft.VideoAnalyzer.PemCertificateList' # type: str self.certificates = certificates @@ -1888,25 +2195,25 @@ class PipelineJob(ProxyResource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~video_analyzer.models.SystemData - :param topology_name: Reference to an existing pipeline topology. When activated, this pipeline + :vartype system_data: ~video_analyzer_management_client.models.SystemData + :ivar topology_name: Reference to an existing pipeline topology. When activated, this pipeline job will process content according to the pipeline topology definition. - :type topology_name: str - :param description: An optional description for the pipeline. - :type description: str + :vartype topology_name: str + :ivar description: An optional description for the pipeline. + :vartype description: str :ivar state: Current state of the pipeline (read-only). Possible values include: "Processing", "Canceled", "Completed", "Failed". - :vartype state: str or ~video_analyzer.models.PipelineJobState + :vartype state: str or ~video_analyzer_management_client.models.PipelineJobState :ivar expiration: The date-time by when this pipeline job will be automatically deleted from your account. :vartype expiration: ~datetime.datetime :ivar error: Details about the error, in case the pipeline job fails. - :vartype error: ~video_analyzer.models.PipelineJobError - :param parameters: List of the instance level parameter values for the user-defined topology + :vartype error: ~video_analyzer_management_client.models.PipelineJobError + :ivar parameters: List of the instance level parameter values for the user-defined topology parameters. A pipeline can only define or override parameters values for parameters which have been declared in the referenced topology. Topology parameters without a default value must be defined. Topology parameters with a default value can be optionally be overridden. - :type parameters: list[~video_analyzer.models.ParameterDefinition] + :vartype parameters: list[~video_analyzer_management_client.models.ParameterDefinition] """ _validation = { @@ -1940,6 +2247,18 @@ def __init__( parameters: Optional[List["ParameterDefinition"]] = None, **kwargs ): + """ + :keyword topology_name: Reference to an existing pipeline topology. When activated, this + pipeline job will process content according to the pipeline topology definition. + :paramtype topology_name: str + :keyword description: An optional description for the pipeline. + :paramtype description: str + :keyword parameters: List of the instance level parameter values for the user-defined topology + parameters. A pipeline can only define or override parameters values for parameters which have + been declared in the referenced topology. Topology parameters without a default value must be + defined. Topology parameters with a default value can be optionally be overridden. + :paramtype parameters: list[~video_analyzer_management_client.models.ParameterDefinition] + """ super(PipelineJob, self).__init__(**kwargs) self.topology_name = topology_name self.description = description @@ -1952,11 +2271,11 @@ def __init__( class PipelineJobCollection(msrest.serialization.Model): """A collection of PipelineJob items. - :param value: A collection of PipelineJob items. - :type value: list[~video_analyzer.models.PipelineJob] - :param next_link: A link to the next page of the collection (when the collection contains too + :ivar value: A collection of PipelineJob items. + :vartype value: list[~video_analyzer_management_client.models.PipelineJob] + :ivar next_link: A link to the next page of the collection (when the collection contains too many results to return in one response). - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -1971,6 +2290,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: A collection of PipelineJob items. + :paramtype value: list[~video_analyzer_management_client.models.PipelineJob] + :keyword next_link: A link to the next page of the collection (when the collection contains too + many results to return in one response). + :paramtype next_link: str + """ super(PipelineJobCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1979,10 +2305,10 @@ def __init__( class PipelineJobError(msrest.serialization.Model): """Details about the error for a failed pipeline job. - :param code: The error code. - :type code: str - :param message: The error message. - :type message: str + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -1997,6 +2323,12 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The error code. + :paramtype code: str + :keyword message: The error message. + :paramtype message: str + """ super(PipelineJobError, self).__init__(**kwargs) self.code = code self.message = message @@ -2012,7 +2344,7 @@ class PipelineJobOperationStatus(msrest.serialization.Model): :ivar status: The status of the pipeline job operation. :vartype status: str :ivar error: The error details for the pipeline job operation. - :vartype error: ~video_analyzer.models.ErrorDetail + :vartype error: ~video_analyzer_management_client.models.ErrorDetail """ _validation = { @@ -2031,6 +2363,8 @@ def __init__( self, **kwargs ): + """ + """ super(PipelineJobOperationStatus, self).__init__(**kwargs) self.name = None self.status = None @@ -2052,25 +2386,25 @@ class PipelineJobUpdate(ProxyResource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~video_analyzer.models.SystemData - :param topology_name: Reference to an existing pipeline topology. When activated, this pipeline + :vartype system_data: ~video_analyzer_management_client.models.SystemData + :ivar topology_name: Reference to an existing pipeline topology. When activated, this pipeline job will process content according to the pipeline topology definition. - :type topology_name: str - :param description: An optional description for the pipeline. - :type description: str + :vartype topology_name: str + :ivar description: An optional description for the pipeline. + :vartype description: str :ivar state: Current state of the pipeline (read-only). Possible values include: "Processing", "Canceled", "Completed", "Failed". - :vartype state: str or ~video_analyzer.models.PipelineJobState + :vartype state: str or ~video_analyzer_management_client.models.PipelineJobState :ivar expiration: The date-time by when this pipeline job will be automatically deleted from your account. :vartype expiration: ~datetime.datetime :ivar error: Details about the error, in case the pipeline job fails. - :vartype error: ~video_analyzer.models.PipelineJobError - :param parameters: List of the instance level parameter values for the user-defined topology + :vartype error: ~video_analyzer_management_client.models.PipelineJobError + :ivar parameters: List of the instance level parameter values for the user-defined topology parameters. A pipeline can only define or override parameters values for parameters which have been declared in the referenced topology. Topology parameters without a default value must be defined. Topology parameters with a default value can be optionally be overridden. - :type parameters: list[~video_analyzer.models.ParameterDefinition] + :vartype parameters: list[~video_analyzer_management_client.models.ParameterDefinition] """ _validation = { @@ -2104,6 +2438,18 @@ def __init__( parameters: Optional[List["ParameterDefinition"]] = None, **kwargs ): + """ + :keyword topology_name: Reference to an existing pipeline topology. When activated, this + pipeline job will process content according to the pipeline topology definition. + :paramtype topology_name: str + :keyword description: An optional description for the pipeline. + :paramtype description: str + :keyword parameters: List of the instance level parameter values for the user-defined topology + parameters. A pipeline can only define or override parameters values for parameters which have + been declared in the referenced topology. Topology parameters without a default value must be + defined. Topology parameters with a default value can be optionally be overridden. + :paramtype parameters: list[~video_analyzer_management_client.models.ParameterDefinition] + """ super(PipelineJobUpdate, self).__init__(**kwargs) self.topology_name = topology_name self.description = description @@ -2136,28 +2482,28 @@ class PipelineTopology(ProxyResource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~video_analyzer.models.SystemData - :param kind: Required. Topology kind. Possible values include: "Live", "Batch". - :type kind: str or ~video_analyzer.models.Kind - :param sku: Required. Describes the properties of a SKU. - :type sku: ~video_analyzer.models.Sku - :param description: An optional description of the pipeline topology. It is recommended that - the expected use of the topology to be described here. - :type description: str - :param parameters: List of the topology parameter declarations. Parameters declared here can be + :vartype system_data: ~video_analyzer_management_client.models.SystemData + :ivar kind: Required. Topology kind. Possible values include: "Live", "Batch". + :vartype kind: str or ~video_analyzer_management_client.models.Kind + :ivar sku: Required. Describes the properties of a SKU. + :vartype sku: ~video_analyzer_management_client.models.Sku + :ivar description: An optional description of the pipeline topology. It is recommended that the + expected use of the topology to be described here. + :vartype description: str + :ivar parameters: List of the topology parameter declarations. Parameters declared here can be referenced throughout the topology nodes through the use of "${PARAMETER_NAME}" string pattern. Parameters can have optional default values and can later be defined in individual instances of the pipeline. - :type parameters: list[~video_analyzer.models.ParameterDeclaration] - :param sources: List of the topology source nodes. Source nodes enable external data to be + :vartype parameters: list[~video_analyzer_management_client.models.ParameterDeclaration] + :ivar sources: List of the topology source nodes. Source nodes enable external data to be ingested by the pipeline. - :type sources: list[~video_analyzer.models.SourceNodeBase] - :param processors: List of the topology processor nodes. Processor nodes enable pipeline data - to be analyzed, processed or transformed. - :type processors: list[~video_analyzer.models.ProcessorNodeBase] - :param sinks: List of the topology sink nodes. Sink nodes allow pipeline data to be stored or + :vartype sources: list[~video_analyzer_management_client.models.SourceNodeBase] + :ivar processors: List of the topology processor nodes. Processor nodes enable pipeline data to + be analyzed, processed or transformed. + :vartype processors: list[~video_analyzer_management_client.models.ProcessorNodeBase] + :ivar sinks: List of the topology sink nodes. Sink nodes allow pipeline data to be stored or exported. - :type sinks: list[~video_analyzer.models.SinkNodeBase] + :vartype sinks: list[~video_analyzer_management_client.models.SinkNodeBase] """ _validation = { @@ -2195,6 +2541,29 @@ def __init__( sinks: Optional[List["SinkNodeBase"]] = None, **kwargs ): + """ + :keyword kind: Required. Topology kind. Possible values include: "Live", "Batch". + :paramtype kind: str or ~video_analyzer_management_client.models.Kind + :keyword sku: Required. Describes the properties of a SKU. + :paramtype sku: ~video_analyzer_management_client.models.Sku + :keyword description: An optional description of the pipeline topology. It is recommended that + the expected use of the topology to be described here. + :paramtype description: str + :keyword parameters: List of the topology parameter declarations. Parameters declared here can + be referenced throughout the topology nodes through the use of "${PARAMETER_NAME}" string + pattern. Parameters can have optional default values and can later be defined in individual + instances of the pipeline. + :paramtype parameters: list[~video_analyzer_management_client.models.ParameterDeclaration] + :keyword sources: List of the topology source nodes. Source nodes enable external data to be + ingested by the pipeline. + :paramtype sources: list[~video_analyzer_management_client.models.SourceNodeBase] + :keyword processors: List of the topology processor nodes. Processor nodes enable pipeline data + to be analyzed, processed or transformed. + :paramtype processors: list[~video_analyzer_management_client.models.ProcessorNodeBase] + :keyword sinks: List of the topology sink nodes. Sink nodes allow pipeline data to be stored or + exported. + :paramtype sinks: list[~video_analyzer_management_client.models.SinkNodeBase] + """ super(PipelineTopology, self).__init__(**kwargs) self.kind = kind self.sku = sku @@ -2208,11 +2577,11 @@ def __init__( class PipelineTopologyCollection(msrest.serialization.Model): """A collection of PipelineTopology items. - :param value: A collection of PipelineTopology items. - :type value: list[~video_analyzer.models.PipelineTopology] - :param next_link: A link to the next page of the collection (when the collection contains too + :ivar value: A collection of PipelineTopology items. + :vartype value: list[~video_analyzer_management_client.models.PipelineTopology] + :ivar next_link: A link to the next page of the collection (when the collection contains too many results to return in one response). - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -2227,6 +2596,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: A collection of PipelineTopology items. + :paramtype value: list[~video_analyzer_management_client.models.PipelineTopology] + :keyword next_link: A link to the next page of the collection (when the collection contains too + many results to return in one response). + :paramtype next_link: str + """ super(PipelineTopologyCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2253,28 +2629,28 @@ class PipelineTopologyUpdate(ProxyResource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~video_analyzer.models.SystemData - :param kind: Topology kind. Possible values include: "Live", "Batch". - :type kind: str or ~video_analyzer.models.Kind - :param sku: Describes the properties of a SKU. - :type sku: ~video_analyzer.models.Sku - :param description: An optional description of the pipeline topology. It is recommended that - the expected use of the topology to be described here. - :type description: str - :param parameters: List of the topology parameter declarations. Parameters declared here can be + :vartype system_data: ~video_analyzer_management_client.models.SystemData + :ivar kind: Topology kind. Possible values include: "Live", "Batch". + :vartype kind: str or ~video_analyzer_management_client.models.Kind + :ivar sku: Describes the properties of a SKU. + :vartype sku: ~video_analyzer_management_client.models.Sku + :ivar description: An optional description of the pipeline topology. It is recommended that the + expected use of the topology to be described here. + :vartype description: str + :ivar parameters: List of the topology parameter declarations. Parameters declared here can be referenced throughout the topology nodes through the use of "${PARAMETER_NAME}" string pattern. Parameters can have optional default values and can later be defined in individual instances of the pipeline. - :type parameters: list[~video_analyzer.models.ParameterDeclaration] - :param sources: List of the topology source nodes. Source nodes enable external data to be + :vartype parameters: list[~video_analyzer_management_client.models.ParameterDeclaration] + :ivar sources: List of the topology source nodes. Source nodes enable external data to be ingested by the pipeline. - :type sources: list[~video_analyzer.models.SourceNodeBase] - :param processors: List of the topology processor nodes. Processor nodes enable pipeline data - to be analyzed, processed or transformed. - :type processors: list[~video_analyzer.models.ProcessorNodeBase] - :param sinks: List of the topology sink nodes. Sink nodes allow pipeline data to be stored or + :vartype sources: list[~video_analyzer_management_client.models.SourceNodeBase] + :ivar processors: List of the topology processor nodes. Processor nodes enable pipeline data to + be analyzed, processed or transformed. + :vartype processors: list[~video_analyzer_management_client.models.ProcessorNodeBase] + :ivar sinks: List of the topology sink nodes. Sink nodes allow pipeline data to be stored or exported. - :type sinks: list[~video_analyzer.models.SinkNodeBase] + :vartype sinks: list[~video_analyzer_management_client.models.SinkNodeBase] """ _validation = { @@ -2310,6 +2686,29 @@ def __init__( sinks: Optional[List["SinkNodeBase"]] = None, **kwargs ): + """ + :keyword kind: Topology kind. Possible values include: "Live", "Batch". + :paramtype kind: str or ~video_analyzer_management_client.models.Kind + :keyword sku: Describes the properties of a SKU. + :paramtype sku: ~video_analyzer_management_client.models.Sku + :keyword description: An optional description of the pipeline topology. It is recommended that + the expected use of the topology to be described here. + :paramtype description: str + :keyword parameters: List of the topology parameter declarations. Parameters declared here can + be referenced throughout the topology nodes through the use of "${PARAMETER_NAME}" string + pattern. Parameters can have optional default values and can later be defined in individual + instances of the pipeline. + :paramtype parameters: list[~video_analyzer_management_client.models.ParameterDeclaration] + :keyword sources: List of the topology source nodes. Source nodes enable external data to be + ingested by the pipeline. + :paramtype sources: list[~video_analyzer_management_client.models.SourceNodeBase] + :keyword processors: List of the topology processor nodes. Processor nodes enable pipeline data + to be analyzed, processed or transformed. + :paramtype processors: list[~video_analyzer_management_client.models.ProcessorNodeBase] + :keyword sinks: List of the topology sink nodes. Sink nodes allow pipeline data to be stored or + exported. + :paramtype sinks: list[~video_analyzer_management_client.models.SinkNodeBase] + """ super(PipelineTopologyUpdate, self).__init__(**kwargs) self.kind = kind self.sku = sku @@ -2341,6 +2740,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -2360,17 +2761,17 @@ class PrivateEndpointConnection(Resource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~video_analyzer.models.SystemData - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~video_analyzer.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: - ~video_analyzer.models.PrivateLinkServiceConnectionState + :vartype system_data: ~video_analyzer_management_client.models.SystemData + :ivar private_endpoint: The resource of private end point. + :vartype private_endpoint: ~video_analyzer_management_client.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: + ~video_analyzer_management_client.models.PrivateLinkServiceConnectionState :ivar provisioning_state: The provisioning state of the private endpoint connection resource. Possible values include: "Succeeded", "Creating", "Deleting", "Failed". :vartype provisioning_state: str or - ~video_analyzer.models.PrivateEndpointConnectionProvisioningState + ~video_analyzer_management_client.models.PrivateEndpointConnectionProvisioningState """ _validation = { @@ -2398,6 +2799,14 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword private_endpoint: The resource of private end point. + :paramtype private_endpoint: ~video_analyzer_management_client.models.PrivateEndpoint + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~video_analyzer_management_client.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state @@ -2407,8 +2816,8 @@ def __init__( class PrivateEndpointConnectionListResult(msrest.serialization.Model): """List of private endpoint connection associated with the specified storage account. - :param value: Array of private endpoint connections. - :type value: list[~video_analyzer.models.PrivateEndpointConnection] + :ivar value: Array of private endpoint connections. + :vartype value: list[~video_analyzer_management_client.models.PrivateEndpointConnection] """ _attribute_map = { @@ -2421,6 +2830,10 @@ def __init__( value: Optional[List["PrivateEndpointConnection"]] = None, **kwargs ): + """ + :keyword value: Array of private endpoint connections. + :paramtype value: list[~video_analyzer_management_client.models.PrivateEndpointConnection] + """ super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) self.value = value @@ -2440,13 +2853,13 @@ class PrivateLinkResource(Resource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~video_analyzer.models.SystemData + :vartype system_data: ~video_analyzer_management_client.models.SystemData :ivar group_id: The private link resource group id. :vartype group_id: str :ivar required_members: The private link resource required member names. :vartype required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] + :ivar required_zone_names: The private link resource Private link DNS zone name. + :vartype required_zone_names: list[str] """ _validation = { @@ -2474,6 +2887,10 @@ def __init__( required_zone_names: Optional[List[str]] = None, **kwargs ): + """ + :keyword required_zone_names: The private link resource Private link DNS zone name. + :paramtype required_zone_names: list[str] + """ super(PrivateLinkResource, self).__init__(**kwargs) self.group_id = None self.required_members = None @@ -2483,8 +2900,8 @@ def __init__( class PrivateLinkResourceListResult(msrest.serialization.Model): """A list of private link resources. - :param value: Array of private link resources. - :type value: list[~video_analyzer.models.PrivateLinkResource] + :ivar value: Array of private link resources. + :vartype value: list[~video_analyzer_management_client.models.PrivateLinkResource] """ _attribute_map = { @@ -2497,6 +2914,10 @@ def __init__( value: Optional[List["PrivateLinkResource"]] = None, **kwargs ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~video_analyzer_management_client.models.PrivateLinkResource] + """ super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = value @@ -2504,14 +2925,15 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """A collection of information about the state of the connection between service consumer and provider. - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: "Pending", "Approved", "Rejected". - :type status: str or ~video_analyzer.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any + :vartype status: str or + ~video_analyzer_management_client.models.PrivateEndpointServiceConnectionStatus + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any updates on the consumer. - :type actions_required: str + :vartype actions_required: str """ _attribute_map = { @@ -2528,6 +2950,17 @@ def __init__( actions_required: Optional[str] = None, **kwargs ): + """ + :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the + owner of the service. Possible values include: "Pending", "Approved", "Rejected". + :paramtype status: str or + ~video_analyzer_management_client.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval/rejection of the connection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :paramtype actions_required: str + """ super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description @@ -2540,7 +2973,7 @@ class Properties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar service_specification: The service specifications. - :vartype service_specification: ~video_analyzer.models.ServiceSpecification + :vartype service_specification: ~video_analyzer_management_client.models.ServiceSpecification """ _validation = { @@ -2555,6 +2988,8 @@ def __init__( self, **kwargs ): + """ + """ super(Properties, self).__init__(**kwargs) self.service_specification = None @@ -2564,9 +2999,9 @@ class ResourceIdentity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param user_assigned_identity: Required. The user assigned managed identity's resource + :ivar user_assigned_identity: Required. The user assigned managed identity's resource identifier to use when accessing a resource. - :type user_assigned_identity: str + :vartype user_assigned_identity: str """ _validation = { @@ -2583,6 +3018,11 @@ def __init__( user_assigned_identity: str, **kwargs ): + """ + :keyword user_assigned_identity: Required. The user assigned managed identity's resource + identifier to use when accessing a resource. + :paramtype user_assigned_identity: str + """ super(ResourceIdentity, self).__init__(**kwargs) self.user_assigned_identity = user_assigned_identity @@ -2592,18 +3032,18 @@ class RsaTokenKey(TokenKey): All required parameters must be populated in order to send to Azure. - :param type: Required. The discriminator for derived types.Constant filled by server. - :type type: str - :param kid: Required. JWT token key id. Validation keys are looked up based on the key id + :ivar type: Required. The discriminator for derived types.Constant filled by server. + :vartype type: str + :ivar kid: Required. JWT token key id. Validation keys are looked up based on the key id present on the JWT token header. - :type kid: str - :param alg: Required. RSA algorithm to be used: RS256, RS384 or RS512. Possible values include: + :vartype kid: str + :ivar alg: Required. RSA algorithm to be used: RS256, RS384 or RS512. Possible values include: "RS256", "RS384", "RS512". - :type alg: str or ~video_analyzer.models.AccessPolicyRsaAlgo - :param n: Required. RSA public key modulus. - :type n: str - :param e: Required. RSA public key exponent. - :type e: str + :vartype alg: str or ~video_analyzer_management_client.models.AccessPolicyRsaAlgo + :ivar n: Required. RSA public key modulus. + :vartype n: str + :ivar e: Required. RSA public key exponent. + :vartype e: str """ _validation = { @@ -2631,6 +3071,18 @@ def __init__( e: str, **kwargs ): + """ + :keyword kid: Required. JWT token key id. Validation keys are looked up based on the key id + present on the JWT token header. + :paramtype kid: str + :keyword alg: Required. RSA algorithm to be used: RS256, RS384 or RS512. Possible values + include: "RS256", "RS384", "RS512". + :paramtype alg: str or ~video_analyzer_management_client.models.AccessPolicyRsaAlgo + :keyword n: Required. RSA public key modulus. + :paramtype n: str + :keyword e: Required. RSA public key exponent. + :paramtype e: str + """ super(RsaTokenKey, self).__init__(kid=kid, **kwargs) self.type = '#Microsoft.VideoAnalyzer.RsaTokenKey' # type: str self.alg = alg @@ -2646,10 +3098,10 @@ class SourceNodeBase(NodeBase): All required parameters must be populated in order to send to Azure. - :param type: Required. The discriminator for derived types.Constant filled by server. - :type type: str - :param name: Required. Node name. Must be unique within the topology. - :type name: str + :ivar type: Required. The discriminator for derived types.Constant filled by server. + :vartype type: str + :ivar name: Required. Node name. Must be unique within the topology. + :vartype name: str """ _validation = { @@ -2672,6 +3124,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. Node name. Must be unique within the topology. + :paramtype name: str + """ super(SourceNodeBase, self).__init__(name=name, **kwargs) self.type = '#Microsoft.VideoAnalyzer.SourceNodeBase' # type: str @@ -2681,20 +3137,20 @@ class RtspSource(SourceNodeBase): All required parameters must be populated in order to send to Azure. - :param type: Required. The discriminator for derived types.Constant filled by server. - :type type: str - :param name: Required. Node name. Must be unique within the topology. - :type name: str - :param transport: Network transport utilized by the RTSP and RTP exchange: TCP or HTTP. When + :ivar type: Required. The discriminator for derived types.Constant filled by server. + :vartype type: str + :ivar name: Required. Node name. Must be unique within the topology. + :vartype name: str + :ivar transport: Network transport utilized by the RTSP and RTP exchange: TCP or HTTP. When using TCP, the RTP packets are interleaved on the TCP RTSP connection. When using HTTP, the RTSP messages are exchanged through long lived HTTP connections, and the RTP packages are interleaved in the HTTP connections alongside the RTSP messages. Possible values include: "Http", "Tcp". - :type transport: str or ~video_analyzer.models.RtspTransport - :param endpoint: Required. RTSP endpoint information for Video Analyzer to connect to. This + :vartype transport: str or ~video_analyzer_management_client.models.RtspTransport + :ivar endpoint: Required. RTSP endpoint information for Video Analyzer to connect to. This contains the required information for Video Analyzer to connect to RTSP cameras and/or generic RTSP servers. - :type endpoint: ~video_analyzer.models.EndpointBase + :vartype endpoint: ~video_analyzer_management_client.models.EndpointBase """ _validation = { @@ -2718,6 +3174,20 @@ def __init__( transport: Optional[Union[str, "RtspTransport"]] = None, **kwargs ): + """ + :keyword name: Required. Node name. Must be unique within the topology. + :paramtype name: str + :keyword transport: Network transport utilized by the RTSP and RTP exchange: TCP or HTTP. When + using TCP, the RTP packets are interleaved on the TCP RTSP connection. When using HTTP, the + RTSP messages are exchanged through long lived HTTP connections, and the RTP packages are + interleaved in the HTTP connections alongside the RTSP messages. Possible values include: + "Http", "Tcp". + :paramtype transport: str or ~video_analyzer_management_client.models.RtspTransport + :keyword endpoint: Required. RTSP endpoint information for Video Analyzer to connect to. This + contains the required information for Video Analyzer to connect to RTSP cameras and/or generic + RTSP servers. + :paramtype endpoint: ~video_analyzer_management_client.models.EndpointBase + """ super(RtspSource, self).__init__(name=name, **kwargs) self.type = '#Microsoft.VideoAnalyzer.RtspSource' # type: str self.transport = transport @@ -2732,8 +3202,8 @@ class TunnelBase(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The discriminator for derived types.Constant filled by server. - :type type: str + :ivar type: Required. The discriminator for derived types.Constant filled by server. + :vartype type: str """ _validation = { @@ -2752,6 +3222,8 @@ def __init__( self, **kwargs ): + """ + """ super(TunnelBase, self).__init__(**kwargs) self.type = None # type: Optional[str] @@ -2761,13 +3233,13 @@ class SecureIotDeviceRemoteTunnel(TunnelBase): All required parameters must be populated in order to send to Azure. - :param type: Required. The discriminator for derived types.Constant filled by server. - :type type: str - :param iot_hub_name: Required. Name of the IoT Hub. - :type iot_hub_name: str - :param device_id: Required. The IoT device id to use when establishing the remote tunnel. This + :ivar type: Required. The discriminator for derived types.Constant filled by server. + :vartype type: str + :ivar iot_hub_name: Required. Name of the IoT Hub. + :vartype iot_hub_name: str + :ivar device_id: Required. The IoT device id to use when establishing the remote tunnel. This string is case-sensitive. - :type device_id: str + :vartype device_id: str """ _validation = { @@ -2789,6 +3261,13 @@ def __init__( device_id: str, **kwargs ): + """ + :keyword iot_hub_name: Required. Name of the IoT Hub. + :paramtype iot_hub_name: str + :keyword device_id: Required. The IoT device id to use when establishing the remote tunnel. + This string is case-sensitive. + :paramtype device_id: str + """ super(SecureIotDeviceRemoteTunnel, self).__init__(**kwargs) self.type = '#Microsoft.VideoAnalyzer.SecureIotDeviceRemoteTunnel' # type: str self.iot_hub_name = iot_hub_name @@ -2801,9 +3280,10 @@ class ServiceSpecification(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar log_specifications: List of log specifications. - :vartype log_specifications: list[~video_analyzer.models.LogSpecification] + :vartype log_specifications: list[~video_analyzer_management_client.models.LogSpecification] :ivar metric_specifications: List of metric specifications. - :vartype metric_specifications: list[~video_analyzer.models.MetricSpecification] + :vartype metric_specifications: + list[~video_analyzer_management_client.models.MetricSpecification] """ _validation = { @@ -2820,6 +3300,8 @@ def __init__( self, **kwargs ): + """ + """ super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = None self.metric_specifications = None @@ -2833,13 +3315,13 @@ class SinkNodeBase(NodeBase): All required parameters must be populated in order to send to Azure. - :param type: Required. The discriminator for derived types.Constant filled by server. - :type type: str - :param name: Required. Node name. Must be unique within the topology. - :type name: str - :param inputs: Required. An array of upstream node references within the topology to be used as + :ivar type: Required. The discriminator for derived types.Constant filled by server. + :vartype type: str + :ivar name: Required. Node name. Must be unique within the topology. + :vartype name: str + :ivar inputs: Required. An array of upstream node references within the topology to be used as inputs for this node. - :type inputs: list[~video_analyzer.models.NodeInput] + :vartype inputs: list[~video_analyzer_management_client.models.NodeInput] """ _validation = { @@ -2865,6 +3347,13 @@ def __init__( inputs: List["NodeInput"], **kwargs ): + """ + :keyword name: Required. Node name. Must be unique within the topology. + :paramtype name: str + :keyword inputs: Required. An array of upstream node references within the topology to be used + as inputs for this node. + :paramtype inputs: list[~video_analyzer_management_client.models.NodeInput] + """ super(SinkNodeBase, self).__init__(name=name, **kwargs) self.type = '#Microsoft.VideoAnalyzer.SinkNodeBase' # type: str self.inputs = inputs @@ -2877,10 +3366,10 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The SKU name. Possible values include: "Live_S1", "Batch_S1". - :type name: str or ~video_analyzer.models.SkuName + :ivar name: Required. The SKU name. Possible values include: "Live_S1", "Batch_S1". + :vartype name: str or ~video_analyzer_management_client.models.SkuName :ivar tier: The SKU tier. Possible values include: "Standard". - :vartype tier: str or ~video_analyzer.models.SkuTier + :vartype tier: str or ~video_analyzer_management_client.models.SkuTier """ _validation = { @@ -2899,6 +3388,10 @@ def __init__( name: Union[str, "SkuName"], **kwargs ): + """ + :keyword name: Required. The SKU name. Possible values include: "Live_S1", "Batch_S1". + :paramtype name: str or ~video_analyzer_management_client.models.SkuName + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = None @@ -2911,12 +3404,12 @@ class StorageAccount(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. The ID of the storage account resource. Video Analyzer relies on tables, + :ivar id: Required. The ID of the storage account resource. Video Analyzer relies on tables, queues, and blobs. The primary storage account must be a Standard Storage account (either Microsoft.ClassicStorage or Microsoft.Storage). - :type id: str - :param identity: A managed identity that Video Analyzer will use to access the storage account. - :type identity: ~video_analyzer.models.ResourceIdentity + :vartype id: str + :ivar identity: A managed identity that Video Analyzer will use to access the storage account. + :vartype identity: ~video_analyzer_management_client.models.ResourceIdentity :ivar status: The current status of the storage account mapping. :vartype status: str """ @@ -2939,6 +3432,15 @@ def __init__( identity: Optional["ResourceIdentity"] = None, **kwargs ): + """ + :keyword id: Required. The ID of the storage account resource. Video Analyzer relies on tables, + queues, and blobs. The primary storage account must be a Standard Storage account (either + Microsoft.ClassicStorage or Microsoft.Storage). + :paramtype id: str + :keyword identity: A managed identity that Video Analyzer will use to access the storage + account. + :paramtype identity: ~video_analyzer_management_client.models.ResourceIdentity + """ super(StorageAccount, self).__init__(**kwargs) self.id = id self.identity = identity @@ -2948,20 +3450,20 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~video_analyzer.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :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 ~video_analyzer_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". - :type last_modified_by_type: str or ~video_analyzer.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~video_analyzer_management_client.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -2984,6 +3486,22 @@ def __init__( 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 ~video_analyzer_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 ~video_analyzer_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 @@ -3001,8 +3519,8 @@ class TimeSequenceBase(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The discriminator for derived types.Constant filled by server. - :type type: str + :ivar type: Required. The discriminator for derived types.Constant filled by server. + :vartype type: str """ _validation = { @@ -3021,6 +3539,8 @@ def __init__( self, **kwargs ): + """ + """ super(TimeSequenceBase, self).__init__(**kwargs) self.type = None # type: Optional[str] @@ -3030,22 +3550,22 @@ class TlsEndpoint(EndpointBase): All required parameters must be populated in order to send to Azure. - :param type: Required. The discriminator for derived types.Constant filled by server. - :type type: str - :param credentials: Required. Credentials to be presented to the endpoint. - :type credentials: ~video_analyzer.models.CredentialsBase - :param url: Required. The endpoint URL for Video Analyzer to connect to. - :type url: str - :param tunnel: Describes the tunnel through which Video Analyzer can connect to the endpoint + :ivar type: Required. The discriminator for derived types.Constant filled by server. + :vartype type: str + :ivar credentials: Required. Credentials to be presented to the endpoint. + :vartype credentials: ~video_analyzer_management_client.models.CredentialsBase + :ivar url: Required. The endpoint URL for Video Analyzer to connect to. + :vartype url: str + :ivar tunnel: Describes the tunnel through which Video Analyzer can connect to the endpoint URL. This is an optional property, typically used when the endpoint is behind a firewall. - :type tunnel: ~video_analyzer.models.TunnelBase - :param trusted_certificates: List of trusted certificate authorities when authenticating a TLS + :vartype tunnel: ~video_analyzer_management_client.models.TunnelBase + :ivar trusted_certificates: List of trusted certificate authorities when authenticating a TLS connection. A null list designates that Azure Video Analyzer's list of trusted authorities should be used. - :type trusted_certificates: ~video_analyzer.models.CertificateSource - :param validation_options: Validation options to use when authenticating a TLS connection. By + :vartype trusted_certificates: ~video_analyzer_management_client.models.CertificateSource + :ivar validation_options: Validation options to use when authenticating a TLS connection. By default, strict validation is used. - :type validation_options: ~video_analyzer.models.TlsValidationOptions + :vartype validation_options: ~video_analyzer_management_client.models.TlsValidationOptions """ _validation = { @@ -3073,6 +3593,22 @@ def __init__( validation_options: Optional["TlsValidationOptions"] = None, **kwargs ): + """ + :keyword credentials: Required. Credentials to be presented to the endpoint. + :paramtype credentials: ~video_analyzer_management_client.models.CredentialsBase + :keyword url: Required. The endpoint URL for Video Analyzer to connect to. + :paramtype url: str + :keyword tunnel: Describes the tunnel through which Video Analyzer can connect to the endpoint + URL. This is an optional property, typically used when the endpoint is behind a firewall. + :paramtype tunnel: ~video_analyzer_management_client.models.TunnelBase + :keyword trusted_certificates: List of trusted certificate authorities when authenticating a + TLS connection. A null list designates that Azure Video Analyzer's list of trusted authorities + should be used. + :paramtype trusted_certificates: ~video_analyzer_management_client.models.CertificateSource + :keyword validation_options: Validation options to use when authenticating a TLS connection. By + default, strict validation is used. + :paramtype validation_options: ~video_analyzer_management_client.models.TlsValidationOptions + """ super(TlsEndpoint, self).__init__(credentials=credentials, url=url, tunnel=tunnel, **kwargs) self.type = '#Microsoft.VideoAnalyzer.TlsEndpoint' # type: str self.trusted_certificates = trusted_certificates @@ -3082,12 +3618,12 @@ def __init__( class TlsValidationOptions(msrest.serialization.Model): """Options for controlling the validation of TLS endpoints. - :param ignore_hostname: When set to 'true' causes the certificate subject name validation to be + :ivar ignore_hostname: When set to 'true' causes the certificate subject name validation to be skipped. Default is 'false'. - :type ignore_hostname: str - :param ignore_signature: When set to 'true' causes the certificate chain trust validation to be + :vartype ignore_hostname: str + :ivar ignore_signature: When set to 'true' causes the certificate chain trust validation to be skipped. Default is 'false'. - :type ignore_signature: str + :vartype ignore_signature: str """ _attribute_map = { @@ -3102,6 +3638,14 @@ def __init__( ignore_signature: Optional[str] = None, **kwargs ): + """ + :keyword ignore_hostname: When set to 'true' causes the certificate subject name validation to + be skipped. Default is 'false'. + :paramtype ignore_hostname: str + :keyword ignore_signature: When set to 'true' causes the certificate chain trust validation to + be skipped. Default is 'false'. + :paramtype ignore_signature: str + """ super(TlsValidationOptions, self).__init__(**kwargs) self.ignore_hostname = ignore_hostname self.ignore_signature = ignore_signature @@ -3112,10 +3656,10 @@ class TokenClaim(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the claim which must be present on the token. - :type name: str - :param value: Required. Expected value of the claim to be present on the token. - :type value: str + :ivar name: Required. Name of the claim which must be present on the token. + :vartype name: str + :ivar value: Required. Expected value of the claim to be present on the token. + :vartype value: str """ _validation = { @@ -3135,6 +3679,12 @@ def __init__( value: str, **kwargs ): + """ + :keyword name: Required. Name of the claim which must be present on the token. + :paramtype name: str + :keyword value: Required. Expected value of the claim to be present on the token. + :paramtype value: str + """ super(TokenClaim, self).__init__(**kwargs) self.name = name self.value = value @@ -3157,11 +3707,11 @@ class TrackedResource(Resource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~video_analyzer.models.SystemData - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :vartype system_data: ~video_analyzer_management_client.models.SystemData + :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 = { @@ -3188,6 +3738,12 @@ def __init__( 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 @@ -3198,15 +3754,15 @@ class UnsecuredEndpoint(EndpointBase): All required parameters must be populated in order to send to Azure. - :param type: Required. The discriminator for derived types.Constant filled by server. - :type type: str - :param credentials: Required. Credentials to be presented to the endpoint. - :type credentials: ~video_analyzer.models.CredentialsBase - :param url: Required. The endpoint URL for Video Analyzer to connect to. - :type url: str - :param tunnel: Describes the tunnel through which Video Analyzer can connect to the endpoint + :ivar type: Required. The discriminator for derived types.Constant filled by server. + :vartype type: str + :ivar credentials: Required. Credentials to be presented to the endpoint. + :vartype credentials: ~video_analyzer_management_client.models.CredentialsBase + :ivar url: Required. The endpoint URL for Video Analyzer to connect to. + :vartype url: str + :ivar tunnel: Describes the tunnel through which Video Analyzer can connect to the endpoint URL. This is an optional property, typically used when the endpoint is behind a firewall. - :type tunnel: ~video_analyzer.models.TunnelBase + :vartype tunnel: ~video_analyzer_management_client.models.TunnelBase """ _validation = { @@ -3230,6 +3786,15 @@ def __init__( tunnel: Optional["TunnelBase"] = None, **kwargs ): + """ + :keyword credentials: Required. Credentials to be presented to the endpoint. + :paramtype credentials: ~video_analyzer_management_client.models.CredentialsBase + :keyword url: Required. The endpoint URL for Video Analyzer to connect to. + :paramtype url: str + :keyword tunnel: Describes the tunnel through which Video Analyzer can connect to the endpoint + URL. This is an optional property, typically used when the endpoint is behind a firewall. + :paramtype tunnel: ~video_analyzer_management_client.models.TunnelBase + """ super(UnsecuredEndpoint, self).__init__(credentials=credentials, url=url, tunnel=tunnel, **kwargs) self.type = '#Microsoft.VideoAnalyzer.UnsecuredEndpoint' # type: str @@ -3259,6 +3824,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserAssignedManagedIdentity, self).__init__(**kwargs) self.client_id = None self.principal_id = None @@ -3269,14 +3836,14 @@ class UsernamePasswordCredentials(CredentialsBase): All required parameters must be populated in order to send to Azure. - :param type: Required. The discriminator for derived types.Constant filled by server. - :type type: str - :param username: Required. Username to be presented as part of the credentials. - :type username: str - :param password: Required. Password to be presented as part of the credentials. It is + :ivar type: Required. The discriminator for derived types.Constant filled by server. + :vartype type: str + :ivar username: Required. Username to be presented as part of the credentials. + :vartype username: str + :ivar password: Required. Password to be presented as part of the credentials. It is recommended that this value is parameterized as a secret string in order to prevent this value to be returned as part of the resource on API requests. - :type password: str + :vartype password: str """ _validation = { @@ -3298,6 +3865,14 @@ def __init__( password: str, **kwargs ): + """ + :keyword username: Required. Username to be presented as part of the credentials. + :paramtype username: str + :keyword password: Required. Password to be presented as part of the credentials. It is + recommended that this value is parameterized as a secret string in order to prevent this value + to be returned as part of the resource on API requests. + :paramtype password: str + """ super(UsernamePasswordCredentials, self).__init__(**kwargs) self.type = '#Microsoft.VideoAnalyzer.UsernamePasswordCredentials' # type: str self.username = username @@ -3321,32 +3896,34 @@ class VideoAnalyzer(TrackedResource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~video_analyzer.models.SystemData - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param identity: The identities associated to the Video Analyzer resource. - :type identity: ~video_analyzer.models.VideoAnalyzerIdentity - :param storage_accounts: The storage accounts for this resource. - :type storage_accounts: list[~video_analyzer.models.StorageAccount] + :vartype system_data: ~video_analyzer_management_client.models.SystemData + :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: The identities associated to the Video Analyzer resource. + :vartype identity: ~video_analyzer_management_client.models.VideoAnalyzerIdentity + :ivar storage_accounts: The storage accounts for this resource. + :vartype storage_accounts: list[~video_analyzer_management_client.models.StorageAccount] :ivar endpoints: The endpoints associated with this resource. - :vartype endpoints: list[~video_analyzer.models.Endpoint] - :param encryption: The account encryption properties. - :type encryption: ~video_analyzer.models.AccountEncryption - :param iot_hubs: The IoT Hubs for this resource. - :type iot_hubs: list[~video_analyzer.models.IotHub] - :param public_network_access: Whether or not public network access is allowed for resources + :vartype endpoints: list[~video_analyzer_management_client.models.Endpoint] + :ivar encryption: The account encryption properties. + :vartype encryption: ~video_analyzer_management_client.models.AccountEncryption + :ivar iot_hubs: The IoT Hubs for this resource. + :vartype iot_hubs: list[~video_analyzer_management_client.models.IotHub] + :ivar public_network_access: Whether or not public network access is allowed for resources under the Video Analyzer account. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or ~video_analyzer.models.PublicNetworkAccess - :param network_access_control: Network access control for Video Analyzer. - :type network_access_control: ~video_analyzer.models.NetworkAccessControl + :vartype public_network_access: str or + ~video_analyzer_management_client.models.PublicNetworkAccess + :ivar network_access_control: Network access control for Video Analyzer. + :vartype network_access_control: ~video_analyzer_management_client.models.NetworkAccessControl :ivar provisioning_state: Provisioning state of the Video Analyzer account. Possible values include: "Failed", "InProgress", "Succeeded". - :vartype provisioning_state: str or ~video_analyzer.models.ProvisioningState + :vartype provisioning_state: str or ~video_analyzer_management_client.models.ProvisioningState :ivar private_endpoint_connections: Private Endpoint Connections created under Video Analyzer account. - :vartype private_endpoint_connections: list[~video_analyzer.models.PrivateEndpointConnection] + :vartype private_endpoint_connections: + list[~video_analyzer_management_client.models.PrivateEndpointConnection] """ _validation = { @@ -3391,6 +3968,27 @@ def __init__( network_access_control: Optional["NetworkAccessControl"] = 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: The identities associated to the Video Analyzer resource. + :paramtype identity: ~video_analyzer_management_client.models.VideoAnalyzerIdentity + :keyword storage_accounts: The storage accounts for this resource. + :paramtype storage_accounts: list[~video_analyzer_management_client.models.StorageAccount] + :keyword encryption: The account encryption properties. + :paramtype encryption: ~video_analyzer_management_client.models.AccountEncryption + :keyword iot_hubs: The IoT Hubs for this resource. + :paramtype iot_hubs: list[~video_analyzer_management_client.models.IotHub] + :keyword public_network_access: Whether or not public network access is allowed for resources + under the Video Analyzer account. Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or + ~video_analyzer_management_client.models.PublicNetworkAccess + :keyword network_access_control: Network access control for Video Analyzer. + :paramtype network_access_control: + ~video_analyzer_management_client.models.NetworkAccessControl + """ super(VideoAnalyzer, self).__init__(tags=tags, location=location, **kwargs) self.identity = identity self.storage_accounts = storage_accounts @@ -3406,8 +4004,8 @@ def __init__( class VideoAnalyzerCollection(msrest.serialization.Model): """A collection of VideoAnalyzer items. - :param value: A collection of VideoAnalyzer items. - :type value: list[~video_analyzer.models.VideoAnalyzer] + :ivar value: A collection of VideoAnalyzer items. + :vartype value: list[~video_analyzer_management_client.models.VideoAnalyzer] """ _attribute_map = { @@ -3420,6 +4018,10 @@ def __init__( value: Optional[List["VideoAnalyzer"]] = None, **kwargs ): + """ + :keyword value: A collection of VideoAnalyzer items. + :paramtype value: list[~video_analyzer_management_client.models.VideoAnalyzer] + """ super(VideoAnalyzerCollection, self).__init__(**kwargs) self.value = value @@ -3429,10 +4031,11 @@ class VideoAnalyzerIdentity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The identity type. - :type type: str - :param user_assigned_identities: The User Assigned Managed Identities. - :type user_assigned_identities: dict[str, ~video_analyzer.models.UserAssignedManagedIdentity] + :ivar type: Required. The identity type. + :vartype type: str + :ivar user_assigned_identities: The User Assigned Managed Identities. + :vartype user_assigned_identities: dict[str, + ~video_analyzer_management_client.models.UserAssignedManagedIdentity] """ _validation = { @@ -3451,6 +4054,13 @@ def __init__( user_assigned_identities: Optional[Dict[str, "UserAssignedManagedIdentity"]] = None, **kwargs ): + """ + :keyword type: Required. The identity type. + :paramtype type: str + :keyword user_assigned_identities: The User Assigned Managed Identities. + :paramtype user_assigned_identities: dict[str, + ~video_analyzer_management_client.models.UserAssignedManagedIdentity] + """ super(VideoAnalyzerIdentity, self).__init__(**kwargs) self.type = type self.user_assigned_identities = user_assigned_identities @@ -3461,18 +4071,18 @@ class VideoAnalyzerOperationStatus(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Operation identifier. - :type name: str - :param id: Operation resource ID. - :type id: str - :param start_time: Operation start time. - :type start_time: str - :param end_time: Operation end time. - :type end_time: str - :param status: Operation status. - :type status: str - :param error: The error detail. - :type error: ~video_analyzer.models.ErrorDetail + :ivar name: Required. Operation identifier. + :vartype name: str + :ivar id: Operation resource ID. + :vartype id: str + :ivar start_time: Operation start time. + :vartype start_time: str + :ivar end_time: Operation end time. + :vartype end_time: str + :ivar status: Operation status. + :vartype status: str + :ivar error: The error detail. + :vartype error: ~video_analyzer_management_client.models.ErrorDetail """ _validation = { @@ -3499,6 +4109,20 @@ def __init__( error: Optional["ErrorDetail"] = None, **kwargs ): + """ + :keyword name: Required. Operation identifier. + :paramtype name: str + :keyword id: Operation resource ID. + :paramtype id: str + :keyword start_time: Operation start time. + :paramtype start_time: str + :keyword end_time: Operation end time. + :paramtype end_time: str + :keyword status: Operation status. + :paramtype status: str + :keyword error: The error detail. + :paramtype error: ~video_analyzer_management_client.models.ErrorDetail + """ super(VideoAnalyzerOperationStatus, self).__init__(**kwargs) self.name = name self.id = id @@ -3513,18 +4137,18 @@ class VideoAnalyzerPrivateEndpointConnectionOperationStatus(msrest.serialization All required parameters must be populated in order to send to Azure. - :param name: Required. Operation identifier. - :type name: str - :param id: Operation resource ID. - :type id: str - :param start_time: Operation start time. - :type start_time: str - :param end_time: Operation end time. - :type end_time: str - :param status: Operation status. - :type status: str - :param error: The error detail. - :type error: ~video_analyzer.models.ErrorDetail + :ivar name: Required. Operation identifier. + :vartype name: str + :ivar id: Operation resource ID. + :vartype id: str + :ivar start_time: Operation start time. + :vartype start_time: str + :ivar end_time: Operation end time. + :vartype end_time: str + :ivar status: Operation status. + :vartype status: str + :ivar error: The error detail. + :vartype error: ~video_analyzer_management_client.models.ErrorDetail """ _validation = { @@ -3551,6 +4175,20 @@ def __init__( error: Optional["ErrorDetail"] = None, **kwargs ): + """ + :keyword name: Required. Operation identifier. + :paramtype name: str + :keyword id: Operation resource ID. + :paramtype id: str + :keyword start_time: Operation start time. + :paramtype start_time: str + :keyword end_time: Operation end time. + :paramtype end_time: str + :keyword status: Operation status. + :paramtype status: str + :keyword error: The error detail. + :paramtype error: ~video_analyzer_management_client.models.ErrorDetail + """ super(VideoAnalyzerPrivateEndpointConnectionOperationStatus, self).__init__(**kwargs) self.name = name self.id = id @@ -3565,29 +4203,31 @@ class VideoAnalyzerUpdate(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param identity: The identities associated to the Video Analyzer resource. - :type identity: ~video_analyzer.models.VideoAnalyzerIdentity - :param storage_accounts: The storage accounts for this resource. - :type storage_accounts: list[~video_analyzer.models.StorageAccount] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar identity: The identities associated to the Video Analyzer resource. + :vartype identity: ~video_analyzer_management_client.models.VideoAnalyzerIdentity + :ivar storage_accounts: The storage accounts for this resource. + :vartype storage_accounts: list[~video_analyzer_management_client.models.StorageAccount] :ivar endpoints: The endpoints associated with this resource. - :vartype endpoints: list[~video_analyzer.models.Endpoint] - :param encryption: The account encryption properties. - :type encryption: ~video_analyzer.models.AccountEncryption - :param iot_hubs: The IoT Hubs for this resource. - :type iot_hubs: list[~video_analyzer.models.IotHub] - :param public_network_access: Whether or not public network access is allowed for resources + :vartype endpoints: list[~video_analyzer_management_client.models.Endpoint] + :ivar encryption: The account encryption properties. + :vartype encryption: ~video_analyzer_management_client.models.AccountEncryption + :ivar iot_hubs: The IoT Hubs for this resource. + :vartype iot_hubs: list[~video_analyzer_management_client.models.IotHub] + :ivar public_network_access: Whether or not public network access is allowed for resources under the Video Analyzer account. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or ~video_analyzer.models.PublicNetworkAccess - :param network_access_control: Network access control for Video Analyzer. - :type network_access_control: ~video_analyzer.models.NetworkAccessControl + :vartype public_network_access: str or + ~video_analyzer_management_client.models.PublicNetworkAccess + :ivar network_access_control: Network access control for Video Analyzer. + :vartype network_access_control: ~video_analyzer_management_client.models.NetworkAccessControl :ivar provisioning_state: Provisioning state of the Video Analyzer account. Possible values include: "Failed", "InProgress", "Succeeded". - :vartype provisioning_state: str or ~video_analyzer.models.ProvisioningState + :vartype provisioning_state: str or ~video_analyzer_management_client.models.ProvisioningState :ivar private_endpoint_connections: Private Endpoint Connections created under Video Analyzer account. - :vartype private_endpoint_connections: list[~video_analyzer.models.PrivateEndpointConnection] + :vartype private_endpoint_connections: + list[~video_analyzer_management_client.models.PrivateEndpointConnection] """ _validation = { @@ -3621,6 +4261,25 @@ def __init__( network_access_control: Optional["NetworkAccessControl"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: The identities associated to the Video Analyzer resource. + :paramtype identity: ~video_analyzer_management_client.models.VideoAnalyzerIdentity + :keyword storage_accounts: The storage accounts for this resource. + :paramtype storage_accounts: list[~video_analyzer_management_client.models.StorageAccount] + :keyword encryption: The account encryption properties. + :paramtype encryption: ~video_analyzer_management_client.models.AccountEncryption + :keyword iot_hubs: The IoT Hubs for this resource. + :paramtype iot_hubs: list[~video_analyzer_management_client.models.IotHub] + :keyword public_network_access: Whether or not public network access is allowed for resources + under the Video Analyzer account. Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or + ~video_analyzer_management_client.models.PublicNetworkAccess + :keyword network_access_control: Network access control for Video Analyzer. + :paramtype network_access_control: + ~video_analyzer_management_client.models.NetworkAccessControl + """ super(VideoAnalyzerUpdate, self).__init__(**kwargs) self.tags = tags self.identity = identity @@ -3637,12 +4296,12 @@ def __init__( class VideoArchival(msrest.serialization.Model): """Video archival properties. - :param retention_period: Video retention period indicates the maximum age of the video archive + :ivar retention_period: Video retention period indicates the maximum age of the video archive segments which are intended to be kept in storage. It must be provided in the ISO8601 duration format in the granularity of days, up to a maximum of 10 years. For example, if this is set to P30D (30 days), content older than 30 days will be periodically deleted. This value can be updated at any time and the new desired retention period will be effective within 24 hours. - :type retention_period: str + :vartype retention_period: str """ _attribute_map = { @@ -3655,6 +4314,15 @@ def __init__( retention_period: Optional[str] = None, **kwargs ): + """ + :keyword retention_period: Video retention period indicates the maximum age of the video + archive segments which are intended to be kept in storage. It must be provided in the ISO8601 + duration format in the granularity of days, up to a maximum of 10 years. For example, if this + is set to P30D (30 days), content older than 30 days will be periodically deleted. This value + can be updated at any time and the new desired retention period will be effective within 24 + hours. + :paramtype retention_period: str + """ super(VideoArchival, self).__init__(**kwargs) self.retention_period = retention_period @@ -3686,6 +4354,8 @@ def __init__( self, **kwargs ): + """ + """ super(VideoContentToken, self).__init__(**kwargs) self.expiration_date = None self.token = None @@ -3694,12 +4364,12 @@ def __init__( class VideoContentUrls(msrest.serialization.Model): """Set of URLs to the video content. - :param download_url: Video file download URL. This URL can be used in conjunction with the - video content authorization token to download the video MP4 file. The resulting MP4 file can be + :ivar download_url: Video file download URL. This URL can be used in conjunction with the video + content authorization token to download the video MP4 file. The resulting MP4 file can be played on any standard media player. It is available when the video type is 'file' and video file is available for consumption. - :type download_url: str - :param archive_base_url: Video archive streaming base URL. The archived content can be + :vartype download_url: str + :ivar archive_base_url: Video archive streaming base URL. The archived content can be automatically played by the Azure Video Analyzer player widget. Alternatively, this URL can be used in conjunction with the video content authorization token on any compatible DASH or HLS players by appending the following to the base URL: @@ -3713,18 +4383,18 @@ class VideoContentUrls(msrest.serialization.Model): Moreover, an ongoing video recording can be played in "live mode" with latencies which are approximately double of the chosen video segment length. It is available when the video type is 'archive' and video archiving is enabled. - :type archive_base_url: str - :param rtsp_tunnel_url: Video low-latency streaming URL. The live content can be automatically + :vartype archive_base_url: str + :ivar rtsp_tunnel_url: Video low-latency streaming URL. The live content can be automatically played by the Azure Video Analyzer player widget. Alternatively, this URL can be used in conjunction with the video content authorization token to expose a WebSocket tunneled RTSP stream. It is available when the video type is 'archive' and a live, low-latency feed is available from the source. - :type rtsp_tunnel_url: str - :param preview_image_urls: Video preview image URLs. These URLs can be used in conjunction with + :vartype rtsp_tunnel_url: str + :ivar preview_image_urls: Video preview image URLs. These URLs can be used in conjunction with the video content authorization token to download the most recent still image from the video archive in different resolutions. They are available when the video type is 'archive' and preview images are enabled. - :type preview_image_urls: ~video_analyzer.models.VideoPreviewImageUrls + :vartype preview_image_urls: ~video_analyzer_management_client.models.VideoPreviewImageUrls """ _attribute_map = { @@ -3743,6 +4413,39 @@ def __init__( preview_image_urls: Optional["VideoPreviewImageUrls"] = None, **kwargs ): + """ + :keyword download_url: Video file download URL. This URL can be used in conjunction with the + video content authorization token to download the video MP4 file. The resulting MP4 file can be + played on any standard media player. It is available when the video type is 'file' and video + file is available for consumption. + :paramtype download_url: str + :keyword archive_base_url: Video archive streaming base URL. The archived content can be + automatically played by the Azure Video Analyzer player widget. Alternatively, this URL can be + used in conjunction with the video content authorization token on any compatible DASH or HLS + players by appending the following to the base URL: + + .. code-block:: + + - HLSv4: /manifest(format=m3u8-aapl).m3u8 + - HLS CMAF: /manifest(format=m3u8-cmaf) + - DASH CMAF: /manifest(format=mpd-time-cmaf) + + Moreover, an ongoing video recording can be played in "live mode" with latencies which are + approximately double of the chosen video segment length. It is available when the video type is + 'archive' and video archiving is enabled. + :paramtype archive_base_url: str + :keyword rtsp_tunnel_url: Video low-latency streaming URL. The live content can be + automatically played by the Azure Video Analyzer player widget. Alternatively, this URL can be + used in conjunction with the video content authorization token to expose a WebSocket tunneled + RTSP stream. It is available when the video type is 'archive' and a live, low-latency feed is + available from the source. + :paramtype rtsp_tunnel_url: str + :keyword preview_image_urls: Video preview image URLs. These URLs can be used in conjunction + with the video content authorization token to download the most recent still image from the + video archive in different resolutions. They are available when the video type is 'archive' and + preview images are enabled. + :paramtype preview_image_urls: ~video_analyzer_management_client.models.VideoPreviewImageUrls + """ super(VideoContentUrls, self).__init__(**kwargs) self.download_url = download_url self.archive_base_url = archive_base_url @@ -3753,12 +4456,12 @@ def __init__( class VideoCreationProperties(msrest.serialization.Model): """Optional properties to be used in case a new video resource needs to be created on the service. These will not take effect if the video already exists. - :param title: Optional title provided by the user. Value can be up to 256 characters long. - :type title: str - :param description: Optional description provided by the user. Value can be up to 2048 + :ivar title: Optional title provided by the user. Value can be up to 256 characters long. + :vartype title: str + :ivar description: Optional description provided by the user. Value can be up to 2048 characters long. - :type description: str - :param segment_length: Segment length indicates the length of individual content files + :vartype description: str + :ivar segment_length: Segment length indicates the length of individual content files (segments) which are persisted to storage. Smaller segments provide lower archive playback latency but generate larger volume of storage transactions. Larger segments reduce the amount of storage transactions while increasing the archive playback latency. Value must be specified @@ -3766,13 +4469,13 @@ class VideoCreationProperties(msrest.serialization.Model): 5 minutes, in 30 seconds increments. Changing this value after the initial call to create the video resource can lead to errors when uploading content to the archive. Default value is 30 seconds. This property is only allowed for topologies where "kind" is set to "live". - :type segment_length: str - :param retention_period: Video retention period indicates how long the video is kept in - storage. Value must be specified in ISO8601 duration format (i.e. "P1D" equals 1 day) and can - vary between 1 day to 10 years, in 1 day increments. When absent (null), all video content is + :vartype segment_length: str + :ivar retention_period: Video retention period indicates how long the video is kept in storage. + Value must be specified in ISO8601 duration format (i.e. "P1D" equals 1 day) and can vary + between 1 day to 10 years, in 1 day increments. When absent (null), all video content is retained indefinitely. This property is only allowed for topologies where "kind" is set to "live". - :type retention_period: str + :vartype retention_period: str """ _attribute_map = { @@ -3791,6 +4494,28 @@ def __init__( retention_period: Optional[str] = None, **kwargs ): + """ + :keyword title: Optional title provided by the user. Value can be up to 256 characters long. + :paramtype title: str + :keyword description: Optional description provided by the user. Value can be up to 2048 + characters long. + :paramtype description: str + :keyword segment_length: Segment length indicates the length of individual content files + (segments) which are persisted to storage. Smaller segments provide lower archive playback + latency but generate larger volume of storage transactions. Larger segments reduce the amount + of storage transactions while increasing the archive playback latency. Value must be specified + in ISO8601 duration format (i.e. "PT30S" equals 30 seconds) and can vary between 30 seconds to + 5 minutes, in 30 seconds increments. Changing this value after the initial call to create the + video resource can lead to errors when uploading content to the archive. Default value is 30 + seconds. This property is only allowed for topologies where "kind" is set to "live". + :paramtype segment_length: str + :keyword retention_period: Video retention period indicates how long the video is kept in + storage. Value must be specified in ISO8601 duration format (i.e. "P1D" equals 1 day) and can + vary between 1 day to 10 years, in 1 day increments. When absent (null), all video content is + retained indefinitely. This property is only allowed for topologies where "kind" is set to + "live". + :paramtype retention_period: str + """ super(VideoCreationProperties, self).__init__(**kwargs) self.title = title self.description = description @@ -3806,19 +4531,19 @@ class VideoEncoderBase(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The discriminator for derived types.Constant filled by server. - :type type: str - :param bitrate_kbps: The maximum bitrate, in kilobits per second or Kbps, at which video should + :ivar type: Required. The discriminator for derived types.Constant filled by server. + :vartype type: str + :ivar bitrate_kbps: The maximum bitrate, in kilobits per second or Kbps, at which video should be encoded. If omitted, encoder sets it automatically to try and match the quality of the input video. - :type bitrate_kbps: str - :param frame_rate: The frame rate (in frames per second) of the encoded video. The value must - be greater than zero, and less than or equal to 300. If omitted, the encoder uses the average + :vartype bitrate_kbps: str + :ivar frame_rate: The frame rate (in frames per second) of the encoded video. The value must be + greater than zero, and less than or equal to 300. If omitted, the encoder uses the average frame rate of the input video. - :type frame_rate: str - :param scale: Describes the resolution of the encoded video. If omitted, the encoder uses the + :vartype frame_rate: str + :ivar scale: Describes the resolution of the encoded video. If omitted, the encoder uses the resolution of the input video. - :type scale: ~video_analyzer.models.VideoScale + :vartype scale: ~video_analyzer_management_client.models.VideoScale """ _validation = { @@ -3844,6 +4569,19 @@ def __init__( scale: Optional["VideoScale"] = None, **kwargs ): + """ + :keyword bitrate_kbps: The maximum bitrate, in kilobits per second or Kbps, at which video + should be encoded. If omitted, encoder sets it automatically to try and match the quality of + the input video. + :paramtype bitrate_kbps: str + :keyword frame_rate: The frame rate (in frames per second) of the encoded video. The value must + be greater than zero, and less than or equal to 300. If omitted, the encoder uses the average + frame rate of the input video. + :paramtype frame_rate: str + :keyword scale: Describes the resolution of the encoded video. If omitted, the encoder uses the + resolution of the input video. + :paramtype scale: ~video_analyzer_management_client.models.VideoScale + """ super(VideoEncoderBase, self).__init__(**kwargs) self.type = None # type: Optional[str] self.bitrate_kbps = bitrate_kbps @@ -3856,19 +4594,19 @@ class VideoEncoderH264(VideoEncoderBase): All required parameters must be populated in order to send to Azure. - :param type: Required. The discriminator for derived types.Constant filled by server. - :type type: str - :param bitrate_kbps: The maximum bitrate, in kilobits per second or Kbps, at which video should + :ivar type: Required. The discriminator for derived types.Constant filled by server. + :vartype type: str + :ivar bitrate_kbps: The maximum bitrate, in kilobits per second or Kbps, at which video should be encoded. If omitted, encoder sets it automatically to try and match the quality of the input video. - :type bitrate_kbps: str - :param frame_rate: The frame rate (in frames per second) of the encoded video. The value must - be greater than zero, and less than or equal to 300. If omitted, the encoder uses the average + :vartype bitrate_kbps: str + :ivar frame_rate: The frame rate (in frames per second) of the encoded video. The value must be + greater than zero, and less than or equal to 300. If omitted, the encoder uses the average frame rate of the input video. - :type frame_rate: str - :param scale: Describes the resolution of the encoded video. If omitted, the encoder uses the + :vartype frame_rate: str + :ivar scale: Describes the resolution of the encoded video. If omitted, the encoder uses the resolution of the input video. - :type scale: ~video_analyzer.models.VideoScale + :vartype scale: ~video_analyzer_management_client.models.VideoScale """ _validation = { @@ -3890,6 +4628,19 @@ def __init__( scale: Optional["VideoScale"] = None, **kwargs ): + """ + :keyword bitrate_kbps: The maximum bitrate, in kilobits per second or Kbps, at which video + should be encoded. If omitted, encoder sets it automatically to try and match the quality of + the input video. + :paramtype bitrate_kbps: str + :keyword frame_rate: The frame rate (in frames per second) of the encoded video. The value must + be greater than zero, and less than or equal to 300. If omitted, the encoder uses the average + frame rate of the input video. + :paramtype frame_rate: str + :keyword scale: Describes the resolution of the encoded video. If omitted, the encoder uses the + resolution of the input video. + :paramtype scale: ~video_analyzer_management_client.models.VideoScale + """ super(VideoEncoderH264, self).__init__(bitrate_kbps=bitrate_kbps, frame_rate=frame_rate, scale=scale, **kwargs) self.type = '#Microsoft.VideoAnalyzer.VideoEncoderH264' # type: str @@ -3909,25 +4660,24 @@ class VideoEntity(ProxyResource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~video_analyzer.models.SystemData - :param title: Optional video title provided by the user. Value can be up to 256 characters - long. - :type title: str - :param description: Optional video description provided by the user. Value can be up to 2048 + :vartype system_data: ~video_analyzer_management_client.models.SystemData + :ivar title: Optional video title provided by the user. Value can be up to 256 characters long. + :vartype title: str + :ivar description: Optional video description provided by the user. Value can be up to 2048 characters long. - :type description: str + :vartype description: str :ivar type_properties_type: Video content type. Different content types are suitable for different applications and scenarios. Possible values include: "Archive", "File". - :vartype type_properties_type: str or ~video_analyzer.models.VideoType + :vartype type_properties_type: str or ~video_analyzer_management_client.models.VideoType :ivar flags: Video flags contain information about the available video actions and its dynamic properties based on the current video state. - :vartype flags: ~video_analyzer.models.VideoFlags + :vartype flags: ~video_analyzer_management_client.models.VideoFlags :ivar content_urls: Set of URLs to the video content. - :vartype content_urls: ~video_analyzer.models.VideoContentUrls - :param media_info: Contains information about the video and audio content. - :type media_info: ~video_analyzer.models.VideoMediaInfo - :param archival: Video archival properties. - :type archival: ~video_analyzer.models.VideoArchival + :vartype content_urls: ~video_analyzer_management_client.models.VideoContentUrls + :ivar media_info: Contains information about the video and audio content. + :vartype media_info: ~video_analyzer_management_client.models.VideoMediaInfo + :ivar archival: Video archival properties. + :vartype archival: ~video_analyzer_management_client.models.VideoArchival """ _validation = { @@ -3963,6 +4713,18 @@ def __init__( archival: Optional["VideoArchival"] = None, **kwargs ): + """ + :keyword title: Optional video title provided by the user. Value can be up to 256 characters + long. + :paramtype title: str + :keyword description: Optional video description provided by the user. Value can be up to 2048 + characters long. + :paramtype description: str + :keyword media_info: Contains information about the video and audio content. + :paramtype media_info: ~video_analyzer_management_client.models.VideoMediaInfo + :keyword archival: Video archival properties. + :paramtype archival: ~video_analyzer_management_client.models.VideoArchival + """ super(VideoEntity, self).__init__(**kwargs) self.title = title self.description = description @@ -3976,11 +4738,11 @@ def __init__( class VideoEntityCollection(msrest.serialization.Model): """A collection of VideoEntity items. - :param value: A collection of VideoEntity items. - :type value: list[~video_analyzer.models.VideoEntity] - :param next_link: A link to the next page of the collection (when the collection contains too + :ivar value: A collection of VideoEntity items. + :vartype value: list[~video_analyzer_management_client.models.VideoEntity] + :ivar next_link: A link to the next page of the collection (when the collection contains too many results to return in one response). - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -3995,6 +4757,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: A collection of VideoEntity items. + :paramtype value: list[~video_analyzer_management_client.models.VideoEntity] + :keyword next_link: A link to the next page of the collection (when the collection contains too + many results to return in one response). + :paramtype next_link: str + """ super(VideoEntityCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4005,17 +4774,17 @@ class VideoFlags(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param can_stream: Required. Value indicating whether or not the video can be streamed. Only + :ivar can_stream: Required. Value indicating whether or not the video can be streamed. Only "archive" type videos can be streamed. - :type can_stream: bool - :param has_data: Required. Value indicating whether or not there has ever been data recorded or + :vartype can_stream: bool + :ivar has_data: Required. Value indicating whether or not there has ever been data recorded or uploaded into the video. Newly created videos have this value set to false. - :type has_data: bool - :param is_in_use: Required. Value indicating whether or not the video is currently being + :vartype has_data: bool + :ivar is_in_use: Required. Value indicating whether or not the video is currently being referenced be an active pipeline. The fact that is being referenced, doesn't necessarily indicate that data is being received. For example, video recording may be gated on events or camera may not be accessible at the time. - :type is_in_use: bool + :vartype is_in_use: bool """ _validation = { @@ -4038,6 +4807,19 @@ def __init__( is_in_use: bool, **kwargs ): + """ + :keyword can_stream: Required. Value indicating whether or not the video can be streamed. Only + "archive" type videos can be streamed. + :paramtype can_stream: bool + :keyword has_data: Required. Value indicating whether or not there has ever been data recorded + or uploaded into the video. Newly created videos have this value set to false. + :paramtype has_data: bool + :keyword is_in_use: Required. Value indicating whether or not the video is currently being + referenced be an active pipeline. The fact that is being referenced, doesn't necessarily + indicate that data is being received. For example, video recording may be gated on events or + camera may not be accessible at the time. + :paramtype is_in_use: bool + """ super(VideoFlags, self).__init__(**kwargs) self.can_stream = can_stream self.has_data = has_data @@ -4047,13 +4829,13 @@ def __init__( class VideoMediaInfo(msrest.serialization.Model): """Contains information about the video and audio content. - :param segment_length: Video segment length indicates the length of individual video files + :ivar segment_length: Video segment length indicates the length of individual video files (segments) which are persisted to storage. Smaller segments provide lower archive playback latency but generate larger volume of storage transactions. Larger segments reduce the amount of storage transactions while increasing the archive playback latency. Value must be specified in ISO8601 duration format (i.e. "PT30S" equals 30 seconds) and can vary between 30 seconds to 5 minutes, in 30 seconds increments. - :type segment_length: str + :vartype segment_length: str """ _attribute_map = { @@ -4066,6 +4848,15 @@ def __init__( segment_length: Optional[str] = None, **kwargs ): + """ + :keyword segment_length: Video segment length indicates the length of individual video files + (segments) which are persisted to storage. Smaller segments provide lower archive playback + latency but generate larger volume of storage transactions. Larger segments reduce the amount + of storage transactions while increasing the archive playback latency. Value must be specified + in ISO8601 duration format (i.e. "PT30S" equals 30 seconds) and can vary between 30 seconds to + 5 minutes, in 30 seconds increments. + :paramtype segment_length: str + """ super(VideoMediaInfo, self).__init__(**kwargs) self.segment_length = segment_length @@ -4073,12 +4864,12 @@ def __init__( class VideoPreviewImageUrls(msrest.serialization.Model): """Video preview image URLs. These URLs can be used in conjunction with the video content authorization token to download the most recent still image from the video archive in different resolutions. They are available when the video type is 'archive' and preview images are enabled. - :param small: Low resolution preview image URL. - :type small: str - :param medium: Medium resolution preview image URL. - :type medium: str - :param large: High resolution preview image URL. - :type large: str + :ivar small: Low resolution preview image URL. + :vartype small: str + :ivar medium: Medium resolution preview image URL. + :vartype medium: str + :ivar large: High resolution preview image URL. + :vartype large: str """ _attribute_map = { @@ -4095,6 +4886,14 @@ def __init__( large: Optional[str] = None, **kwargs ): + """ + :keyword small: Low resolution preview image URL. + :paramtype small: str + :keyword medium: Medium resolution preview image URL. + :paramtype medium: str + :keyword large: High resolution preview image URL. + :paramtype large: str + """ super(VideoPreviewImageUrls, self).__init__(**kwargs) self.small = small self.medium = medium @@ -4104,15 +4903,15 @@ def __init__( class VideoPublishingOptions(msrest.serialization.Model): """Optional flags used to change how video is published. These are only allowed for topologies where "kind" is set to "live". - :param disable_archive: When set to 'true' content will not be archived or recorded. This is + :ivar disable_archive: When set to 'true' content will not be archived or recorded. This is used, for example, when the topology is used only for low latency video streaming. Default is 'false'. If set to 'true', then "disableRtspPublishing" must be set to 'false'. - :type disable_archive: str - :param disable_rtsp_publishing: When set to 'true' the RTSP playback URL will not be published, + :vartype disable_archive: str + :ivar disable_rtsp_publishing: When set to 'true' the RTSP playback URL will not be published, disabling low latency streaming. This is used, for example, when the topology is used only for archiving content. Default is 'false'. If set to 'true', then "disableArchive" must be set to 'false'. - :type disable_rtsp_publishing: str + :vartype disable_rtsp_publishing: str """ _attribute_map = { @@ -4127,6 +4926,17 @@ def __init__( disable_rtsp_publishing: Optional[str] = None, **kwargs ): + """ + :keyword disable_archive: When set to 'true' content will not be archived or recorded. This is + used, for example, when the topology is used only for low latency video streaming. Default is + 'false'. If set to 'true', then "disableRtspPublishing" must be set to 'false'. + :paramtype disable_archive: str + :keyword disable_rtsp_publishing: When set to 'true' the RTSP playback URL will not be + published, disabling low latency streaming. This is used, for example, when the topology is + used only for archiving content. Default is 'false'. If set to 'true', then "disableArchive" + must be set to 'false'. + :paramtype disable_rtsp_publishing: str + """ super(VideoPublishingOptions, self).__init__(**kwargs) self.disable_archive = disable_archive self.disable_rtsp_publishing = disable_rtsp_publishing @@ -4135,15 +4945,15 @@ def __init__( class VideoScale(msrest.serialization.Model): """The video scaling information. - :param height: The desired output video height. - :type height: str - :param width: The desired output video width. - :type width: str - :param mode: Describes the video scaling mode to be applied. Default mode is 'Pad'. If the mode + :ivar height: The desired output video height. + :vartype height: str + :ivar width: The desired output video width. + :vartype width: str + :ivar mode: Describes the video scaling mode to be applied. Default mode is 'Pad'. If the mode is 'Pad' or 'Stretch' then both width and height must be specified. Else if the mode is 'PreserveAspectRatio' then only one of width or height need be provided. Possible values include: "Pad", "PreserveAspectRatio", "Stretch". - :type mode: str or ~video_analyzer.models.VideoScaleMode + :vartype mode: str or ~video_analyzer_management_client.models.VideoScaleMode """ _attribute_map = { @@ -4160,6 +4970,17 @@ def __init__( mode: Optional[Union[str, "VideoScaleMode"]] = None, **kwargs ): + """ + :keyword height: The desired output video height. + :paramtype height: str + :keyword width: The desired output video width. + :paramtype width: str + :keyword mode: Describes the video scaling mode to be applied. Default mode is 'Pad'. If the + mode is 'Pad' or 'Stretch' then both width and height must be specified. Else if the mode is + 'PreserveAspectRatio' then only one of width or height need be provided. Possible values + include: "Pad", "PreserveAspectRatio", "Stretch". + :paramtype mode: str or ~video_analyzer_management_client.models.VideoScaleMode + """ super(VideoScale, self).__init__(**kwargs) self.height = height self.width = width @@ -4171,11 +4992,11 @@ class VideoSequenceAbsoluteTimeMarkers(TimeSequenceBase): All required parameters must be populated in order to send to Azure. - :param type: Required. The discriminator for derived types.Constant filled by server. - :type type: str - :param ranges: Required. The sequence of datetime ranges. Example: '[["2021-10-05T03:30:00Z", + :ivar type: Required. The discriminator for derived types.Constant filled by server. + :vartype type: str + :ivar ranges: Required. The sequence of datetime ranges. Example: '[["2021-10-05T03:30:00Z", "2021-10-05T03:40:00Z"]]'. - :type ranges: str + :vartype ranges: str """ _validation = { @@ -4194,6 +5015,11 @@ def __init__( ranges: str, **kwargs ): + """ + :keyword ranges: Required. The sequence of datetime ranges. Example: '[["2021-10-05T03:30:00Z", + "2021-10-05T03:40:00Z"]]'. + :paramtype ranges: str + """ super(VideoSequenceAbsoluteTimeMarkers, self).__init__(**kwargs) self.type = '#Microsoft.VideoAnalyzer.VideoSequenceAbsoluteTimeMarkers' # type: str self.ranges = ranges @@ -4204,23 +5030,25 @@ class VideoSink(SinkNodeBase): All required parameters must be populated in order to send to Azure. - :param type: Required. The discriminator for derived types.Constant filled by server. - :type type: str - :param name: Required. Node name. Must be unique within the topology. - :type name: str - :param inputs: Required. An array of upstream node references within the topology to be used as + :ivar type: Required. The discriminator for derived types.Constant filled by server. + :vartype type: str + :ivar name: Required. Node name. Must be unique within the topology. + :vartype name: str + :ivar inputs: Required. An array of upstream node references within the topology to be used as inputs for this node. - :type inputs: list[~video_analyzer.models.NodeInput] - :param video_name: Required. Name of a new or existing video resource used to capture and + :vartype inputs: list[~video_analyzer_management_client.models.NodeInput] + :ivar video_name: Required. Name of a new or existing video resource used to capture and publish content. Note: if downstream of RTSP source, and if disableArchive is set to true, then no content is archived. - :type video_name: str - :param video_creation_properties: Optional video properties to be used in case a new video + :vartype video_name: str + :ivar video_creation_properties: Optional video properties to be used in case a new video resource needs to be created on the service. - :type video_creation_properties: ~video_analyzer.models.VideoCreationProperties - :param video_publishing_options: Options to change how the video sink publishes content via the + :vartype video_creation_properties: + ~video_analyzer_management_client.models.VideoCreationProperties + :ivar video_publishing_options: Options to change how the video sink publishes content via the video resource. This property is only allowed for topologies where "kind" is set to "live". - :type video_publishing_options: ~video_analyzer.models.VideoPublishingOptions + :vartype video_publishing_options: + ~video_analyzer_management_client.models.VideoPublishingOptions """ _validation = { @@ -4249,6 +5077,25 @@ def __init__( video_publishing_options: Optional["VideoPublishingOptions"] = None, **kwargs ): + """ + :keyword name: Required. Node name. Must be unique within the topology. + :paramtype name: str + :keyword inputs: Required. An array of upstream node references within the topology to be used + as inputs for this node. + :paramtype inputs: list[~video_analyzer_management_client.models.NodeInput] + :keyword video_name: Required. Name of a new or existing video resource used to capture and + publish content. Note: if downstream of RTSP source, and if disableArchive is set to true, then + no content is archived. + :paramtype video_name: str + :keyword video_creation_properties: Optional video properties to be used in case a new video + resource needs to be created on the service. + :paramtype video_creation_properties: + ~video_analyzer_management_client.models.VideoCreationProperties + :keyword video_publishing_options: Options to change how the video sink publishes content via + the video resource. This property is only allowed for topologies where "kind" is set to "live". + :paramtype video_publishing_options: + ~video_analyzer_management_client.models.VideoPublishingOptions + """ super(VideoSink, self).__init__(name=name, inputs=inputs, **kwargs) self.type = '#Microsoft.VideoAnalyzer.VideoSink' # type: str self.video_name = video_name @@ -4261,16 +5108,15 @@ class VideoSource(SourceNodeBase): All required parameters must be populated in order to send to Azure. - :param type: Required. The discriminator for derived types.Constant filled by server. - :type type: str - :param name: Required. Node name. Must be unique within the topology. - :type name: str - :param video_name: Required. Name of the Video Analyzer video resource to be used as the - source. - :type video_name: str - :param time_sequences: Required. Describes a sequence of datetime ranges. The video source only + :ivar type: Required. The discriminator for derived types.Constant filled by server. + :vartype type: str + :ivar name: Required. Node name. Must be unique within the topology. + :vartype name: str + :ivar video_name: Required. Name of the Video Analyzer video resource to be used as the source. + :vartype video_name: str + :ivar time_sequences: Required. Describes a sequence of datetime ranges. The video source only picks up recorded media within these ranges. - :type time_sequences: ~video_analyzer.models.TimeSequenceBase + :vartype time_sequences: ~video_analyzer_management_client.models.TimeSequenceBase """ _validation = { @@ -4295,6 +5141,16 @@ def __init__( time_sequences: "TimeSequenceBase", **kwargs ): + """ + :keyword name: Required. Node name. Must be unique within the topology. + :paramtype name: str + :keyword video_name: Required. Name of the Video Analyzer video resource to be used as the + source. + :paramtype video_name: str + :keyword time_sequences: Required. Describes a sequence of datetime ranges. The video source + only picks up recorded media within these ranges. + :paramtype time_sequences: ~video_analyzer_management_client.models.TimeSequenceBase + """ super(VideoSource, self).__init__(name=name, **kwargs) self.type = '#Microsoft.VideoAnalyzer.VideoSource' # type: str self.video_name = video_name diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/models/_video_analyzer_management_client_enums.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/models/_video_analyzer_management_client_enums.py new file mode 100644 index 0000000000000..a3620a0057bd3 --- /dev/null +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/models/_video_analyzer_management_client_enums.py @@ -0,0 +1,285 @@ +# 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 AccessPolicyEccAlgo(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Elliptical curve algorithm to be used: ES256, ES384 or ES512. + """ + + #: ES265. + ES256 = "ES256" + #: ES384. + ES384 = "ES384" + #: ES512. + ES512 = "ES512" + +class AccessPolicyRole(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Defines the access level granted by this policy. + """ + + #: Reader role allows for read-only operations to be performed through the client APIs. + READER = "Reader" + +class AccessPolicyRsaAlgo(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """RSA algorithm to be used: RS256, RS384 or RS512. + """ + + #: RS256. + RS256 = "RS256" + #: RS384. + RS384 = "RS384" + #: RS512. + RS512 = "RS512" + +class AccountEncryptionKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of key used to encrypt the Account Key. + """ + + #: The Account Key is encrypted with a System Key. + SYSTEM_KEY = "SystemKey" + #: The Account Key is encrypted with a Customer Key. + CUSTOMER_KEY = "CustomerKey" + +class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Indicates the action type. + """ + + #: An internal action. + INTERNAL = "Internal" + +class CheckNameAvailabilityReason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The reason why the given name is not available. + """ + + INVALID = "Invalid" + ALREADY_EXISTS = "AlreadyExists" + +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 EncoderSystemPresetType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Name of the built-in encoding preset. + """ + + #: Produces an MP4 file where the video is encoded with H.264 codec at a picture height of 540 + #: pixels, and at a maximum bitrate of 2000 Kbps. Encoded video has the same average frame rate as + #: the input. The aspect ratio of the input is preserved. If the input content has audio, then it + #: is encoded with AAC-LC codec at 96 Kbps. + SINGLE_LAYER540_P_H264_AAC = "SingleLayer_540p_H264_AAC" + #: Produces an MP4 file where the video is encoded with H.264 codec at a picture height of 720 + #: pixels, and at a maximum bitrate of 3500 Kbps. Encoded video has the same average frame rate as + #: the input. The aspect ratio of the input is preserved. If the input content has audio, then it + #: is encoded with AAC-LC codec at 96 Kbps. + SINGLE_LAYER720_P_H264_AAC = "SingleLayer_720p_H264_AAC" + #: Produces an MP4 file where the video is encoded with H.264 codec at a picture height of 1080 + #: pixels, and at a maximum bitrate of 6000 Kbps. Encoded video has the same average frame rate as + #: the input. The aspect ratio of the input is preserved. If the input content has audio, then it + #: is encoded with AAC-LC codec at 128 Kbps. + SINGLE_LAYER1080_P_H264_AAC = "SingleLayer_1080p_H264_AAC" + #: Produces an MP4 file where the video is encoded with H.264 codec at a picture height of 2160 + #: pixels, and at a maximum bitrate of 16000 Kbps. Encoded video has the same average frame rate + #: as the input. The aspect ratio of the input is preserved. If the input content has audio, then + #: it is encoded with AAC-LC codec at 128 Kbps. + SINGLE_LAYER2160_P_H264_AAC = "SingleLayer_2160p_H264_AAC" + +class Kind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Topology kind. + """ + + #: Live pipeline topology resource. + LIVE = "Live" + #: Batch pipeline topology resource. + BATCH = "Batch" + +class LivePipelineState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Current state of the pipeline (read-only). + """ + + #: The live pipeline is idle and not processing media. + INACTIVE = "Inactive" + #: The live pipeline is transitioning into the active state. + ACTIVATING = "Activating" + #: The live pipeline is active and able to process media. If your data source is not available, + #: for instance, if your RTSP camera is powered off or unreachable, the pipeline will still be + #: active and periodically retrying the connection. Your Azure subscription will be billed for the + #: duration in which the live pipeline is in the active state. + ACTIVE = "Active" + #: The live pipeline is transitioning into the inactive state. + DEACTIVATING = "Deactivating" + +class MetricAggregationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The metric aggregation type + """ + + #: The average. + AVERAGE = "Average" + #: The count of a number of items, usually requests. + COUNT = "Count" + #: The sum. + TOTAL = "Total" + +class MetricUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The metric unit + """ + + #: The number of bytes. + BYTES = "Bytes" + #: The count. + COUNT = "Count" + #: The number of milliseconds. + MILLISECONDS = "Milliseconds" + +class ParameterType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Type of the parameter. + """ + + #: The parameter's value is a string. + STRING = "String" + #: The parameter's value is a string that holds sensitive information. + SECRET_STRING = "SecretString" + #: The parameter's value is a 32-bit signed integer. + INT = "Int" + #: The parameter's value is a 64-bit double-precision floating point. + DOUBLE = "Double" + #: The parameter's value is a boolean value that is either true or false. + BOOL = "Bool" + +class PipelineJobState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Current state of the pipeline (read-only). + """ + + #: Pipeline job is processing. + PROCESSING = "Processing" + #: Pipeline job is canceled. + CANCELED = "Canceled" + #: Pipeline job completed. + COMPLETED = "Completed" + #: Pipeline job failed. + FAILED = "Failed" + +class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The current provisioning state. + """ + + SUCCEEDED = "Succeeded" + CREATING = "Creating" + DELETING = "Deleting" + FAILED = "Failed" + +class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The private endpoint connection status. + """ + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the Video Analyzer account. + """ + + #: Provisioning state failed. + FAILED = "Failed" + #: Provisioning state in progress. + IN_PROGRESS = "InProgress" + #: Provisioning state succeeded. + SUCCEEDED = "Succeeded" + +class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Whether or not public network access is allowed for resources under the Video Analyzer account. + """ + + #: Public network access is enabled. + ENABLED = "Enabled" + #: Public network access is disabled. + DISABLED = "Disabled" + +class RtspTransport(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Network transport utilized by the RTSP and RTP exchange: TCP or HTTP. When using TCP, the RTP + packets are interleaved on the TCP RTSP connection. When using HTTP, the RTSP messages are + exchanged through long lived HTTP connections, and the RTP packages are interleaved in the HTTP + connections alongside the RTSP messages. + """ + + #: HTTP transport. RTSP messages are exchanged over long running HTTP requests and RTP packets are + #: interleaved within the HTTP channel. + HTTP = "Http" + #: TCP transport. RTSP is used directly over TCP and RTP packets are interleaved within the TCP + #: channel. + TCP = "Tcp" + +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The SKU name. + """ + + #: Represents the Live S1 SKU name. Using this SKU you can create live pipelines to capture, + #: record, and stream live video from RTSP-capable cameras at bitrate settings from 0.5 Kbps to + #: 3000 Kbps. + LIVE_S1 = "Live_S1" + #: Represents the Batch S1 SKU name. Using this SKU you can create pipeline jobs to process + #: recorded content. + BATCH_S1 = "Batch_S1" + +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The SKU tier. + """ + + #: Standard tier. + STANDARD = "Standard" + +class VideoAnalyzerEndpointType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of the endpoint. + """ + + #: The client API endpoint. + CLIENT_API = "ClientApi" + +class VideoScaleMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Describes the video scaling mode to be applied. Default mode is 'Pad'. If the mode is 'Pad' or + 'Stretch' then both width and height must be specified. Else if the mode is + 'PreserveAspectRatio' then only one of width or height need be provided. + """ + + #: Pads the video with black horizontal stripes (letterbox) or black vertical stripes (pillar-box) + #: so the video is resized to the specified dimensions while not altering the content aspect + #: ratio. + PAD = "Pad" + #: Preserves the same aspect ratio as the input video. If only one video dimension is provided, + #: the second dimension is calculated based on the input video aspect ratio. When 2 dimensions are + #: provided, the video is resized to fit the most constraining dimension, considering the input + #: video size and aspect ratio. + PRESERVE_ASPECT_RATIO = "PreserveAspectRatio" + #: Stretches the original video so it resized to the specified dimensions. + STRETCH = "Stretch" + +class VideoType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Video content type. Different content types are suitable for different applications and + scenarios. + """ + + #: Archive is flexible format that represents a video stream associated with wall-clock time. The + #: video archive can either be continuous or discontinuous. An archive is discontinuous when there + #: are gaps in the recording due to various reasons, such as the live pipeline being stopped, + #: camera being disconnected or due to the use of event based recordings through the use of a + #: signal gate. There is no limit to the archive duration and new video data can be appended to + #: the existing archive at any time, as long as the same video codec and codec parameters are + #: being used. Videos of this type are suitable for appending and long term archival. + ARCHIVE = "Archive" + #: File represents a video which is stored as a single media file, such as MP4. Videos of this + #: type are suitable to be downloaded for external consumption. + FILE = "File" diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_access_policies_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_access_policies_operations.py index bc55cd89a9aa6..245a0dcb8a604 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_access_policies_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_access_policies_operations.py @@ -5,23 +5,231 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_list_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/accessPolicies') + 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'), + } + + 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') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # 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, + access_policy_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/accessPolicies/{accessPolicyName}') + 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'), + "accessPolicyName": _SERIALIZER.url("access_policy_name", access_policy_name, 'str'), + } + + 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_create_or_update_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + access_policy_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-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/accessPolicies/{accessPolicyName}') + 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'), + "accessPolicyName": _SERIALIZER.url("access_policy_name", access_policy_name, 'str'), + } + + 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, + access_policy_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/accessPolicies/{accessPolicyName}') + 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'), + "accessPolicyName": _SERIALIZER.url("access_policy_name", access_policy_name, 'str'), + } + + 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 + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + access_policy_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-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/accessPolicies/{accessPolicyName}') + 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'), + "accessPolicyName": _SERIALIZER.url("access_policy_name", access_policy_name, 'str'), + } + + 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 + ) class AccessPoliciesOperations(object): """AccessPoliciesOperations operations. @@ -30,7 +238,7 @@ class AccessPoliciesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,14 +253,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AccessPolicyEntityCollection"] + resource_group_name: str, + account_name: str, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.AccessPolicyEntityCollection"]: """List all existing access policy resources. Retrieves all existing access policy resources, along with their JSON representations. @@ -66,8 +274,10 @@ def list( specified value n. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AccessPolicyEntityCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~video_analyzer.models.AccessPolicyEntityCollection] + :return: An iterator like instance of either AccessPolicyEntityCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~video_analyzer_management_client.models.AccessPolicyEntityCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessPolicyEntityCollection"] @@ -75,38 +285,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + top=top, + 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('AccessPolicyEntityCollection', pipeline_response) + deserialized = self._deserialize("AccessPolicyEntityCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,25 +326,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/accessPolicies'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - access_policy_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AccessPolicyEntity" + resource_group_name: str, + account_name: str, + access_policy_name: str, + **kwargs: Any + ) -> "_models.AccessPolicyEntity": """Retrieves an existing access policy resource. Retrieves an existing access policy resource with the given name. @@ -150,7 +358,7 @@ def get( :type access_policy_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessPolicyEntity, or the result of cls(response) - :rtype: ~video_analyzer.models.AccessPolicyEntity + :rtype: ~video_analyzer_management_client.models.AccessPolicyEntity :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessPolicyEntity"] @@ -158,34 +366,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'accessPolicyName': self._serialize.url("access_policy_name", access_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + access_policy_name=access_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AccessPolicyEntity', pipeline_response) @@ -194,17 +392,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/accessPolicies/{accessPolicyName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - access_policy_name, # type: str - parameters, # type: "_models.AccessPolicyEntity" - **kwargs # type: Any - ): - # type: (...) -> "_models.AccessPolicyEntity" + resource_group_name: str, + account_name: str, + access_policy_name: str, + parameters: "_models.AccessPolicyEntity", + **kwargs: Any + ) -> "_models.AccessPolicyEntity": """Creates a new access policy resource or updates an existing one. Creates a new access policy resource or updates an existing one with the given name. @@ -216,10 +416,10 @@ def create_or_update( :param access_policy_name: The Access Policy name. :type access_policy_name: str :param parameters: The request parameters. - :type parameters: ~video_analyzer.models.AccessPolicyEntity + :type parameters: ~video_analyzer_management_client.models.AccessPolicyEntity :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessPolicyEntity, or the result of cls(response) - :rtype: ~video_analyzer.models.AccessPolicyEntity + :rtype: ~video_analyzer_management_client.models.AccessPolicyEntity :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessPolicyEntity"] @@ -227,39 +427,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'accessPolicyName': self._serialize.url("access_policy_name", access_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'AccessPolicyEntity') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + access_policy_name=access_policy_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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccessPolicyEntity') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -272,16 +462,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/accessPolicies/{accessPolicyName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - access_policy_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + access_policy_name: str, + **kwargs: Any + ) -> None: """Deletes an existing access policy resource. Deletes an existing access policy resource with the given name. @@ -302,34 +494,24 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'accessPolicyName': self._serialize.url("access_policy_name", access_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + access_policy_name=access_policy_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -337,15 +519,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/accessPolicies/{accessPolicyName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - access_policy_name, # type: str - parameters, # type: "_models.AccessPolicyEntity" - **kwargs # type: Any - ): - # type: (...) -> "_models.AccessPolicyEntity" + resource_group_name: str, + account_name: str, + access_policy_name: str, + parameters: "_models.AccessPolicyEntity", + **kwargs: Any + ) -> "_models.AccessPolicyEntity": """Updates individual properties of an existing access policy resource. Updates individual properties of an existing access policy resource with the given name. @@ -357,10 +540,10 @@ def update( :param access_policy_name: The Access Policy name. :type access_policy_name: str :param parameters: The request parameters. - :type parameters: ~video_analyzer.models.AccessPolicyEntity + :type parameters: ~video_analyzer_management_client.models.AccessPolicyEntity :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessPolicyEntity, or the result of cls(response) - :rtype: ~video_analyzer.models.AccessPolicyEntity + :rtype: ~video_analyzer_management_client.models.AccessPolicyEntity :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessPolicyEntity"] @@ -368,39 +551,29 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'accessPolicyName': self._serialize.url("access_policy_name", access_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AccessPolicyEntity') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + access_policy_name=access_policy_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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccessPolicyEntity') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AccessPolicyEntity', pipeline_response) @@ -409,4 +582,6 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/accessPolicies/{accessPolicyName}'} # type: ignore + diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_edge_modules_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_edge_modules_operations.py index d0415efb1f008..54be31569e3db 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_edge_modules_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_edge_modules_operations.py @@ -5,23 +5,231 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_list_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/edgeModules') + 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'), + } + + 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') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # 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, + edge_module_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/edgeModules/{edgeModuleName}') + 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'), + "edgeModuleName": _SERIALIZER.url("edge_module_name", edge_module_name, 'str'), + } + + 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_create_or_update_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + edge_module_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-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/edgeModules/{edgeModuleName}') + 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'), + "edgeModuleName": _SERIALIZER.url("edge_module_name", edge_module_name, 'str'), + } + + 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, + edge_module_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/edgeModules/{edgeModuleName}') + 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'), + "edgeModuleName": _SERIALIZER.url("edge_module_name", edge_module_name, 'str'), + } + + 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 + ) + + +def build_list_provisioning_token_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + edge_module_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-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/edgeModules/{edgeModuleName}/listProvisioningToken') + 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'), + "edgeModuleName": _SERIALIZER.url("edge_module_name", edge_module_name, 'str'), + } + + 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 EdgeModulesOperations(object): """EdgeModulesOperations operations. @@ -30,7 +238,7 @@ class EdgeModulesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,14 +253,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.EdgeModuleEntityCollection"] + resource_group_name: str, + account_name: str, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.EdgeModuleEntityCollection"]: """List all existing edge module resources. List all existing edge module resources, along with their JSON representations. @@ -66,8 +274,10 @@ def list( specified value n. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EdgeModuleEntityCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~video_analyzer.models.EdgeModuleEntityCollection] + :return: An iterator like instance of either EdgeModuleEntityCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~video_analyzer_management_client.models.EdgeModuleEntityCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EdgeModuleEntityCollection"] @@ -75,38 +285,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + top=top, + 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('EdgeModuleEntityCollection', pipeline_response) + deserialized = self._deserialize("EdgeModuleEntityCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,25 +326,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/edgeModules'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - edge_module_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.EdgeModuleEntity" + resource_group_name: str, + account_name: str, + edge_module_name: str, + **kwargs: Any + ) -> "_models.EdgeModuleEntity": """Retrieves an existing edge module resource. Retrieves an existing edge module resource with the given name. @@ -150,7 +358,7 @@ def get( :type edge_module_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EdgeModuleEntity, or the result of cls(response) - :rtype: ~video_analyzer.models.EdgeModuleEntity + :rtype: ~video_analyzer_management_client.models.EdgeModuleEntity :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EdgeModuleEntity"] @@ -158,34 +366,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'edgeModuleName': self._serialize.url("edge_module_name", edge_module_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + edge_module_name=edge_module_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EdgeModuleEntity', pipeline_response) @@ -194,17 +392,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/edgeModules/{edgeModuleName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - edge_module_name, # type: str - parameters, # type: "_models.EdgeModuleEntity" - **kwargs # type: Any - ): - # type: (...) -> "_models.EdgeModuleEntity" + resource_group_name: str, + account_name: str, + edge_module_name: str, + parameters: "_models.EdgeModuleEntity", + **kwargs: Any + ) -> "_models.EdgeModuleEntity": """Creates a new edge module or updates an existing one. Creates a new edge module or updates an existing one. An edge module resource enables a single @@ -222,10 +422,10 @@ def create_or_update( :param edge_module_name: The Edge Module name. :type edge_module_name: str :param parameters: The request parameters. - :type parameters: ~video_analyzer.models.EdgeModuleEntity + :type parameters: ~video_analyzer_management_client.models.EdgeModuleEntity :keyword callable cls: A custom type or function that will be passed the direct response :return: EdgeModuleEntity, or the result of cls(response) - :rtype: ~video_analyzer.models.EdgeModuleEntity + :rtype: ~video_analyzer_management_client.models.EdgeModuleEntity :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EdgeModuleEntity"] @@ -233,39 +433,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'edgeModuleName': self._serialize.url("edge_module_name", edge_module_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'EdgeModuleEntity') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + edge_module_name=edge_module_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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'EdgeModuleEntity') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -278,16 +468,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/edgeModules/{edgeModuleName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - edge_module_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + edge_module_name: str, + **kwargs: Any + ) -> None: """Deletes an existing edge module resource. Deletes an existing edge module resource. Deleting the edge module resource will prevent an @@ -310,34 +502,24 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'edgeModuleName': self._serialize.url("edge_module_name", edge_module_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + edge_module_name=edge_module_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -345,15 +527,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/edgeModules/{edgeModuleName}'} # type: ignore + + @distributed_trace def list_provisioning_token( self, - resource_group_name, # type: str - account_name, # type: str - edge_module_name, # type: str - parameters, # type: "_models.ListProvisioningTokenInput" - **kwargs # type: Any - ): - # type: (...) -> "_models.EdgeModuleProvisioningToken" + resource_group_name: str, + account_name: str, + edge_module_name: str, + parameters: "_models.ListProvisioningTokenInput", + **kwargs: Any + ) -> "_models.EdgeModuleProvisioningToken": """Creates a new provisioning token. Creates a new provisioning token. A provisioning token allows for a single instance of Azure @@ -371,10 +554,10 @@ def list_provisioning_token( :param edge_module_name: The Edge Module name. :type edge_module_name: str :param parameters: The request parameters. - :type parameters: ~video_analyzer.models.ListProvisioningTokenInput + :type parameters: ~video_analyzer_management_client.models.ListProvisioningTokenInput :keyword callable cls: A custom type or function that will be passed the direct response :return: EdgeModuleProvisioningToken, or the result of cls(response) - :rtype: ~video_analyzer.models.EdgeModuleProvisioningToken + :rtype: ~video_analyzer_management_client.models.EdgeModuleProvisioningToken :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EdgeModuleProvisioningToken"] @@ -382,39 +565,29 @@ def list_provisioning_token( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_provisioning_token.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'edgeModuleName': self._serialize.url("edge_module_name", edge_module_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ListProvisioningTokenInput') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_list_provisioning_token_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + edge_module_name=edge_module_name, + content_type=content_type, + json=_json, + template_url=self.list_provisioning_token.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ListProvisioningTokenInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EdgeModuleProvisioningToken', pipeline_response) @@ -423,4 +596,6 @@ def list_provisioning_token( return cls(pipeline_response, deserialized, {}) return deserialized + list_provisioning_token.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/edgeModules/{edgeModuleName}/listProvisioningToken'} # type: ignore + diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_live_pipeline_operation_statuses_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_live_pipeline_operation_statuses_operations.py index 858c2ed4cecc7..b7095989a859a 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_live_pipeline_operation_statuses_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_live_pipeline_operation_statuses_operations.py @@ -5,22 +5,63 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + live_pipeline_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/livePipelines/{livePipelineName}/operationStatuses/{operationId}') + 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'), + "livePipelineName": _SERIALIZER.url("live_pipeline_name", live_pipeline_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + 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 LivePipelineOperationStatusesOperations(object): """LivePipelineOperationStatusesOperations operations. @@ -29,7 +70,7 @@ class LivePipelineOperationStatusesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -44,15 +85,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - live_pipeline_name, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.LivePipelineOperationStatus" + resource_group_name: str, + account_name: str, + live_pipeline_name: str, + operation_id: str, + **kwargs: Any + ) -> "_models.LivePipelineOperationStatus": """Get the operation status. Get the operation status of a live pipeline. @@ -67,7 +108,7 @@ def get( :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: LivePipelineOperationStatus, or the result of cls(response) - :rtype: ~video_analyzer.models.LivePipelineOperationStatus + :rtype: ~video_analyzer_management_client.models.LivePipelineOperationStatus :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.LivePipelineOperationStatus"] @@ -75,35 +116,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'livePipelineName': self._serialize.url("live_pipeline_name", live_pipeline_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_pipeline_name=live_pipeline_name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LivePipelineOperationStatus', pipeline_response) @@ -112,4 +143,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/livePipelines/{livePipelineName}/operationStatuses/{operationId}'} # type: ignore + diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_live_pipelines_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_live_pipelines_operations.py index 3d5a77eb7619f..abe0daa2682d8 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_live_pipelines_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_live_pipelines_operations.py @@ -5,25 +5,310 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_list_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/livePipelines') + 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'), + } + + 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') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # 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, + live_pipeline_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/livePipelines/{livePipelineName}') + 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'), + "livePipelineName": _SERIALIZER.url("live_pipeline_name", live_pipeline_name, 'str'), + } + + 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_create_or_update_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + live_pipeline_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-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/livePipelines/{livePipelineName}') + 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'), + "livePipelineName": _SERIALIZER.url("live_pipeline_name", live_pipeline_name, 'str'), + } + + 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, + live_pipeline_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/livePipelines/{livePipelineName}') + 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'), + "livePipelineName": _SERIALIZER.url("live_pipeline_name", live_pipeline_name, 'str'), + } + + 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 + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + live_pipeline_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-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/livePipelines/{livePipelineName}') + 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'), + "livePipelineName": _SERIALIZER.url("live_pipeline_name", live_pipeline_name, 'str'), + } + + 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_activate_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + live_pipeline_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/livePipelines/{livePipelineName}/activate') + 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'), + "livePipelineName": _SERIALIZER.url("live_pipeline_name", live_pipeline_name, 'str'), + } + + 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="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_deactivate_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + live_pipeline_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/livePipelines/{livePipelineName}/deactivate') + 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'), + "livePipelineName": _SERIALIZER.url("live_pipeline_name", live_pipeline_name, 'str'), + } + + 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="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class LivePipelinesOperations(object): """LivePipelinesOperations operations. @@ -32,7 +317,7 @@ class LivePipelinesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -47,15 +332,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - filter=None, # type: Optional[str] - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.LivePipelineCollection"] + resource_group_name: str, + account_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.LivePipelineCollection"]: """Retrieves a list of live pipelines. Retrieves a list of live pipelines that have been created, along with their JSON @@ -72,8 +357,10 @@ def list( specified value n. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either LivePipelineCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~video_analyzer.models.LivePipelineCollection] + :return: An iterator like instance of either LivePipelineCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~video_analyzer_management_client.models.LivePipelineCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.LivePipelineCollection"] @@ -81,40 +368,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + filter=filter, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + filter=filter, + top=top, + 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('LivePipelineCollection', pipeline_response) + deserialized = self._deserialize("LivePipelineCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -127,25 +411,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/livePipelines'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - live_pipeline_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.LivePipeline" + resource_group_name: str, + account_name: str, + live_pipeline_name: str, + **kwargs: Any + ) -> "_models.LivePipeline": """Retrieves a specific live pipeline by name. Retrieves a specific live pipeline by name. If a live pipeline with that name has been @@ -159,7 +444,7 @@ def get( :type live_pipeline_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: LivePipeline, or the result of cls(response) - :rtype: ~video_analyzer.models.LivePipeline + :rtype: ~video_analyzer_management_client.models.LivePipeline :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.LivePipeline"] @@ -167,34 +452,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'livePipelineName': self._serialize.url("live_pipeline_name", live_pipeline_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_pipeline_name=live_pipeline_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LivePipeline', pipeline_response) @@ -203,17 +478,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/livePipelines/{livePipelineName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - live_pipeline_name, # type: str - parameters, # type: "_models.LivePipeline" - **kwargs # type: Any - ): - # type: (...) -> "_models.LivePipeline" + resource_group_name: str, + account_name: str, + live_pipeline_name: str, + parameters: "_models.LivePipeline", + **kwargs: Any + ) -> "_models.LivePipeline": """Creates or updates a live pipeline. Creates a new live pipeline or updates an existing one, with the given name. @@ -225,10 +502,10 @@ def create_or_update( :param live_pipeline_name: Live pipeline unique identifier. :type live_pipeline_name: str :param parameters: The request parameters. - :type parameters: ~video_analyzer.models.LivePipeline + :type parameters: ~video_analyzer_management_client.models.LivePipeline :keyword callable cls: A custom type or function that will be passed the direct response :return: LivePipeline, or the result of cls(response) - :rtype: ~video_analyzer.models.LivePipeline + :rtype: ~video_analyzer_management_client.models.LivePipeline :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.LivePipeline"] @@ -236,39 +513,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'livePipelineName': self._serialize.url("live_pipeline_name", live_pipeline_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'LivePipeline') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_pipeline_name=live_pipeline_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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'LivePipeline') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -281,16 +548,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/livePipelines/{livePipelineName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - live_pipeline_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + live_pipeline_name: str, + **kwargs: Any + ) -> None: """Deletes a live pipeline. Deletes a live pipeline with the given name. @@ -311,34 +580,24 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'livePipelineName': self._serialize.url("live_pipeline_name", live_pipeline_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_pipeline_name=live_pipeline_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -346,15 +605,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/livePipelines/{livePipelineName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - live_pipeline_name, # type: str - parameters, # type: "_models.LivePipelineUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.LivePipeline" + resource_group_name: str, + account_name: str, + live_pipeline_name: str, + parameters: "_models.LivePipelineUpdate", + **kwargs: Any + ) -> "_models.LivePipeline": """Updates an existing live pipeline. Updates an existing live pipeline with the given name. Properties that can be updated include: @@ -368,10 +628,10 @@ def update( :param live_pipeline_name: Live pipeline unique identifier. :type live_pipeline_name: str :param parameters: The request parameters. - :type parameters: ~video_analyzer.models.LivePipelineUpdate + :type parameters: ~video_analyzer_management_client.models.LivePipelineUpdate :keyword callable cls: A custom type or function that will be passed the direct response :return: LivePipeline, or the result of cls(response) - :rtype: ~video_analyzer.models.LivePipeline + :rtype: ~video_analyzer_management_client.models.LivePipeline :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.LivePipeline"] @@ -379,39 +639,29 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'livePipelineName': self._serialize.url("live_pipeline_name", live_pipeline_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'LivePipelineUpdate') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_pipeline_name=live_pipeline_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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'LivePipelineUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LivePipeline', pipeline_response) @@ -420,64 +670,55 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/livePipelines/{livePipelineName}'} # type: ignore + def _activate_initial( self, - resource_group_name, # type: str - account_name, # type: str - live_pipeline_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + live_pipeline_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._activate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'livePipelineName': self._serialize.url("live_pipeline_name", live_pipeline_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_activate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_pipeline_name=live_pipeline_name, + template_url=self._activate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _activate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/livePipelines/{livePipelineName}/activate'} # type: ignore + + @distributed_trace def begin_activate( self, - resource_group_name, # type: str - account_name, # type: str - live_pipeline_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + live_pipeline_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Activates a live pipeline. Activates a live pipeline with the given name. @@ -490,15 +731,17 @@ def begin_activate( :type live_pipeline_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -513,22 +756,14 @@ def begin_activate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'livePipelineName': self._serialize.url("live_pipeline_name", live_pipeline_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -540,64 +775,54 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_activate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/livePipelines/{livePipelineName}/activate'} # type: ignore def _deactivate_initial( self, - resource_group_name, # type: str - account_name, # type: str - live_pipeline_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + live_pipeline_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._deactivate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'livePipelineName': self._serialize.url("live_pipeline_name", live_pipeline_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_deactivate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_pipeline_name=live_pipeline_name, + template_url=self._deactivate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _deactivate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/livePipelines/{livePipelineName}/deactivate'} # type: ignore + + @distributed_trace def begin_deactivate( self, - resource_group_name, # type: str - account_name, # type: str - live_pipeline_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + live_pipeline_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deactivates a live pipeline. Deactivates a live pipeline with the given name. @@ -610,15 +835,17 @@ def begin_deactivate( :type live_pipeline_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -633,22 +860,14 @@ def begin_deactivate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'livePipelineName': self._serialize.url("live_pipeline_name", live_pipeline_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -660,4 +879,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_deactivate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/livePipelines/{livePipelineName}/deactivate'} # type: ignore diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_locations_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_locations_operations.py index 75989ff00edaa..44a3ba6761eb1 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_locations_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_locations_operations.py @@ -5,22 +5,67 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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, + location_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-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Media/locations/{locationName}/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "locationName": _SERIALIZER.url("location_name", location_name, 'str'), + } + + 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 LocationsOperations(object): """LocationsOperations operations. @@ -29,7 +74,7 @@ class LocationsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -44,13 +89,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, - location_name, # type: str - parameters, # type: "_models.CheckNameAvailabilityRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityResponse" + location_name: str, + parameters: "_models.CheckNameAvailabilityRequest", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResponse": """Check Name Availability. Checks whether the Video Analyzer resource name is available. @@ -58,10 +103,10 @@ def check_name_availability( :param location_name: Location Name. :type location_name: str :param parameters: The request parameters. - :type parameters: ~video_analyzer.models.CheckNameAvailabilityRequest + :type parameters: ~video_analyzer_management_client.models.CheckNameAvailabilityRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResponse, or the result of cls(response) - :rtype: ~video_analyzer.models.CheckNameAvailabilityResponse + :rtype: ~video_analyzer_management_client.models.CheckNameAvailabilityResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResponse"] @@ -69,37 +114,27 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'locationName': self._serialize.url("location_name", location_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'CheckNameAvailabilityRequest') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location_name=location_name, + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CheckNameAvailabilityRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckNameAvailabilityResponse', pipeline_response) @@ -108,4 +143,6 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Media/locations/{locationName}/checkNameAvailability'} # type: ignore + diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_operation_results_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_operation_results_operations.py index 80e1bcbfba545..38109a51c6976 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_operation_results_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_operation_results_operations.py @@ -5,22 +5,63 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/privateEndpointConnections/{name}/operationResults/{operationId}') + 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'), + "name": _SERIALIZER.url("name", name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + 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 OperationResultsOperations(object): """OperationResultsOperations operations. @@ -29,7 +70,7 @@ class OperationResultsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -44,15 +85,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - name, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.PrivateEndpointConnection"] + resource_group_name: str, + account_name: str, + name: str, + operation_id: str, + **kwargs: Any + ) -> Optional["_models.PrivateEndpointConnection"]: """Get operation result. Get private endpoint connection operation result. @@ -67,7 +108,7 @@ def get( :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection, or the result of cls(response) - :rtype: ~video_analyzer.models.PrivateEndpointConnection or None + :rtype: ~video_analyzer_management_client.models.PrivateEndpointConnection or None :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] @@ -75,35 +116,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + name=name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -114,4 +145,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/privateEndpointConnections/{name}/operationResults/{operationId}'} # type: ignore + diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_operation_statuses_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_operation_statuses_operations.py index d5ae754d78062..1193198728866 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_operation_statuses_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_operation_statuses_operations.py @@ -5,22 +5,63 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/privateEndpointConnections/{name}/operationStatuses/{operationId}') + 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'), + "name": _SERIALIZER.url("name", name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + 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 OperationStatusesOperations(object): """OperationStatusesOperations operations. @@ -29,7 +70,7 @@ class OperationStatusesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -44,15 +85,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - name, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VideoAnalyzerPrivateEndpointConnectionOperationStatus" + resource_group_name: str, + account_name: str, + name: str, + operation_id: str, + **kwargs: Any + ) -> "_models.VideoAnalyzerPrivateEndpointConnectionOperationStatus": """Get operation status. Get private endpoint connection operation status. @@ -67,7 +108,8 @@ def get( :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VideoAnalyzerPrivateEndpointConnectionOperationStatus, or the result of cls(response) - :rtype: ~video_analyzer.models.VideoAnalyzerPrivateEndpointConnectionOperationStatus + :rtype: + ~video_analyzer_management_client.models.VideoAnalyzerPrivateEndpointConnectionOperationStatus :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VideoAnalyzerPrivateEndpointConnectionOperationStatus"] @@ -75,35 +117,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + name=name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('VideoAnalyzerPrivateEndpointConnectionOperationStatus', pipeline_response) @@ -112,4 +144,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/privateEndpointConnections/{name}/operationStatuses/{operationId}'} # type: ignore + diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_operations.py index 115ef91180df2..7122be6116969 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_operations.py @@ -5,22 +5,49 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Media/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. @@ -29,7 +56,7 @@ class Operations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -44,18 +71,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationCollection" + **kwargs: Any + ) -> "_models.OperationCollection": """List Operations. Lists all the Media operations. :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationCollection, or the result of cls(response) - :rtype: ~video_analyzer.models.OperationCollection + :rtype: ~video_analyzer_management_client.models.OperationCollection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationCollection"] @@ -63,27 +90,20 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationCollection', pipeline_response) @@ -92,4 +112,6 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/providers/Microsoft.Media/operations'} # type: ignore + diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_pipeline_job_operation_statuses_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_pipeline_job_operation_statuses_operations.py index a734e3568bc09..a2da4a8975397 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_pipeline_job_operation_statuses_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_pipeline_job_operation_statuses_operations.py @@ -5,22 +5,63 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + pipeline_job_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineJobs/{pipelineJobName}/operationStatuses/{operationId}') + 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'), + "pipelineJobName": _SERIALIZER.url("pipeline_job_name", pipeline_job_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + 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 PipelineJobOperationStatusesOperations(object): """PipelineJobOperationStatusesOperations operations. @@ -29,7 +70,7 @@ class PipelineJobOperationStatusesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -44,15 +85,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - pipeline_job_name, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PipelineJobOperationStatus" + resource_group_name: str, + account_name: str, + pipeline_job_name: str, + operation_id: str, + **kwargs: Any + ) -> "_models.PipelineJobOperationStatus": """Get the operation statuses. Get the operation status of a pipeline job with the given operationId. @@ -67,7 +108,7 @@ def get( :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PipelineJobOperationStatus, or the result of cls(response) - :rtype: ~video_analyzer.models.PipelineJobOperationStatus + :rtype: ~video_analyzer_management_client.models.PipelineJobOperationStatus :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineJobOperationStatus"] @@ -75,35 +116,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'pipelineJobName': self._serialize.url("pipeline_job_name", pipeline_job_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pipeline_job_name=pipeline_job_name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PipelineJobOperationStatus', pipeline_response) @@ -112,4 +143,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineJobs/{pipelineJobName}/operationStatuses/{operationId}'} # type: ignore + diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_pipeline_jobs_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_pipeline_jobs_operations.py index b0135e4e436d4..1aab5cfbe06cd 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_pipeline_jobs_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_pipeline_jobs_operations.py @@ -5,25 +5,273 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_list_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineJobs') + 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'), + } + + 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') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # 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, + pipeline_job_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineJobs/{pipelineJobName}') + 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'), + "pipelineJobName": _SERIALIZER.url("pipeline_job_name", pipeline_job_name, 'str'), + } + + 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_create_or_update_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + pipeline_job_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-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineJobs/{pipelineJobName}') + 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'), + "pipelineJobName": _SERIALIZER.url("pipeline_job_name", pipeline_job_name, 'str'), + } + + 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, + pipeline_job_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineJobs/{pipelineJobName}') + 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'), + "pipelineJobName": _SERIALIZER.url("pipeline_job_name", pipeline_job_name, 'str'), + } + + 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 + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + pipeline_job_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-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineJobs/{pipelineJobName}') + 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'), + "pipelineJobName": _SERIALIZER.url("pipeline_job_name", pipeline_job_name, 'str'), + } + + 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_cancel_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + pipeline_job_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineJobs/{pipelineJobName}/cancel') + 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'), + "pipelineJobName": _SERIALIZER.url("pipeline_job_name", pipeline_job_name, 'str'), + } + + 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="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PipelineJobsOperations(object): """PipelineJobsOperations operations. @@ -32,7 +280,7 @@ class PipelineJobsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -47,15 +295,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - filter=None, # type: Optional[str] - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PipelineJobCollection"] + resource_group_name: str, + account_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.PipelineJobCollection"]: """Retrieves a list of pipeline jobs. Retrieves a list of all live pipelines that have been created, along with their JSON @@ -72,8 +320,10 @@ def list( specified value n. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PipelineJobCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~video_analyzer.models.PipelineJobCollection] + :return: An iterator like instance of either PipelineJobCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~video_analyzer_management_client.models.PipelineJobCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineJobCollection"] @@ -81,40 +331,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + filter=filter, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + filter=filter, + top=top, + 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('PipelineJobCollection', pipeline_response) + deserialized = self._deserialize("PipelineJobCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -127,25 +374,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineJobs'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - pipeline_job_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PipelineJob" + resource_group_name: str, + account_name: str, + pipeline_job_name: str, + **kwargs: Any + ) -> "_models.PipelineJob": """Gets a specific pipeline job by name. Retrieves a specific pipeline job by name. If a pipeline job with that name has been previously @@ -159,7 +407,7 @@ def get( :type pipeline_job_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PipelineJob, or the result of cls(response) - :rtype: ~video_analyzer.models.PipelineJob + :rtype: ~video_analyzer_management_client.models.PipelineJob :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineJob"] @@ -167,34 +415,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'pipelineJobName': self._serialize.url("pipeline_job_name", pipeline_job_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pipeline_job_name=pipeline_job_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PipelineJob', pipeline_response) @@ -203,17 +441,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineJobs/{pipelineJobName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - pipeline_job_name, # type: str - parameters, # type: "_models.PipelineJob" - **kwargs # type: Any - ): - # type: (...) -> "_models.PipelineJob" + resource_group_name: str, + account_name: str, + pipeline_job_name: str, + parameters: "_models.PipelineJob", + **kwargs: Any + ) -> "_models.PipelineJob": """Creates or updates a pipeline job. Creates a new pipeline job or updates an existing one, with the given name. @@ -225,10 +465,10 @@ def create_or_update( :param pipeline_job_name: The pipeline job name. :type pipeline_job_name: str :param parameters: The request parameters. - :type parameters: ~video_analyzer.models.PipelineJob + :type parameters: ~video_analyzer_management_client.models.PipelineJob :keyword callable cls: A custom type or function that will be passed the direct response :return: PipelineJob, or the result of cls(response) - :rtype: ~video_analyzer.models.PipelineJob + :rtype: ~video_analyzer_management_client.models.PipelineJob :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineJob"] @@ -236,39 +476,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'pipelineJobName': self._serialize.url("pipeline_job_name", pipeline_job_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PipelineJob') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pipeline_job_name=pipeline_job_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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PipelineJob') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -281,16 +511,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineJobs/{pipelineJobName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - pipeline_job_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + pipeline_job_name: str, + **kwargs: Any + ) -> None: """Deletes a pipeline job. Deletes a pipeline job with the given name. @@ -311,34 +543,24 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'pipelineJobName': self._serialize.url("pipeline_job_name", pipeline_job_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pipeline_job_name=pipeline_job_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -346,15 +568,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineJobs/{pipelineJobName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - pipeline_job_name, # type: str - parameters, # type: "_models.PipelineJobUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.PipelineJob" + resource_group_name: str, + account_name: str, + pipeline_job_name: str, + parameters: "_models.PipelineJobUpdate", + **kwargs: Any + ) -> "_models.PipelineJob": """Updates an existing pipeline job. Updates an existing pipeline job with the given name. Properties that can be updated include: @@ -367,10 +590,10 @@ def update( :param pipeline_job_name: The pipeline job name. :type pipeline_job_name: str :param parameters: The request parameters. - :type parameters: ~video_analyzer.models.PipelineJobUpdate + :type parameters: ~video_analyzer_management_client.models.PipelineJobUpdate :keyword callable cls: A custom type or function that will be passed the direct response :return: PipelineJob, or the result of cls(response) - :rtype: ~video_analyzer.models.PipelineJob + :rtype: ~video_analyzer_management_client.models.PipelineJob :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineJob"] @@ -378,39 +601,29 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'pipelineJobName': self._serialize.url("pipeline_job_name", pipeline_job_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'PipelineJobUpdate') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pipeline_job_name=pipeline_job_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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PipelineJobUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PipelineJob', pipeline_response) @@ -419,64 +632,55 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineJobs/{pipelineJobName}'} # type: ignore + def _cancel_initial( self, - resource_group_name, # type: str - account_name, # type: str - pipeline_job_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + pipeline_job_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._cancel_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'pipelineJobName': self._serialize.url("pipeline_job_name", pipeline_job_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_cancel_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pipeline_job_name=pipeline_job_name, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineJobs/{pipelineJobName}/cancel'} # type: ignore + + @distributed_trace def begin_cancel( self, - resource_group_name, # type: str - account_name, # type: str - pipeline_job_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + pipeline_job_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Cancels a pipeline job. Cancels a pipeline job with the given name. @@ -489,15 +693,17 @@ def begin_cancel( :type pipeline_job_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -512,22 +718,14 @@ def begin_cancel( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'pipelineJobName': self._serialize.url("pipeline_job_name", pipeline_job_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -539,4 +737,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineJobs/{pipelineJobName}/cancel'} # type: ignore diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_pipeline_topologies_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_pipeline_topologies_operations.py index 11f276a054709..6b414ca92d8d0 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_pipeline_topologies_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_pipeline_topologies_operations.py @@ -5,23 +5,234 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_list_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineTopologies') + 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'), + } + + 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') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # 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, + pipeline_topology_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineTopologies/{pipelineTopologyName}') + 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'), + "pipelineTopologyName": _SERIALIZER.url("pipeline_topology_name", pipeline_topology_name, 'str'), + } + + 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_create_or_update_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + pipeline_topology_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-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineTopologies/{pipelineTopologyName}') + 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'), + "pipelineTopologyName": _SERIALIZER.url("pipeline_topology_name", pipeline_topology_name, 'str'), + } + + 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, + pipeline_topology_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineTopologies/{pipelineTopologyName}') + 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'), + "pipelineTopologyName": _SERIALIZER.url("pipeline_topology_name", pipeline_topology_name, 'str'), + } + + 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 + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + pipeline_topology_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-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineTopologies/{pipelineTopologyName}') + 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'), + "pipelineTopologyName": _SERIALIZER.url("pipeline_topology_name", pipeline_topology_name, 'str'), + } + + 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 + ) class PipelineTopologiesOperations(object): """PipelineTopologiesOperations operations. @@ -30,7 +241,7 @@ class PipelineTopologiesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,15 +256,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - filter=None, # type: Optional[str] - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PipelineTopologyCollection"] + resource_group_name: str, + account_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.PipelineTopologyCollection"]: """Retrieves a list of pipeline topologies. Retrieves a list of pipeline topologies that have been added to the account, if any, along with @@ -70,8 +281,10 @@ def list( specified value n. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PipelineTopologyCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~video_analyzer.models.PipelineTopologyCollection] + :return: An iterator like instance of either PipelineTopologyCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~video_analyzer_management_client.models.PipelineTopologyCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineTopologyCollection"] @@ -79,40 +292,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + filter=filter, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + filter=filter, + top=top, + 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('PipelineTopologyCollection', pipeline_response) + deserialized = self._deserialize("PipelineTopologyCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -125,25 +335,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineTopologies'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - pipeline_topology_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PipelineTopology" + resource_group_name: str, + account_name: str, + pipeline_topology_name: str, + **kwargs: Any + ) -> "_models.PipelineTopology": """Retrieves a specific pipeline topology by name. Retrieves a specific pipeline topology by name. If a topology with that name has been @@ -157,7 +368,7 @@ def get( :type pipeline_topology_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PipelineTopology, or the result of cls(response) - :rtype: ~video_analyzer.models.PipelineTopology + :rtype: ~video_analyzer_management_client.models.PipelineTopology :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineTopology"] @@ -165,34 +376,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'pipelineTopologyName': self._serialize.url("pipeline_topology_name", pipeline_topology_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pipeline_topology_name=pipeline_topology_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PipelineTopology', pipeline_response) @@ -201,17 +402,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineTopologies/{pipelineTopologyName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - pipeline_topology_name, # type: str - parameters, # type: "_models.PipelineTopology" - **kwargs # type: Any - ): - # type: (...) -> "_models.PipelineTopology" + resource_group_name: str, + account_name: str, + pipeline_topology_name: str, + parameters: "_models.PipelineTopology", + **kwargs: Any + ) -> "_models.PipelineTopology": """Creates or updates a pipeline topology. Creates a new pipeline topology or updates an existing one, with the given name. A pipeline @@ -226,10 +429,10 @@ def create_or_update( :param pipeline_topology_name: Pipeline topology unique identifier. :type pipeline_topology_name: str :param parameters: The request parameters. - :type parameters: ~video_analyzer.models.PipelineTopology + :type parameters: ~video_analyzer_management_client.models.PipelineTopology :keyword callable cls: A custom type or function that will be passed the direct response :return: PipelineTopology, or the result of cls(response) - :rtype: ~video_analyzer.models.PipelineTopology + :rtype: ~video_analyzer_management_client.models.PipelineTopology :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineTopology"] @@ -237,39 +440,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'pipelineTopologyName': self._serialize.url("pipeline_topology_name", pipeline_topology_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'PipelineTopology') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pipeline_topology_name=pipeline_topology_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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PipelineTopology') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -282,16 +475,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineTopologies/{pipelineTopologyName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - pipeline_topology_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + pipeline_topology_name: str, + **kwargs: Any + ) -> None: """Deletes a pipeline topology. Deletes a pipeline topology with the given name. This method should be called after all @@ -313,34 +508,24 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'pipelineTopologyName': self._serialize.url("pipeline_topology_name", pipeline_topology_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pipeline_topology_name=pipeline_topology_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -348,15 +533,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineTopologies/{pipelineTopologyName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - pipeline_topology_name, # type: str - parameters, # type: "_models.PipelineTopologyUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.PipelineTopology" + resource_group_name: str, + account_name: str, + pipeline_topology_name: str, + parameters: "_models.PipelineTopologyUpdate", + **kwargs: Any + ) -> "_models.PipelineTopology": """Updates an existing pipeline topology. Updates an existing pipeline topology with the given name. If the associated live pipelines or @@ -371,10 +557,10 @@ def update( :param pipeline_topology_name: Pipeline topology unique identifier. :type pipeline_topology_name: str :param parameters: The request parameters. - :type parameters: ~video_analyzer.models.PipelineTopologyUpdate + :type parameters: ~video_analyzer_management_client.models.PipelineTopologyUpdate :keyword callable cls: A custom type or function that will be passed the direct response :return: PipelineTopology, or the result of cls(response) - :rtype: ~video_analyzer.models.PipelineTopology + :rtype: ~video_analyzer_management_client.models.PipelineTopology :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PipelineTopology"] @@ -382,39 +568,29 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'pipelineTopologyName': self._serialize.url("pipeline_topology_name", pipeline_topology_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PipelineTopologyUpdate') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pipeline_topology_name=pipeline_topology_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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PipelineTopologyUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PipelineTopology', pipeline_response) @@ -423,4 +599,6 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/pipelineTopologies/{pipelineTopologyName}'} # type: ignore + diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_private_endpoint_connections_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_private_endpoint_connections_operations.py index c3b766fd902b8..820275a51a0a2 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_private_endpoint_connections_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_private_endpoint_connections_operations.py @@ -5,22 +5,180 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_list_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/privateEndpointConnections') + 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'), + } + + 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, + name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/privateEndpointConnections/{name}') + 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'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + 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_create_or_update_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + 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-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/privateEndpointConnections/{name}') + 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'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + 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, + name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/privateEndpointConnections/{name}') + 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'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + 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 PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -29,7 +187,7 @@ class PrivateEndpointConnectionsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -44,13 +202,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnectionListResult" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnectionListResult": """Get all private endpoint connections. Get all private endpoint connections under video analyzer account. @@ -61,7 +219,7 @@ def list( :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionListResult, or the result of cls(response) - :rtype: ~video_analyzer.models.PrivateEndpointConnectionListResult + :rtype: ~video_analyzer_management_client.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -69,33 +227,23 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) @@ -104,16 +252,18 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/privateEndpointConnections'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + account_name: str, + name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Get private endpoint connection. Get private endpoint connection under video analyzer account. @@ -126,7 +276,7 @@ def get( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection, or the result of cls(response) - :rtype: ~video_analyzer.models.PrivateEndpointConnection + :rtype: ~video_analyzer_management_client.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] @@ -134,34 +284,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + name=name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -170,17 +310,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/privateEndpointConnections/{name}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - name, # type: str - parameters, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + account_name: str, + name: str, + parameters: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Update private endpoint connection. Update private endpoint connection state under video analyzer account. @@ -192,10 +334,10 @@ def create_or_update( :param name: Private endpoint connection name. :type name: str :param parameters: The request parameters. - :type parameters: ~video_analyzer.models.PrivateEndpointConnection + :type parameters: ~video_analyzer_management_client.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection, or the result of cls(response) - :rtype: ~video_analyzer.models.PrivateEndpointConnection + :rtype: ~video_analyzer_management_client.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] @@ -203,61 +345,54 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PrivateEndpointConnection') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + name=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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/privateEndpointConnections/{name}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + name: str, + **kwargs: Any + ) -> None: """Delete private endpoint connection. Delete private endpoint connection under video analyzer account. @@ -278,37 +413,28 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + name=name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + 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.Media/videoAnalyzers/{accountName}/privateEndpointConnections/{name}'} # type: ignore + diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_private_link_resources_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_private_link_resources_operations.py index 939af8cae0e44..4f31edaa99461 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_private_link_resources_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_private_link_resources_operations.py @@ -5,22 +5,96 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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( + subscription_id: str, + resource_group_name: str, + account_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/privateLinkResources') + 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'), + } + + 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, + name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/privateLinkResources/{name}') + 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'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + 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 PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. @@ -29,7 +103,7 @@ class PrivateLinkResourcesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -44,13 +118,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateLinkResourceListResult" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResourceListResult": """Get list of group IDs. Get list of group IDs for video analyzer account. @@ -61,7 +135,7 @@ def list( :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateLinkResourceListResult, or the result of cls(response) - :rtype: ~video_analyzer.models.PrivateLinkResourceListResult + :rtype: ~video_analyzer_management_client.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] @@ -69,33 +143,23 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) @@ -104,16 +168,18 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/privateLinkResources'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateLinkResource" + resource_group_name: str, + account_name: str, + name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResource": """Get group ID. Get group ID for video analyzer account. @@ -126,7 +192,7 @@ def get( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateLinkResource, or the result of cls(response) - :rtype: ~video_analyzer.models.PrivateLinkResource + :rtype: ~video_analyzer_management_client.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] @@ -134,34 +200,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + name=name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateLinkResource', pipeline_response) @@ -170,4 +226,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/privateLinkResources/{name}'} # type: ignore + diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_video_analyzer_operation_results_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_video_analyzer_operation_results_operations.py index 6eb4b071fe577..ac93775a04b8c 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_video_analyzer_operation_results_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_video_analyzer_operation_results_operations.py @@ -5,22 +5,59 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_request( + subscription_id: str, + location_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Media/locations/{locationName}/videoAnalyzerOperationResults/{operationId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "locationName": _SERIALIZER.url("location_name", location_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + 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 VideoAnalyzerOperationResultsOperations(object): """VideoAnalyzerOperationResultsOperations operations. @@ -29,7 +66,7 @@ class VideoAnalyzerOperationResultsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -44,13 +81,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - location_name, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.VideoAnalyzer"] + location_name: str, + operation_id: str, + **kwargs: Any + ) -> Optional["_models.VideoAnalyzer"]: """Get operation result. Get video analyzer operation result. @@ -61,7 +98,7 @@ def get( :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VideoAnalyzer, or the result of cls(response) - :rtype: ~video_analyzer.models.VideoAnalyzer or None + :rtype: ~video_analyzer_management_client.models.VideoAnalyzer or None :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.VideoAnalyzer"]] @@ -69,33 +106,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'locationName': self._serialize.url("location_name", location_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + location_name=location_name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -106,4 +133,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Media/locations/{locationName}/videoAnalyzerOperationResults/{operationId}'} # type: ignore + diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_video_analyzer_operation_statuses_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_video_analyzer_operation_statuses_operations.py index 06a067e8df24c..1a1972bb269f6 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_video_analyzer_operation_statuses_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_video_analyzer_operation_statuses_operations.py @@ -5,22 +5,59 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_request( + subscription_id: str, + location_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Media/locations/{locationName}/videoAnalyzerOperationStatuses/{operationId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "locationName": _SERIALIZER.url("location_name", location_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + 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 VideoAnalyzerOperationStatusesOperations(object): """VideoAnalyzerOperationStatusesOperations operations. @@ -29,7 +66,7 @@ class VideoAnalyzerOperationStatusesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -44,13 +81,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - location_name, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VideoAnalyzerOperationStatus" + location_name: str, + operation_id: str, + **kwargs: Any + ) -> "_models.VideoAnalyzerOperationStatus": """Get operation status. Get video analyzer operation status. @@ -61,7 +98,7 @@ def get( :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VideoAnalyzerOperationStatus, or the result of cls(response) - :rtype: ~video_analyzer.models.VideoAnalyzerOperationStatus + :rtype: ~video_analyzer_management_client.models.VideoAnalyzerOperationStatus :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VideoAnalyzerOperationStatus"] @@ -69,33 +106,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'locationName': self._serialize.url("location_name", location_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + location_name=location_name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('VideoAnalyzerOperationStatus', pipeline_response) @@ -104,4 +131,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Media/locations/{locationName}/videoAnalyzerOperationStatuses/{operationId}'} # type: ignore + diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_video_analyzers_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_video_analyzers_operations.py index 05b6b1a521c24..7f2c63d840a5e 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_video_analyzers_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_video_analyzers_operations.py @@ -5,24 +5,249 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import 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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_list_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers') + 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-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{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'), + } + + 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_create_or_update_request_initial( + 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-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{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'), + } + + 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-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{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'), + } + + 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 + ) + + +def build_update_request_initial( + 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-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{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'), + } + + 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_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Media/videoAnalyzers') + 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 + ) class VideoAnalyzersOperations(object): """VideoAnalyzersOperations operations. @@ -31,7 +256,7 @@ class VideoAnalyzersOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -46,12 +271,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VideoAnalyzerCollection" + resource_group_name: str, + **kwargs: Any + ) -> "_models.VideoAnalyzerCollection": """List Video Analyzer accounts. Lists the Video Analyzer accounts in the specified resource group. @@ -60,7 +285,7 @@ def list( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VideoAnalyzerCollection, or the result of cls(response) - :rtype: ~video_analyzer.models.VideoAnalyzerCollection + :rtype: ~video_analyzer_management_client.models.VideoAnalyzerCollection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VideoAnalyzerCollection"] @@ -68,32 +293,22 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('VideoAnalyzerCollection', pipeline_response) @@ -102,15 +317,17 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VideoAnalyzer" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.VideoAnalyzer": """Get a Video Analyzer account. Get the details of the specified Video Analyzer account. @@ -121,7 +338,7 @@ def get( :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VideoAnalyzer, or the result of cls(response) - :rtype: ~video_analyzer.models.VideoAnalyzer + :rtype: ~video_analyzer_management_client.models.VideoAnalyzer :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VideoAnalyzer"] @@ -129,33 +346,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + 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) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('VideoAnalyzer', pipeline_response) @@ -164,54 +371,44 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.VideoAnalyzer" - **kwargs # type: Any - ): - # type: (...) -> "_models.VideoAnalyzer" + resource_group_name: str, + account_name: str, + parameters: "_models.VideoAnalyzer", + **kwargs: Any + ) -> "_models.VideoAnalyzer": cls = kwargs.pop('cls', None) # type: ClsType["_models.VideoAnalyzer"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VideoAnalyzer') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + 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_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'VideoAnalyzer') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: @@ -221,22 +418,25 @@ def _create_or_update_initial( response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('VideoAnalyzer', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.VideoAnalyzer" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VideoAnalyzer"] + resource_group_name: str, + account_name: str, + parameters: "_models.VideoAnalyzer", + **kwargs: Any + ) -> LROPoller["_models.VideoAnalyzer"]: """Create or update a Video Analyzer account. Create or update an instance of a Video Analyzer account. @@ -246,18 +446,22 @@ def begin_create_or_update( :param account_name: The Video Analyzer account name. :type account_name: str :param parameters: The request parameters. - :type parameters: ~video_analyzer.models.VideoAnalyzer + :type parameters: ~video_analyzer_management_client.models.VideoAnalyzer :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VideoAnalyzer or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~video_analyzer.models.VideoAnalyzer] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VideoAnalyzer or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~video_analyzer_management_client.models.VideoAnalyzer] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VideoAnalyzer"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,27 +473,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('VideoAnalyzer', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -301,15 +499,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}'} # type: ignore + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: """Delete a Video Analyzer account. Delete the specified Video Analyzer account. @@ -328,33 +527,23 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + 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) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -362,73 +551,65 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}'} # type: ignore + def _update_initial( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.VideoAnalyzerUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.VideoAnalyzer" + resource_group_name: str, + account_name: str, + parameters: "_models.VideoAnalyzerUpdate", + **kwargs: Any + ) -> "_models.VideoAnalyzer": cls = kwargs.pop('cls', None) # type: ClsType["_models.VideoAnalyzer"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'VideoAnalyzerUpdate') + + request = build_update_request_initial( + 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_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'VideoAnalyzerUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('VideoAnalyzer', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.VideoAnalyzerUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VideoAnalyzer"] + resource_group_name: str, + account_name: str, + parameters: "_models.VideoAnalyzerUpdate", + **kwargs: Any + ) -> LROPoller["_models.VideoAnalyzer"]: """Update a Video Analyzer account. Updates an existing instance of Video Analyzer account. @@ -438,18 +619,22 @@ def begin_update( :param account_name: The Video Analyzer account name. :type account_name: str :param parameters: The request parameters. - :type parameters: ~video_analyzer.models.VideoAnalyzerUpdate + :type parameters: ~video_analyzer_management_client.models.VideoAnalyzerUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either VideoAnalyzer or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~video_analyzer.models.VideoAnalyzer] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VideoAnalyzer or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~video_analyzer_management_client.models.VideoAnalyzer] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VideoAnalyzer"] lro_delay = kwargs.pop( 'polling_interval', @@ -461,12 +646,11 @@ def begin_update( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): response_headers = {} @@ -474,19 +658,14 @@ def get_long_running_output(pipeline_response): response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) response_headers['Location']=self._deserialize('str', response.headers.get('Location')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('VideoAnalyzer', pipeline_response) - if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -498,20 +677,21 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}'} # type: ignore + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> "_models.VideoAnalyzerCollection" + **kwargs: Any + ) -> "_models.VideoAnalyzerCollection": """List Video Analyzer accounts. List all Video Analyzer accounts in the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response :return: VideoAnalyzerCollection, or the result of cls(response) - :rtype: ~video_analyzer.models.VideoAnalyzerCollection + :rtype: ~video_analyzer_management_client.models.VideoAnalyzerCollection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VideoAnalyzerCollection"] @@ -519,31 +699,21 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('VideoAnalyzerCollection', pipeline_response) @@ -552,4 +722,6 @@ def list_by_subscription( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Media/videoAnalyzers'} # type: ignore + diff --git a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_videos_operations.py b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_videos_operations.py index 31265c5126e20..e3887b951b4eb 100644 --- a/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_videos_operations.py +++ b/sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/operations/_videos_operations.py @@ -5,23 +5,268 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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 HttpRequest, HttpResponse +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_list_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/videos') + 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'), + } + + 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') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + + # 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, + video_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/videos/{videoName}') + 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'), + "videoName": _SERIALIZER.url("video_name", video_name, 'str'), + } + + 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_create_or_update_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + video_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-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/videos/{videoName}') + 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'), + "videoName": _SERIALIZER.url("video_name", video_name, 'str'), + } + + 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, + video_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/videos/{videoName}') + 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'), + "videoName": _SERIALIZER.url("video_name", video_name, 'str'), + } + + 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 + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + video_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-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/videos/{videoName}') + 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'), + "videoName": _SERIALIZER.url("video_name", video_name, 'str'), + } + + 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_list_content_token_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + video_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/videos/{videoName}/listContentToken') + 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'), + "videoName": _SERIALIZER.url("video_name", video_name, 'str'), + } + + 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="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VideosOperations(object): """VideosOperations operations. @@ -30,7 +275,7 @@ class VideosOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~video_analyzer.models + :type models: ~video_analyzer_management_client.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,14 +290,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VideoEntityCollection"] + resource_group_name: str, + account_name: str, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.VideoEntityCollection"]: """Retrieves all existing video resources. Retrieves a list of video resources that have been created, along with their JSON @@ -67,8 +312,10 @@ def list( specified value n. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VideoEntityCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~video_analyzer.models.VideoEntityCollection] + :return: An iterator like instance of either VideoEntityCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~video_analyzer_management_client.models.VideoEntityCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VideoEntityCollection"] @@ -76,38 +323,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + top=top, + 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('VideoEntityCollection', pipeline_response) + deserialized = self._deserialize("VideoEntityCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -120,25 +364,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/videos'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - video_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VideoEntity" + resource_group_name: str, + account_name: str, + video_name: str, + **kwargs: Any + ) -> "_models.VideoEntity": """Retrieves an existing video resource. Retrieves an existing video resource with the given name. @@ -151,7 +396,7 @@ def get( :type video_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VideoEntity, or the result of cls(response) - :rtype: ~video_analyzer.models.VideoEntity + :rtype: ~video_analyzer_management_client.models.VideoEntity :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VideoEntity"] @@ -159,34 +404,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'videoName': self._serialize.url("video_name", video_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + video_name=video_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('VideoEntity', pipeline_response) @@ -195,17 +430,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/videos/{videoName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - video_name, # type: str - parameters, # type: "_models.VideoEntity" - **kwargs # type: Any - ): - # type: (...) -> "_models.VideoEntity" + resource_group_name: str, + account_name: str, + video_name: str, + parameters: "_models.VideoEntity", + **kwargs: Any + ) -> "_models.VideoEntity": """Creates a new video resource or updates an existing one. Creates a new video resource or updates an existing video resource with the given name. @@ -217,10 +454,10 @@ def create_or_update( :param video_name: The Video name. :type video_name: str :param parameters: The request parameters. - :type parameters: ~video_analyzer.models.VideoEntity + :type parameters: ~video_analyzer_management_client.models.VideoEntity :keyword callable cls: A custom type or function that will be passed the direct response :return: VideoEntity, or the result of cls(response) - :rtype: ~video_analyzer.models.VideoEntity + :rtype: ~video_analyzer_management_client.models.VideoEntity :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VideoEntity"] @@ -228,39 +465,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'videoName': self._serialize.url("video_name", video_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'VideoEntity') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + video_name=video_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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'VideoEntity') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -273,16 +500,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/videos/{videoName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - video_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + video_name: str, + **kwargs: Any + ) -> None: """Deletes an existing video resource and its underlying data. Deletes an existing video resource and its underlying data. This operation is irreversible. @@ -303,34 +532,24 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'videoName': self._serialize.url("video_name", video_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + video_name=video_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -338,15 +557,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/videos/{videoName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - video_name, # type: str - parameters, # type: "_models.VideoEntity" - **kwargs # type: Any - ): - # type: (...) -> "_models.VideoEntity" + resource_group_name: str, + account_name: str, + video_name: str, + parameters: "_models.VideoEntity", + **kwargs: Any + ) -> "_models.VideoEntity": """Updates individual properties of an existing video resource. Updates individual properties of an existing video resource with the given name. @@ -358,10 +578,10 @@ def update( :param video_name: The Video name. :type video_name: str :param parameters: The request parameters. - :type parameters: ~video_analyzer.models.VideoEntity + :type parameters: ~video_analyzer_management_client.models.VideoEntity :keyword callable cls: A custom type or function that will be passed the direct response :return: VideoEntity, or the result of cls(response) - :rtype: ~video_analyzer.models.VideoEntity + :rtype: ~video_analyzer_management_client.models.VideoEntity :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VideoEntity"] @@ -369,39 +589,29 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'videoName': self._serialize.url("video_name", video_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'VideoEntity') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + video_name=video_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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'VideoEntity') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('VideoEntity', pipeline_response) @@ -410,16 +620,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/videos/{videoName}'} # type: ignore + + @distributed_trace def list_content_token( self, - resource_group_name, # type: str - account_name, # type: str - video_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VideoContentToken" + resource_group_name: str, + account_name: str, + video_name: str, + **kwargs: Any + ) -> "_models.VideoContentToken": """Generates a streaming token which can be used for accessing content from video content URLs. Generates a streaming token which can be used for accessing content from video content URLs, @@ -433,7 +645,7 @@ def list_content_token( :type video_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VideoContentToken, or the result of cls(response) - :rtype: ~video_analyzer.models.VideoContentToken + :rtype: ~video_analyzer_management_client.models.VideoContentToken :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VideoContentToken"] @@ -441,34 +653,24 @@ def list_content_token( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_content_token.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'videoName': self._serialize.url("video_name", video_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_content_token_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + video_name=video_name, + template_url=self.list_content_token.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('VideoContentToken', pipeline_response) @@ -477,4 +679,6 @@ def list_content_token( return cls(pipeline_response, deserialized, {}) return deserialized + list_content_token.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/videoAnalyzers/{accountName}/videos/{videoName}/listContentToken'} # type: ignore +