diff --git a/sdk/media/azure-mgmt-media/_meta.json b/sdk/media/azure-mgmt-media/_meta.json index 26d1bbce8455..c1e52126f8b4 100644 --- a/sdk/media/azure-mgmt-media/_meta.json +++ b/sdk/media/azure-mgmt-media/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.5", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.3", - "@autorest/modelerfour@4.19.2" + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "9d35bc9e89687145294705eb72e378bd83c1520c", + "commit": "b20c92fa0bf0183e6fde4722ea7c7e73701d44f9", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/mediaservices/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.3 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "autorest_command": "autorest specification/mediaservices/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/mediaservices/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/__init__.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/__init__.py index 3f74a737cb45..9549eea08b53 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/__init__.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['AzureMediaServices'] -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/media/azure-mgmt-media/azure/mgmt/media/_azure_media_services.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/_azure_media_services.py index 1eea00c94747..3ddf4a9c7b90 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/_azure_media_services.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/_azure_media_services.py @@ -6,41 +6,26 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +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 AzureMediaServicesConfiguration +from .operations import AccountFiltersOperations, AssetFiltersOperations, AssetsOperations, ContentKeyPoliciesOperations, JobsOperations, LiveEventsOperations, LiveOutputsOperations, LocationsOperations, MediaservicesOperations, OperationResultsOperations, OperationStatusesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, StreamingEndpointsOperations, StreamingLocatorsOperations, StreamingPoliciesOperations, TracksOperations, TransformsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import AzureMediaServicesConfiguration -from .operations import Operations -from .operations import MediaservicesOperations -from .operations import PrivateLinkResourcesOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import LocationsOperations -from .operations import AccountFiltersOperations -from .operations import AssetsOperations -from .operations import AssetFiltersOperations -from .operations import ContentKeyPoliciesOperations -from .operations import TransformsOperations -from .operations import JobsOperations -from .operations import StreamingPoliciesOperations -from .operations import StreamingLocatorsOperations -from .operations import LiveEventsOperations -from .operations import LiveOutputsOperations -from .operations import StreamingEndpointsOperations -from . import models - -class AzureMediaServices(object): +class AzureMediaServices: """This Swagger was generated by the API Framework. + :ivar account_filters: AccountFiltersOperations operations + :vartype account_filters: azure.mgmt.media.operations.AccountFiltersOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.media.operations.Operations :ivar mediaservices: MediaservicesOperations operations @@ -48,15 +33,20 @@ class AzureMediaServices(object): :ivar private_link_resources: PrivateLinkResourcesOperations operations :vartype private_link_resources: azure.mgmt.media.operations.PrivateLinkResourcesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.media.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.media.operations.PrivateEndpointConnectionsOperations :ivar locations: LocationsOperations operations :vartype locations: azure.mgmt.media.operations.LocationsOperations - :ivar account_filters: AccountFiltersOperations operations - :vartype account_filters: azure.mgmt.media.operations.AccountFiltersOperations :ivar assets: AssetsOperations operations :vartype assets: azure.mgmt.media.operations.AssetsOperations :ivar asset_filters: AssetFiltersOperations operations :vartype asset_filters: azure.mgmt.media.operations.AssetFiltersOperations + :ivar tracks: TracksOperations operations + :vartype tracks: azure.mgmt.media.operations.TracksOperations + :ivar operation_statuses: OperationStatusesOperations operations + :vartype operation_statuses: azure.mgmt.media.operations.OperationStatusesOperations + :ivar operation_results: OperationResultsOperations operations + :vartype operation_results: azure.mgmt.media.operations.OperationResultsOperations :ivar content_key_policies: ContentKeyPoliciesOperations operations :vartype content_key_policies: azure.mgmt.media.operations.ContentKeyPoliciesOperations :ivar transforms: TransformsOperations operations @@ -77,78 +67,72 @@ class AzureMediaServices(object): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The unique identifier for a Microsoft Azure subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = AzureMediaServicesConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = AzureMediaServicesConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.mediaservices = MediaservicesOperations( - 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.locations = LocationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.account_filters = AccountFiltersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.assets = AssetsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.asset_filters = AssetFiltersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.content_key_policies = ContentKeyPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.transforms = TransformsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.streaming_policies = StreamingPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.streaming_locators = StreamingLocatorsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.live_events = LiveEventsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.live_outputs = LiveOutputsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.streaming_endpoints = StreamingEndpointsOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.account_filters = AccountFiltersOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.mediaservices = MediaservicesOperations(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.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.assets = AssetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.asset_filters = AssetFiltersOperations(self._client, self._config, self._serialize, self._deserialize) + self.tracks = TracksOperations(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.content_key_policies = ContentKeyPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.transforms = TransformsOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.streaming_policies = StreamingPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.streaming_locators = StreamingLocatorsOperations(self._client, self._config, self._serialize, self._deserialize) + self.live_events = LiveEventsOperations(self._client, self._config, self._serialize, self._deserialize) + self.live_outputs = LiveOutputsOperations(self._client, self._config, self._serialize, self._deserialize) + self.streaming_endpoints = StreamingEndpointsOperations(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. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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 diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/_configuration.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/_configuration.py index d4710a019776..e9a92f4a0b3a 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/_configuration.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/_configuration.py @@ -6,18 +6,16 @@ # 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 @@ -35,20 +33,18 @@ class AzureMediaServicesConfiguration(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(AzureMediaServicesConfiguration, 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(AzureMediaServicesConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-06-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-media/{}'.format(VERSION)) self._configure(**kwargs) @@ -68,4 +64,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/media/azure-mgmt-media/azure/mgmt/media/_metadata.json b/sdk/media/azure-mgmt-media/azure/mgmt/media/_metadata.json index a6028e57de4c..1c42806d681a 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/_metadata.json +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/_metadata.json @@ -1,17 +1,17 @@ { - "chosen_version": "2021-06-01", - "total_api_version_list": ["2021-06-01"], + "chosen_version": "", + "total_api_version_list": ["2021-06-01", "2021-11-01"], "client": { "name": "AzureMediaServices", "filename": "_azure_media_services", "description": "This Swagger was generated by the API Framework.", - "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\": [\"AzureMediaServicesConfiguration\"]}}, \"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\": [\"AzureMediaServicesConfiguration\"]}}, \"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\": [\"AzureMediaServicesConfiguration\"]}}, \"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\": [\"AzureMediaServicesConfiguration\"]}}, \"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,21 +91,23 @@ "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": { + "account_filters": "AccountFiltersOperations", "operations": "Operations", "mediaservices": "MediaservicesOperations", "private_link_resources": "PrivateLinkResourcesOperations", "private_endpoint_connections": "PrivateEndpointConnectionsOperations", "locations": "LocationsOperations", - "account_filters": "AccountFiltersOperations", "assets": "AssetsOperations", "asset_filters": "AssetFiltersOperations", + "tracks": "TracksOperations", + "operation_statuses": "OperationStatusesOperations", + "operation_results": "OperationResultsOperations", "content_key_policies": "ContentKeyPoliciesOperations", "transforms": "TransformsOperations", "jobs": "JobsOperations", diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/_patch.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/_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/media/azure-mgmt-media/azure/mgmt/media/_vendor.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/_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/media/azure-mgmt-media/azure/mgmt/media/_version.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/_version.py index 142a0420b39b..e5754a47ce68 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/_version.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/__init__.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/__init__.py index 434c2dc4efea..f7028f059677 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/__init__.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/__init__.py @@ -8,3 +8,8 @@ from ._azure_media_services import AzureMediaServices __all__ = ['AzureMediaServices'] + +# `._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/media/azure-mgmt-media/azure/mgmt/media/aio/_azure_media_services.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/_azure_media_services.py index 8f29e300555b..d56dbdf1ab04 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/_azure_media_services.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/_azure_media_services.py @@ -6,39 +6,26 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import AzureMediaServicesConfiguration +from .operations import AccountFiltersOperations, AssetFiltersOperations, AssetsOperations, ContentKeyPoliciesOperations, JobsOperations, LiveEventsOperations, LiveOutputsOperations, LocationsOperations, MediaservicesOperations, OperationResultsOperations, OperationStatusesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, StreamingEndpointsOperations, StreamingLocatorsOperations, StreamingPoliciesOperations, TracksOperations, TransformsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import AzureMediaServicesConfiguration -from .operations import Operations -from .operations import MediaservicesOperations -from .operations import PrivateLinkResourcesOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import LocationsOperations -from .operations import AccountFiltersOperations -from .operations import AssetsOperations -from .operations import AssetFiltersOperations -from .operations import ContentKeyPoliciesOperations -from .operations import TransformsOperations -from .operations import JobsOperations -from .operations import StreamingPoliciesOperations -from .operations import StreamingLocatorsOperations -from .operations import LiveEventsOperations -from .operations import LiveOutputsOperations -from .operations import StreamingEndpointsOperations -from .. import models - - -class AzureMediaServices(object): +class AzureMediaServices: """This Swagger was generated by the API Framework. + :ivar account_filters: AccountFiltersOperations operations + :vartype account_filters: azure.mgmt.media.aio.operations.AccountFiltersOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.media.aio.operations.Operations :ivar mediaservices: MediaservicesOperations operations @@ -46,15 +33,20 @@ class AzureMediaServices(object): :ivar private_link_resources: PrivateLinkResourcesOperations operations :vartype private_link_resources: azure.mgmt.media.aio.operations.PrivateLinkResourcesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.media.aio.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.media.aio.operations.PrivateEndpointConnectionsOperations :ivar locations: LocationsOperations operations :vartype locations: azure.mgmt.media.aio.operations.LocationsOperations - :ivar account_filters: AccountFiltersOperations operations - :vartype account_filters: azure.mgmt.media.aio.operations.AccountFiltersOperations :ivar assets: AssetsOperations operations :vartype assets: azure.mgmt.media.aio.operations.AssetsOperations :ivar asset_filters: AssetFiltersOperations operations :vartype asset_filters: azure.mgmt.media.aio.operations.AssetFiltersOperations + :ivar tracks: TracksOperations operations + :vartype tracks: azure.mgmt.media.aio.operations.TracksOperations + :ivar operation_statuses: OperationStatusesOperations operations + :vartype operation_statuses: azure.mgmt.media.aio.operations.OperationStatusesOperations + :ivar operation_results: OperationResultsOperations operations + :vartype operation_results: azure.mgmt.media.aio.operations.OperationResultsOperations :ivar content_key_policies: ContentKeyPoliciesOperations operations :vartype content_key_policies: azure.mgmt.media.aio.operations.ContentKeyPoliciesOperations :ivar transforms: TransformsOperations operations @@ -75,76 +67,72 @@ class AzureMediaServices(object): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The unique identifier for a Microsoft Azure subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = AzureMediaServicesConfiguration(credential, subscription_id, **kwargs) + self._config = AzureMediaServicesConfiguration(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.account_filters = AccountFiltersOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.mediaservices = MediaservicesOperations(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.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.assets = AssetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.asset_filters = AssetFiltersOperations(self._client, self._config, self._serialize, self._deserialize) + self.tracks = TracksOperations(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.content_key_policies = ContentKeyPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.transforms = TransformsOperations(self._client, self._config, self._serialize, self._deserialize) + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.streaming_policies = StreamingPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.streaming_locators = StreamingLocatorsOperations(self._client, self._config, self._serialize, self._deserialize) + self.live_events = LiveEventsOperations(self._client, self._config, self._serialize, self._deserialize) + self.live_outputs = LiveOutputsOperations(self._client, self._config, self._serialize, self._deserialize) + self.streaming_endpoints = StreamingEndpointsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.mediaservices = MediaservicesOperations( - 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.locations = LocationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.account_filters = AccountFiltersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.assets = AssetsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.asset_filters = AssetFiltersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.content_key_policies = ContentKeyPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.transforms = TransformsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.jobs = JobsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.streaming_policies = StreamingPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.streaming_locators = StreamingLocatorsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.live_events = LiveEventsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.live_outputs = LiveOutputsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.streaming_endpoints = StreamingEndpointsOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + 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() diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/_configuration.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/_configuration.py index 094a409a03d3..46e5102cb414 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/_configuration.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/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 @@ -37,15 +37,14 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(AzureMediaServicesConfiguration, 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(AzureMediaServicesConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-06-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-media/{}'.format(VERSION)) self._configure(**kwargs) @@ -64,4 +63,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/media/azure-mgmt-media/azure/mgmt/media/aio/_patch.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/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/media/azure-mgmt-media/azure/mgmt/media/aio/operations/__init__.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/__init__.py index c6099c10f9ba..b5525401d45e 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/__init__.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/__init__.py @@ -6,14 +6,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._account_filters_operations import AccountFiltersOperations from ._operations import Operations from ._mediaservices_operations import MediaservicesOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._locations_operations import LocationsOperations -from ._account_filters_operations import AccountFiltersOperations from ._assets_operations import AssetsOperations from ._asset_filters_operations import AssetFiltersOperations +from ._tracks_operations import TracksOperations +from ._operation_statuses_operations import OperationStatusesOperations +from ._operation_results_operations import OperationResultsOperations from ._content_key_policies_operations import ContentKeyPoliciesOperations from ._transforms_operations import TransformsOperations from ._jobs_operations import JobsOperations @@ -24,14 +27,17 @@ from ._streaming_endpoints_operations import StreamingEndpointsOperations __all__ = [ + 'AccountFiltersOperations', 'Operations', 'MediaservicesOperations', 'PrivateLinkResourcesOperations', 'PrivateEndpointConnectionsOperations', 'LocationsOperations', - 'AccountFiltersOperations', 'AssetsOperations', 'AssetFiltersOperations', + 'TracksOperations', + 'OperationStatusesOperations', + 'OperationResultsOperations', 'ContentKeyPoliciesOperations', 'TransformsOperations', 'JobsOperations', diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_account_filters_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_account_filters_operations.py index 9b350e80aca2..0bdba379080d 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_account_filters_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_account_filters_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._account_filters_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]] @@ -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, @@ -56,8 +62,10 @@ def list( :param account_name: The Media Services account name. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AccountFilterCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.media.models.AccountFilterCollection] + :return: An iterator like instance of either AccountFilterCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.media.models.AccountFilterCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AccountFilterCollection"] @@ -65,36 +73,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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 = 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, + 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, + 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('AccountFilterCollection', pipeline_response) + deserialized = self._deserialize("AccountFilterCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,17 +112,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/mediaServices/{accountName}/accountFilters'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -145,34 +152,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'filterName': self._serialize.url("filter_name", filter_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, + filter_name=filter_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('AccountFilter', pipeline_response) @@ -181,8 +178,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -213,39 +213,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'filterName': self._serialize.url("filter_name", filter_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, 'AccountFilter') - # 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, + filter_name=filter_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, 'AccountFilter') - 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: @@ -258,8 +248,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/mediaServices/{accountName}/accountFilters/{filterName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -287,34 +280,24 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'filterName': self._serialize.url("filter_name", filter_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, + filter_name=filter_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: @@ -322,6 +305,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -352,39 +337,29 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'filterName': self._serialize.url("filter_name", filter_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, 'AccountFilter') - # 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, + filter_name=filter_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, 'AccountFilter') - 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('AccountFilter', pipeline_response) @@ -393,4 +368,6 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}'} # type: ignore + diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_asset_filters_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_asset_filters_operations.py index d8fab50a5bf4..e0e2d9d1202e 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_asset_filters_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_asset_filters_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._asset_filters_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]] @@ -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, @@ -59,7 +65,8 @@ def list( :param asset_name: The Asset name. :type asset_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AssetFilterCollection or the result of cls(response) + :return: An iterator like instance of either AssetFilterCollection or the result of + cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.media.models.AssetFilterCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -68,37 +75,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'assetName': self._serialize.url("asset_name", asset_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 = 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, + asset_name=asset_name, + 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, + asset_name=asset_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AssetFilterCollection', pipeline_response) + deserialized = self._deserialize("AssetFilterCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,17 +116,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/mediaServices/{accountName}/assets/{assetName}/assetFilters'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -152,35 +159,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'assetName': self._serialize.url("asset_name", asset_name, 'str'), - 'filterName': self._serialize.url("filter_name", filter_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, + asset_name=asset_name, + filter_name=filter_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('AssetFilter', 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/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -224,40 +224,30 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'assetName': self._serialize.url("asset_name", asset_name, 'str'), - 'filterName': self._serialize.url("filter_name", filter_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, 'AssetFilter') - # 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, + asset_name=asset_name, + filter_name=filter_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, 'AssetFilter') - 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: @@ -270,8 +260,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/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -302,35 +295,25 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'assetName': self._serialize.url("asset_name", asset_name, 'str'), - 'filterName': self._serialize.url("filter_name", filter_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, + asset_name=asset_name, + filter_name=filter_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/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -371,40 +356,30 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'assetName': self._serialize.url("asset_name", asset_name, 'str'), - 'filterName': self._serialize.url("filter_name", filter_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, 'AssetFilter') - # 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, + asset_name=asset_name, + filter_name=filter_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, 'AssetFilter') - 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('AssetFilter', pipeline_response) @@ -413,4 +388,6 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}'} # type: ignore + diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_assets_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_assets_operations.py index aa61bef1a963..cca002d20f6f 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_assets_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_assets_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._assets_operations import build_create_or_update_request, build_delete_request, build_get_encryption_key_request, build_get_request, build_list_container_sas_request, build_list_request, build_list_streaming_locators_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -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, @@ -76,42 +82,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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') - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - - 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, + orderby=orderby, + 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, + orderby=orderby, + 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('AssetCollection', pipeline_response) + deserialized = self._deserialize("AssetCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -124,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/mediaServices/{accountName}/assets'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -162,34 +167,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'assetName': self._serialize.url("asset_name", asset_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, + asset_name=asset_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('Asset', pipeline_response) @@ -198,8 +193,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -230,39 +228,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'assetName': self._serialize.url("asset_name", asset_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, 'Asset') - # 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, + asset_name=asset_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, 'Asset') - 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 +263,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/mediaServices/{accountName}/assets/{assetName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -304,34 +295,24 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'assetName': self._serialize.url("asset_name", asset_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, + asset_name=asset_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: @@ -339,6 +320,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -369,39 +352,29 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'assetName': self._serialize.url("asset_name", asset_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, 'Asset') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_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, 'Asset') - 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('Asset', pipeline_response) @@ -410,8 +383,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}'} # type: ignore + + @distributed_trace_async async def list_container_sas( self, resource_group_name: str, @@ -443,39 +419,29 @@ async def list_container_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_container_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'assetName': self._serialize.url("asset_name", asset_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, 'ListContainerSasInput') + + request = build_list_container_sas_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + content_type=content_type, + json=_json, + template_url=self.list_container_sas.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, 'ListContainerSasInput') - 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('AssetContainerSas', pipeline_response) @@ -484,8 +450,11 @@ async def list_container_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_container_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/listContainerSas'} # type: ignore + + @distributed_trace_async async def get_encryption_key( self, resource_group_name: str, @@ -514,34 +483,24 @@ async def get_encryption_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_encryption_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'assetName': self._serialize.url("asset_name", asset_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_encryption_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + template_url=self.get_encryption_key.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('StorageEncryptedAssetDecryptionData', pipeline_response) @@ -550,8 +509,11 @@ async def get_encryption_key( return cls(pipeline_response, deserialized, {}) return deserialized + get_encryption_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/getEncryptionKey'} # type: ignore + + @distributed_trace_async async def list_streaming_locators( self, resource_group_name: str, @@ -579,34 +541,24 @@ async def list_streaming_locators( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list_streaming_locators.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'assetName': self._serialize.url("asset_name", asset_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_streaming_locators_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + template_url=self.list_streaming_locators.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('ListStreamingLocatorsResponse', pipeline_response) @@ -615,4 +567,6 @@ async def list_streaming_locators( return cls(pipeline_response, deserialized, {}) return deserialized + list_streaming_locators.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/listStreamingLocators'} # type: ignore + diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_content_key_policies_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_content_key_policies_operations.py index 9ae0de30511a..9c11178a31d9 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_content_key_policies_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_content_key_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._content_key_policies_operations import build_create_or_update_request, build_delete_request, build_get_policy_properties_with_secrets_request, build_get_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -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, @@ -67,8 +73,10 @@ def list( :param orderby: Specifies the key by which the result collection should be ordered. :type orderby: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ContentKeyPolicyCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.media.models.ContentKeyPolicyCollection] + :return: An iterator like instance of either ContentKeyPolicyCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.media.models.ContentKeyPolicyCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ContentKeyPolicyCollection"] @@ -76,42 +84,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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') - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - - 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, + orderby=orderby, + 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, + orderby=orderby, + 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('ContentKeyPolicyCollection', pipeline_response) + deserialized = self._deserialize("ContentKeyPolicyCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -124,17 +129,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/mediaServices/{accountName}/contentKeyPolicies'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -162,34 +169,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'contentKeyPolicyName': self._serialize.url("content_key_policy_name", content_key_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, + content_key_policy_name=content_key_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('ContentKeyPolicy', pipeline_response) @@ -198,8 +195,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -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-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'contentKeyPolicyName': self._serialize.url("content_key_policy_name", content_key_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, 'ContentKeyPolicy') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + content_key_policy_name=content_key_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, 'ContentKeyPolicy') - 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/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -304,34 +297,24 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'contentKeyPolicyName': self._serialize.url("content_key_policy_name", content_key_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, + content_key_policy_name=content_key_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: @@ -339,6 +322,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -369,39 +354,29 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'contentKeyPolicyName': self._serialize.url("content_key_policy_name", content_key_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, 'ContentKeyPolicy') - # 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, + content_key_policy_name=content_key_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, 'ContentKeyPolicy') - 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('ContentKeyPolicy', pipeline_response) @@ -410,8 +385,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}'} # type: ignore + + @distributed_trace_async async def get_policy_properties_with_secrets( self, resource_group_name: str, @@ -439,34 +417,24 @@ async def get_policy_properties_with_secrets( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_policy_properties_with_secrets.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'contentKeyPolicyName': self._serialize.url("content_key_policy_name", content_key_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_policy_properties_with_secrets_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + content_key_policy_name=content_key_policy_name, + template_url=self.get_policy_properties_with_secrets.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('ContentKeyPolicyProperties', pipeline_response) @@ -475,4 +443,6 @@ async def get_policy_properties_with_secrets( return cls(pipeline_response, deserialized, {}) return deserialized + get_policy_properties_with_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}/getPolicyPropertiesWithSecrets'} # type: ignore + diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_jobs_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_jobs_operations.py index 85a615d44aa5..f5866e54688e 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_jobs_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_jobs_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 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._jobs_operations import build_cancel_job_request, build_create_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]] @@ -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, @@ -74,41 +80,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'transformName': self._serialize.url("transform_name", transform_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 orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - - 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, + transform_name=transform_name, + filter=filter, + orderby=orderby, + 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, + transform_name=transform_name, + filter=filter, + orderby=orderby, + 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('JobCollection', pipeline_response) + deserialized = self._deserialize("JobCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -121,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/mediaServices/{accountName}/transforms/{transformName}/jobs'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -162,35 +168,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'transformName': self._serialize.url("transform_name", transform_name, 'str'), - 'jobName': self._serialize.url("job_name", 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, + transform_name=transform_name, + job_name=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('Job', pipeline_response) @@ -199,8 +195,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}'} # type: ignore + + @distributed_trace_async async def create( self, resource_group_name: str, @@ -234,40 +233,30 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'transformName': self._serialize.url("transform_name", transform_name, 'str'), - 'jobName': self._serialize.url("job_name", 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, 'Job') + + request = build_create_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + transform_name=transform_name, + job_name=job_name, + content_type=content_type, + json=_json, + template_url=self.create.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, 'Job') - 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) deserialized = self._deserialize('Job', pipeline_response) @@ -276,8 +265,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -308,35 +300,25 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'transformName': self._serialize.url("transform_name", transform_name, 'str'), - 'jobName': self._serialize.url("job_name", 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, + transform_name=transform_name, + job_name=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: @@ -344,6 +326,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -379,40 +363,30 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'transformName': self._serialize.url("transform_name", transform_name, 'str'), - 'jobName': self._serialize.url("job_name", 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, 'Job') - # 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, + transform_name=transform_name, + job_name=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, 'Job') - 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('Job', pipeline_response) @@ -421,8 +395,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}'} # type: ignore + + @distributed_trace_async async def cancel_job( self, resource_group_name: str, @@ -453,38 +430,29 @@ async def cancel_job( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.cancel_job.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'transformName': self._serialize.url("transform_name", transform_name, 'str'), - 'jobName': self._serialize.url("job_name", 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_job_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + transform_name=transform_name, + job_name=job_name, + template_url=self.cancel_job.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) if cls: return cls(pipeline_response, None, {}) cancel_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}/cancelJob'} # type: ignore + diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_live_events_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_live_events_operations.py index 0ec8ca649164..38ec8c56444b 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_live_events_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_live_events_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_events_operations import build_allocate_request_initial, build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_reset_request_initial, build_start_request_initial, build_stop_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -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,36 +73,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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 = 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, + 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, + 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('LiveEventListResult', pipeline_response) + deserialized = self._deserialize("LiveEventListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -109,17 +112,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/mediaservices/{accountName}/liveEvents'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -147,34 +152,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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_event_name=live_event_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('LiveEvent', pipeline_response) @@ -183,8 +178,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -199,42 +196,30 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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 auto_start is not None: - query_parameters['autoStart'] = self._serialize.query("auto_start", auto_start, 'bool') - - # 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') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'LiveEvent') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'LiveEvent') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_event_name=live_event_name, + content_type=content_type, + json=_json, + auto_start=auto_start, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 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) if response.status_code == 200: deserialized = self._deserialize('LiveEvent', pipeline_response) @@ -246,8 +231,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -274,15 +262,19 @@ async def begin_create( :type auto_start: bool :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 LiveEvent or the result of cls(response) + :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 LiveEvent or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.media.models.LiveEvent] - :raises ~azure.core.exceptions.HttpResponseError: + :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.LiveEvent"] lro_delay = kwargs.pop( 'polling_interval', @@ -296,28 +288,21 @@ async def begin_create( live_event_name=live_event_name, parameters=parameters, auto_start=auto_start, + 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('LiveEvent', 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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: @@ -329,6 +314,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}'} # type: ignore async def _update_initial( @@ -344,40 +330,29 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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, 'LiveEvent') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_event_name=live_event_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, 'LiveEvent') - 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, 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 response.status_code == 200: deserialized = self._deserialize('LiveEvent', pipeline_response) @@ -389,8 +364,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -411,15 +389,19 @@ async def begin_update( :type parameters: ~azure.mgmt.media.models.LiveEvent :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 LiveEvent or the result of cls(response) + :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 LiveEvent or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.media.models.LiveEvent] - :raises ~azure.core.exceptions.HttpResponseError: + :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.LiveEvent"] lro_delay = kwargs.pop( 'polling_interval', @@ -432,28 +414,21 @@ async def begin_update( account_name=account_name, live_event_name=live_event_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('LiveEvent', 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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: @@ -465,6 +440,7 @@ 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/mediaservices/{accountName}/liveEvents/{liveEventName}'} # type: ignore async def _delete_initial( @@ -479,41 +455,32 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_event_name=live_event_name, + template_url=self._delete_initial.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, 202, 204]: 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, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -533,15 +500,17 @@ async def begin_delete( :type live_event_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', @@ -556,22 +525,14 @@ async def begin_delete( 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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: @@ -583,6 +544,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}'} # type: ignore async def _allocate_initial( @@ -597,41 +559,32 @@ async def _allocate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._allocate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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_allocate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_event_name=live_event_name, + template_url=self._allocate_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, {}) _allocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/allocate'} # type: ignore + + @distributed_trace_async async def begin_allocate( self, resource_group_name: str, @@ -651,15 +604,17 @@ async def begin_allocate( :type live_event_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', @@ -674,22 +629,14 @@ async def begin_allocate( 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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: @@ -701,6 +648,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_allocate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/allocate'} # type: ignore async def _start_initial( @@ -715,41 +663,32 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_event_name=live_event_name, + template_url=self._start_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, {}) _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -770,15 +709,17 @@ async def begin_start( :type live_event_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', @@ -793,22 +734,14 @@ async def begin_start( 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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: @@ -820,6 +753,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/start'} # type: ignore async def _stop_initial( @@ -835,46 +769,37 @@ async def _stop_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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, 'LiveEventActionInput') + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_event_name=live_event_name, + content_type=content_type, + json=_json, + template_url=self._stop_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, 'LiveEventActionInput') - 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, 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, {}) _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/stop'} # type: ignore + + @distributed_trace_async async def begin_stop( self, resource_group_name: str, @@ -897,15 +822,18 @@ async def begin_stop( :type parameters: ~azure.mgmt.media.models.LiveEventActionInput :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] + 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[None] lro_delay = kwargs.pop( 'polling_interval', @@ -918,25 +846,18 @@ async def begin_stop( account_name=account_name, live_event_name=live_event_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): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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: @@ -948,6 +869,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/stop'} # type: ignore async def _reset_initial( @@ -962,41 +884,32 @@ async def _reset_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._reset_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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_reset_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_event_name=live_event_name, + template_url=self._reset_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, {}) _reset_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/reset'} # type: ignore + + @distributed_trace_async async def begin_reset( self, resource_group_name: str, @@ -1018,15 +931,17 @@ async def begin_reset( :type live_event_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', @@ -1041,22 +956,14 @@ async def begin_reset( 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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: @@ -1068,4 +975,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reset.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/reset'} # type: ignore diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_live_outputs_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_live_outputs_operations.py index 3a1065c8f564..2704b3211a7b 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_live_outputs_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_live_outputs_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_outputs_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -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, @@ -61,7 +67,8 @@ def list( :param live_event_name: The name of the live event, maximum length is 32. :type live_event_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either LiveOutputListResult or the result of cls(response) + :return: An iterator like instance of either LiveOutputListResult or the result of + cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.media.models.LiveOutputListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -70,37 +77,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_event_name=live_event_name, + 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, + live_event_name=live_event_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('LiveOutputListResult', pipeline_response) + deserialized = self._deserialize("LiveOutputListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,17 +118,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/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -154,35 +161,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - 'liveOutputName': self._serialize.url("live_output_name", live_output_name, 'str', max_length=256, min_length=1, pattern=r'^([a-zA-Z0-9])+(-*[a-zA-Z0-9])*$'), - } - 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_event_name=live_event_name, + live_output_name=live_output_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('LiveOutput', pipeline_response) @@ -191,8 +188,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -207,41 +206,30 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - 'liveOutputName': self._serialize.url("live_output_name", live_output_name, 'str', max_length=256, min_length=1, pattern=r'^([a-zA-Z0-9])+(-*[a-zA-Z0-9])*$'), - } - 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, 'LiveOutput') - # 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_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_event_name=live_event_name, + live_output_name=live_output_name, + content_type=content_type, + json=_json, + template_url=self._create_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, 'LiveOutput') - 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) if response.status_code == 200: deserialized = self._deserialize('LiveOutput', pipeline_response) @@ -253,8 +241,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -280,15 +271,19 @@ async def begin_create( :type parameters: ~azure.mgmt.media.models.LiveOutput :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 LiveOutput or the result of cls(response) + :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 LiveOutput or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.media.models.LiveOutput] - :raises ~azure.core.exceptions.HttpResponseError: + :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.LiveOutput"] lro_delay = kwargs.pop( 'polling_interval', @@ -302,29 +297,21 @@ async def begin_create( live_event_name=live_event_name, live_output_name=live_output_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('LiveOutput', 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - 'liveOutputName': self._serialize.url("live_output_name", live_output_name, 'str', max_length=256, min_length=1, pattern=r'^([a-zA-Z0-9])+(-*[a-zA-Z0-9])*$'), - } - 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: @@ -336,6 +323,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}'} # type: ignore async def _delete_initial( @@ -351,42 +339,33 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - 'liveOutputName': self._serialize.url("live_output_name", live_output_name, 'str', max_length=256, min_length=1, pattern=r'^([a-zA-Z0-9])+(-*[a-zA-Z0-9])*$'), - } - 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_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_event_name=live_event_name, + live_output_name=live_output_name, + template_url=self._delete_initial.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, 202, 204]: 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, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -410,15 +389,17 @@ async def begin_delete( :type live_output_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', @@ -434,23 +415,14 @@ async def begin_delete( 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - 'liveOutputName': self._serialize.url("live_output_name", live_output_name, 'str', max_length=256, min_length=1, pattern=r'^([a-zA-Z0-9])+(-*[a-zA-Z0-9])*$'), - } - 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: @@ -462,4 +434,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}'} # type: ignore diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_locations_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_locations_operations.py index 4af5653619c7..317247688df9 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_locations_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/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]] @@ -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, @@ -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-06-01" - 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'), - '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, 'CheckNameAvailabilityInput') - # 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, 'CheckNameAvailabilityInput') - 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('EntityNameAvailabilityCheckOutput', 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/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_mediaservices_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_mediaservices_operations.py index 182729ed3cf6..b4bdddd7cee9 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_mediaservices_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_mediaservices_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._mediaservices_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_subscription_request, build_list_edge_policies_request, build_list_request, build_sync_storage_keys_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -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, @@ -53,8 +59,10 @@ def list( :param resource_group_name: The name of the resource group within the Azure subscription. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MediaServiceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.media.models.MediaServiceCollection] + :return: An iterator like instance of either MediaServiceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.media.models.MediaServiceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.MediaServiceCollection"] @@ -62,35 +70,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_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 = self._client.get(url, query_parameters, header_parameters) + + 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) + 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, + 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('MediaServiceCollection', pipeline_response) + deserialized = self._deserialize("MediaServiceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,17 +107,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/mediaservices'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -138,33 +144,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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('MediaService', pipeline_response) @@ -173,8 +169,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -202,38 +201,28 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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, 'MediaService') - # 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, + 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, 'MediaService') - 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: @@ -246,8 +235,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/mediaservices/{accountName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -272,33 +264,23 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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: @@ -306,6 +288,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -333,38 +317,28 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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, 'MediaServiceUpdate') - # 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, + 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, 'MediaServiceUpdate') - 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('MediaService', pipeline_response) @@ -373,8 +347,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}'} # type: ignore + + @distributed_trace_async async def sync_storage_keys( self, resource_group_name: str, @@ -403,38 +380,28 @@ async def sync_storage_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.sync_storage_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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, 'SyncStorageKeysInput') - # 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_sync_storage_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + content_type=content_type, + json=_json, + template_url=self.sync_storage_keys.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, 'SyncStorageKeysInput') - 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) if cls: @@ -442,6 +409,8 @@ async def sync_storage_keys( sync_storage_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/syncStorageKeys'} # type: ignore + + @distributed_trace_async async def list_edge_policies( self, resource_group_name: str, @@ -469,38 +438,28 @@ async def list_edge_policies( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_edge_policies.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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, 'ListEdgePoliciesInput') - # 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_edge_policies_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + content_type=content_type, + json=_json, + template_url=self.list_edge_policies.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, 'ListEdgePoliciesInput') - 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('EdgePolicies', pipeline_response) @@ -509,8 +468,11 @@ async def list_edge_policies( return cls(pipeline_response, deserialized, {}) return deserialized + list_edge_policies.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/listEdgePolicies'} # type: ignore + + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -520,8 +482,10 @@ def list_by_subscription( List Media Services accounts in the subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MediaServiceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.media.models.MediaServiceCollection] + :return: An iterator like instance of either MediaServiceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.media.models.MediaServiceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.MediaServiceCollection"] @@ -529,34 +493,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + 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) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('MediaServiceCollection', pipeline_response) + deserialized = self._deserialize("MediaServiceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -569,12 +528,13 @@ 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 ) diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_operation_results_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_operation_results_operations.py new file mode 100644 index 000000000000..ded9c1072e1c --- /dev/null +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_operation_results_operations.py @@ -0,0 +1,120 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operation_results_operations import build_get_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class OperationResultsOperations: + """OperationResultsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.media.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + track_name: str, + operation_id: str, + **kwargs: Any + ) -> Optional["_models.AssetTrack"]: + """Get operation result. + + Get asset track operation result. + + :param resource_group_name: The name of the resource group within the Azure subscription. + :type resource_group_name: str + :param account_name: The Media Services account name. + :type account_name: str + :param asset_name: The Asset name. + :type asset_name: str + :param track_name: The Asset Track name. + :type track_name: str + :param operation_id: Operation Id. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AssetTrack, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.AssetTrack or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AssetTrack"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + track_name=track_name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize('AssetTrack', pipeline_response) + + if response.status_code == 202: + 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')) + + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}/operationResults/{operationId}'} # type: ignore + diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_operation_statuses_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_operation_statuses_operations.py new file mode 100644 index 000000000000..f7d851b44789 --- /dev/null +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_operation_statuses_operations.py @@ -0,0 +1,111 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operation_statuses_operations import build_get_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class OperationStatusesOperations: + """OperationStatusesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.media.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + track_name: str, + operation_id: str, + **kwargs: Any + ) -> "_models.AssetTrackOperationStatus": + """Get operation status. + + Get asset track operation status. + + :param resource_group_name: The name of the resource group within the Azure subscription. + :type resource_group_name: str + :param account_name: The Media Services account name. + :type account_name: str + :param asset_name: The Asset name. + :type asset_name: str + :param track_name: The Asset Track name. + :type track_name: str + :param operation_id: Operation Id. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AssetTrackOperationStatus, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.AssetTrackOperationStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AssetTrackOperationStatus"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + track_name=track_name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AssetTrackOperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}/operationStatuses/{operationId}'} # type: ignore + diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_operations.py index 329479997fbb..7780f926b8de 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/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]] @@ -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 @@ -58,27 +63,20 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_private_endpoint_connections_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_private_endpoint_connections_operations.py index f5af6f105a9f..3118df62f27e 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/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]] @@ -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, @@ -64,33 +69,23 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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 = 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/mediaservices/{accountName}/privateEndpointConnections'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -128,34 +126,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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 = 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/mediaservices/{accountName}/privateEndpointConnections/{name}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -196,39 +187,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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] - # 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, 'PrivateEndpointConnection') + + 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 [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) @@ -237,8 +218,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/mediaservices/{accountName}/privateEndpointConnections/{name}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -266,37 +250,28 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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/mediaservices/{accountName}/privateEndpointConnections/{name}'} # type: ignore + diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_private_link_resources_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_private_link_resources_operations.py index 296c88b37b88..dda193f55ad0 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_private_link_resources_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/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]] @@ -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, @@ -64,33 +69,23 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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/mediaservices/{accountName}/privateLinkResources'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -128,34 +126,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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/mediaservices/{accountName}/privateLinkResources/{name}'} # type: ignore + diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_streaming_endpoints_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_streaming_endpoints_operations.py index 2241de3e99c7..76247e7383c1 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_streaming_endpoints_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_streaming_endpoints_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._streaming_endpoints_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_scale_request_initial, build_skus_request, build_start_request_initial, build_stop_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -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, @@ -58,8 +64,10 @@ def list( :param account_name: The Media Services account name. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StreamingEndpointListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.media.models.StreamingEndpointListResult] + :return: An iterator like instance of either StreamingEndpointListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.media.models.StreamingEndpointListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingEndpointListResult"] @@ -67,36 +75,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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 = 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, + 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, + 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('StreamingEndpointListResult', pipeline_response) + deserialized = self._deserialize("StreamingEndpointListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -109,17 +114,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/mediaservices/{accountName}/streamingEndpoints'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -147,34 +154,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingEndpointName': self._serialize.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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, + streaming_endpoint_name=streaming_endpoint_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('StreamingEndpoint', pipeline_response) @@ -183,8 +180,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -199,42 +198,30 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingEndpointName': self._serialize.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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 auto_start is not None: - query_parameters['autoStart'] = self._serialize.query("auto_start", auto_start, 'bool') - - # 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') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StreamingEndpoint') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StreamingEndpoint') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + streaming_endpoint_name=streaming_endpoint_name, + content_type=content_type, + json=_json, + auto_start=auto_start, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 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) if response.status_code == 200: deserialized = self._deserialize('StreamingEndpoint', pipeline_response) @@ -246,8 +233,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -274,15 +264,19 @@ async def begin_create( :type auto_start: bool :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 StreamingEndpoint or the result of cls(response) + :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 StreamingEndpoint or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.media.models.StreamingEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: + :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.StreamingEndpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -296,28 +290,21 @@ async def begin_create( streaming_endpoint_name=streaming_endpoint_name, parameters=parameters, auto_start=auto_start, + 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('StreamingEndpoint', 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingEndpointName': self._serialize.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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: @@ -329,6 +316,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}'} # type: ignore async def _update_initial( @@ -344,40 +332,29 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingEndpointName': self._serialize.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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, 'StreamingEndpoint') - # 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_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + streaming_endpoint_name=streaming_endpoint_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, 'StreamingEndpoint') - 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, 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 response.status_code == 200: deserialized = self._deserialize('StreamingEndpoint', pipeline_response) @@ -389,8 +366,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -413,15 +393,19 @@ async def begin_update( :type parameters: ~azure.mgmt.media.models.StreamingEndpoint :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 StreamingEndpoint or the result of cls(response) + :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 StreamingEndpoint or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.media.models.StreamingEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: + :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.StreamingEndpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -434,28 +418,21 @@ async def begin_update( account_name=account_name, streaming_endpoint_name=streaming_endpoint_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('StreamingEndpoint', 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingEndpointName': self._serialize.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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: @@ -467,6 +444,7 @@ 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/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}'} # type: ignore async def _delete_initial( @@ -481,41 +459,32 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingEndpointName': self._serialize.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + streaming_endpoint_name=streaming_endpoint_name, + template_url=self._delete_initial.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, 202, 204]: 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, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -535,15 +504,17 @@ async def begin_delete( :type streaming_endpoint_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', @@ -558,22 +529,14 @@ async def begin_delete( 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingEndpointName': self._serialize.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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: @@ -585,8 +548,67 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}'} # type: ignore + @distributed_trace_async + async def skus( + self, + resource_group_name: str, + account_name: str, + streaming_endpoint_name: str, + **kwargs: Any + ) -> "_models.StreamingEndpointSkuInfoListResult": + """List StreamingEndpoint skus. + + List streaming endpoint supported skus. + + :param resource_group_name: The name of the resource group within the Azure subscription. + :type resource_group_name: str + :param account_name: The Media Services account name. + :type account_name: str + :param streaming_endpoint_name: The name of the streaming endpoint, maximum length is 24. + :type streaming_endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StreamingEndpointSkuInfoListResult, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.StreamingEndpointSkuInfoListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingEndpointSkuInfoListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_skus_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + streaming_endpoint_name=streaming_endpoint_name, + template_url=self.skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StreamingEndpointSkuInfoListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/skus'} # type: ignore + + async def _start_initial( self, resource_group_name: str, @@ -599,41 +621,32 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingEndpointName': self._serialize.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + streaming_endpoint_name=streaming_endpoint_name, + template_url=self._start_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, {}) _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -653,15 +666,17 @@ async def begin_start( :type streaming_endpoint_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', @@ -676,22 +691,14 @@ async def begin_start( 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingEndpointName': self._serialize.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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: @@ -703,6 +710,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/start'} # type: ignore async def _stop_initial( @@ -717,41 +725,32 @@ async def _stop_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingEndpointName': self._serialize.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + streaming_endpoint_name=streaming_endpoint_name, + template_url=self._stop_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, {}) _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/stop'} # type: ignore + + @distributed_trace_async async def begin_stop( self, resource_group_name: str, @@ -771,15 +770,17 @@ async def begin_stop( :type streaming_endpoint_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', @@ -794,22 +795,14 @@ async def begin_stop( 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingEndpointName': self._serialize.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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: @@ -821,6 +814,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/stop'} # type: ignore async def _scale_initial( @@ -836,46 +830,37 @@ async def _scale_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._scale_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingEndpointName': self._serialize.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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, 'StreamingEntityScaleUnit') - # 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_scale_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + streaming_endpoint_name=streaming_endpoint_name, + content_type=content_type, + json=_json, + template_url=self._scale_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, 'StreamingEntityScaleUnit') - 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, 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, {}) _scale_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/scale'} # type: ignore + + @distributed_trace_async async def begin_scale( self, resource_group_name: str, @@ -898,15 +883,18 @@ async def begin_scale( :type parameters: ~azure.mgmt.media.models.StreamingEntityScaleUnit :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] + 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[None] lro_delay = kwargs.pop( 'polling_interval', @@ -919,25 +907,18 @@ async def begin_scale( account_name=account_name, streaming_endpoint_name=streaming_endpoint_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): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingEndpointName': self._serialize.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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: @@ -949,4 +930,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_scale.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/scale'} # type: ignore diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_streaming_locators_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_streaming_locators_operations.py index bb041ac3659e..1420982ce4f7 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_streaming_locators_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_streaming_locators_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 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._streaming_locators_operations import build_create_request, build_delete_request, build_get_request, build_list_content_keys_request, build_list_paths_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -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, @@ -67,8 +73,10 @@ def list( :param orderby: Specifies the key by which the result collection should be ordered. :type orderby: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StreamingLocatorCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.media.models.StreamingLocatorCollection] + :return: An iterator like instance of either StreamingLocatorCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.media.models.StreamingLocatorCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingLocatorCollection"] @@ -76,42 +84,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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') - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - - 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, + orderby=orderby, + 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, + orderby=orderby, + 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('StreamingLocatorCollection', pipeline_response) + deserialized = self._deserialize("StreamingLocatorCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -124,17 +129,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/mediaServices/{accountName}/streamingLocators'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -162,34 +169,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingLocatorName': self._serialize.url("streaming_locator_name", streaming_locator_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, + streaming_locator_name=streaming_locator_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('StreamingLocator', pipeline_response) @@ -198,8 +195,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}'} # type: ignore + + @distributed_trace_async async def create( self, resource_group_name: str, @@ -230,39 +230,29 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingLocatorName': self._serialize.url("streaming_locator_name", streaming_locator_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, 'StreamingLocator') + + request = build_create_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + streaming_locator_name=streaming_locator_name, + content_type=content_type, + json=_json, + template_url=self.create.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, 'StreamingLocator') - 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) deserialized = self._deserialize('StreamingLocator', pipeline_response) @@ -271,8 +261,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -300,34 +293,24 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingLocatorName': self._serialize.url("streaming_locator_name", streaming_locator_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, + streaming_locator_name=streaming_locator_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: @@ -335,6 +318,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}'} # type: ignore + + @distributed_trace_async async def list_content_keys( self, resource_group_name: str, @@ -362,34 +347,24 @@ async def list_content_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list_content_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingLocatorName': self._serialize.url("streaming_locator_name", streaming_locator_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_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + streaming_locator_name=streaming_locator_name, + template_url=self.list_content_keys.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('ListContentKeysResponse', pipeline_response) @@ -398,8 +373,11 @@ async def list_content_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_content_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}/listContentKeys'} # type: ignore + + @distributed_trace_async async def list_paths( self, resource_group_name: str, @@ -427,34 +405,24 @@ async def list_paths( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list_paths.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingLocatorName': self._serialize.url("streaming_locator_name", streaming_locator_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_paths_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + streaming_locator_name=streaming_locator_name, + template_url=self.list_paths.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('ListPathsResponse', pipeline_response) @@ -463,4 +431,6 @@ async def list_paths( return cls(pipeline_response, deserialized, {}) return deserialized + list_paths.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}/listPaths'} # type: ignore + diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_streaming_policies_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_streaming_policies_operations.py index 6479e30e56f3..0c53828247d0 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_streaming_policies_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_streaming_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 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._streaming_policies_operations import build_create_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -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, @@ -67,8 +73,10 @@ def list( :param orderby: Specifies the key by which the result collection should be ordered. :type orderby: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StreamingPolicyCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.media.models.StreamingPolicyCollection] + :return: An iterator like instance of either StreamingPolicyCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.media.models.StreamingPolicyCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingPolicyCollection"] @@ -76,42 +84,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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') - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - - 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, + orderby=orderby, + 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, + orderby=orderby, + 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('StreamingPolicyCollection', pipeline_response) + deserialized = self._deserialize("StreamingPolicyCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -124,17 +129,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/mediaServices/{accountName}/streamingPolicies'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -162,34 +169,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingPolicyName': self._serialize.url("streaming_policy_name", streaming_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, + streaming_policy_name=streaming_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('StreamingPolicy', pipeline_response) @@ -198,8 +195,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName}'} # type: ignore + + @distributed_trace_async async def create( self, resource_group_name: str, @@ -230,39 +230,29 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingPolicyName': self._serialize.url("streaming_policy_name", streaming_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, 'StreamingPolicy') - # 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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + streaming_policy_name=streaming_policy_name, + content_type=content_type, + json=_json, + template_url=self.create.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, 'StreamingPolicy') - 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) deserialized = self._deserialize('StreamingPolicy', pipeline_response) @@ -271,8 +261,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -300,37 +293,28 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingPolicyName': self._serialize.url("streaming_policy_name", streaming_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, + streaming_policy_name=streaming_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: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName}'} # type: ignore + diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_tracks_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_tracks_operations.py new file mode 100644 index 000000000000..0d409f432328 --- /dev/null +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_tracks_operations.py @@ -0,0 +1,718 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, 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 +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._tracks_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial, build_update_track_data_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TracksOperations: + """TracksOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.media.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.AssetTrackCollection"]: + """List Tracks in the Asset. + + Lists the Tracks in the asset. + + :param resource_group_name: The name of the resource group within the Azure subscription. + :type resource_group_name: str + :param account_name: The Media Services account name. + :type account_name: str + :param asset_name: The Asset name. + :type asset_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AssetTrackCollection or the result of + cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.media.models.AssetTrackCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AssetTrackCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AssetTrackCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks'} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + track_name: str, + **kwargs: Any + ) -> "_models.AssetTrack": + """Get a Track. + + Get the details of a Track in the Asset. + + :param resource_group_name: The name of the resource group within the Azure subscription. + :type resource_group_name: str + :param account_name: The Media Services account name. + :type account_name: str + :param asset_name: The Asset name. + :type asset_name: str + :param track_name: The Asset Track name. + :type track_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AssetTrack, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.AssetTrack + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AssetTrack"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + track_name=track_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AssetTrack', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}'} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + track_name: str, + parameters: "_models.AssetTrack", + **kwargs: Any + ) -> "_models.AssetTrack": + cls = kwargs.pop('cls', None) # type: ClsType["_models.AssetTrack"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AssetTrack') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + track_name=track_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) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + 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('AssetTrack', pipeline_response) + + if response.status_code == 201: + 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('AssetTrack', 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/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + track_name: str, + parameters: "_models.AssetTrack", + **kwargs: Any + ) -> AsyncLROPoller["_models.AssetTrack"]: + """Create or update a Track. + + Create or update a Track in the asset. + + :param resource_group_name: The name of the resource group within the Azure subscription. + :type resource_group_name: str + :param account_name: The Media Services account name. + :type account_name: str + :param asset_name: The Asset name. + :type asset_name: str + :param track_name: The Asset Track name. + :type track_name: str + :param parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.AssetTrack + :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. + :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 AssetTrack or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.media.models.AssetTrack] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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.AssetTrack"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + track_name=track_name, + parameters=parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_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('AssetTrack', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + track_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', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + track_name=track_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + 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')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + track_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a Track. + + Deletes a Track in the asset. + + :param resource_group_name: The name of the resource group within the Azure subscription. + :type resource_group_name: str + :param account_name: The Media Services account name. + :type account_name: str + :param asset_name: The Asset name. + :type asset_name: str + :param track_name: The Asset Track name. + :type track_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. + :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 None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + track_name=track_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + track_name: str, + parameters: "_models.AssetTrack", + **kwargs: Any + ) -> "_models.AssetTrack": + cls = kwargs.pop('cls', None) # type: ClsType["_models.AssetTrack"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AssetTrack') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + track_name=track_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) + + 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) + 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('AssetTrack', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}'} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + track_name: str, + parameters: "_models.AssetTrack", + **kwargs: Any + ) -> AsyncLROPoller["_models.AssetTrack"]: + """Update an Track. + + Updates an existing Track in the asset. + + :param resource_group_name: The name of the resource group within the Azure subscription. + :type resource_group_name: str + :param account_name: The Media Services account name. + :type account_name: str + :param asset_name: The Asset name. + :type asset_name: str + :param track_name: The Asset Track name. + :type track_name: str + :param parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.AssetTrack + :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. + :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 AssetTrack or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.media.models.AssetTrack] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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.AssetTrack"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + track_name=track_name, + parameters=parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_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('AssetTrack', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}'} # type: ignore + + async def _update_track_data_initial( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + track_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', {})) + + + request = build_update_track_data_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + track_name=track_name, + template_url=self._update_track_data_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _update_track_data_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}/updateTrackData'} # type: ignore + + + @distributed_trace_async + async def begin_update_track_data( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + track_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update the track data. + + Update the track data. Call this API after any changes are made to the track data stored in the + asset container. For example, you have modified the WebVTT captions file in the Azure blob + storage container for the asset, viewers will not see the new version of the captions unless + this API is called. Note, the changes may not be reflected immediately. CDN cache may also need + to be purged if applicable. + + :param resource_group_name: The name of the resource group within the Azure subscription. + :type resource_group_name: str + :param account_name: The Media Services account name. + :type account_name: str + :param asset_name: The Asset name. + :type asset_name: str + :param track_name: The Asset Track name. + :type track_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. + :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 None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_track_data_initial( + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + track_name=track_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_track_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}/updateTrackData'} # type: ignore diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_transforms_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_transforms_operations.py index 87747c7b59b3..08cacbe2a9ea 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_transforms_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_transforms_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._transforms_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]] @@ -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, @@ -71,40 +77,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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 orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - - 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, + orderby=orderby, + 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, + orderby=orderby, + 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('TransformCollection', pipeline_response) + deserialized = self._deserialize("TransformCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,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/mediaServices/{accountName}/transforms'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -155,34 +160,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'transformName': self._serialize.url("transform_name", transform_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, + transform_name=transform_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('Transform', pipeline_response) @@ -191,8 +186,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -223,39 +221,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'transformName': self._serialize.url("transform_name", transform_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, 'Transform') - # 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, + transform_name=transform_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, 'Transform') - 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: @@ -268,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/mediaServices/{accountName}/transforms/{transformName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -297,34 +288,24 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'transformName': self._serialize.url("transform_name", transform_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, + transform_name=transform_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: @@ -332,6 +313,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -362,39 +345,29 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'transformName': self._serialize.url("transform_name", transform_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, 'Transform') - # 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, + transform_name=transform_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, 'Transform') - 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('Transform', pipeline_response) @@ -403,4 +376,6 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}'} # type: ignore + diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/models/__init__.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/models/__init__.py index 47407a7cff31..8763f38b34da 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/models/__init__.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/models/__init__.py @@ -6,400 +6,216 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AacAudio - from ._models_py3 import AbsoluteClipTime - from ._models_py3 import AccessControl - from ._models_py3 import AccountEncryption - from ._models_py3 import AccountFilter - from ._models_py3 import AccountFilterCollection - from ._models_py3 import AkamaiAccessControl - from ._models_py3 import AkamaiSignatureHeaderAuthenticationKey - from ._models_py3 import Asset - from ._models_py3 import AssetCollection - from ._models_py3 import AssetContainerSas - from ._models_py3 import AssetFileEncryptionMetadata - from ._models_py3 import AssetFilter - from ._models_py3 import AssetFilterCollection - from ._models_py3 import AssetStreamingLocator - from ._models_py3 import Audio - from ._models_py3 import AudioAnalyzerPreset - from ._models_py3 import AudioOverlay - from ._models_py3 import AudioTrackDescriptor - from ._models_py3 import BuiltInStandardEncoderPreset - from ._models_py3 import CbcsDrmConfiguration - from ._models_py3 import CencDrmConfiguration - from ._models_py3 import CheckNameAvailabilityInput - from ._models_py3 import ClipTime - from ._models_py3 import Codec - from ._models_py3 import CommonEncryptionCbcs - from ._models_py3 import CommonEncryptionCenc - from ._models_py3 import ContentKeyPolicy - from ._models_py3 import ContentKeyPolicyClearKeyConfiguration - from ._models_py3 import ContentKeyPolicyCollection - from ._models_py3 import ContentKeyPolicyConfiguration - from ._models_py3 import ContentKeyPolicyFairPlayConfiguration - from ._models_py3 import ContentKeyPolicyFairPlayOfflineRentalConfiguration - from ._models_py3 import ContentKeyPolicyOpenRestriction - from ._models_py3 import ContentKeyPolicyOption - from ._models_py3 import ContentKeyPolicyPlayReadyConfiguration - from ._models_py3 import ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader - from ._models_py3 import ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier - from ._models_py3 import ContentKeyPolicyPlayReadyContentKeyLocation - from ._models_py3 import ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction - from ._models_py3 import ContentKeyPolicyPlayReadyLicense - from ._models_py3 import ContentKeyPolicyPlayReadyPlayRight - from ._models_py3 import ContentKeyPolicyProperties - from ._models_py3 import ContentKeyPolicyRestriction - from ._models_py3 import ContentKeyPolicyRestrictionTokenKey - from ._models_py3 import ContentKeyPolicyRsaTokenKey - from ._models_py3 import ContentKeyPolicySymmetricTokenKey - from ._models_py3 import ContentKeyPolicyTokenClaim - from ._models_py3 import ContentKeyPolicyTokenRestriction - from ._models_py3 import ContentKeyPolicyUnknownConfiguration - from ._models_py3 import ContentKeyPolicyUnknownRestriction - from ._models_py3 import ContentKeyPolicyWidevineConfiguration - from ._models_py3 import ContentKeyPolicyX509CertificateTokenKey - from ._models_py3 import CopyAudio - from ._models_py3 import CopyVideo - from ._models_py3 import CrossSiteAccessPolicies - from ._models_py3 import DefaultKey - from ._models_py3 import Deinterlace - from ._models_py3 import EdgePolicies - from ._models_py3 import EdgeUsageDataCollectionPolicy - from ._models_py3 import EdgeUsageDataEventHub - from ._models_py3 import EnabledProtocols - from ._models_py3 import EntityNameAvailabilityCheckOutput - from ._models_py3 import EnvelopeEncryption - from ._models_py3 import ErrorAdditionalInfo - from ._models_py3 import ErrorDetail - from ._models_py3 import ErrorResponse - from ._models_py3 import FaceDetectorPreset - from ._models_py3 import FilterTrackPropertyCondition - from ._models_py3 import FilterTrackSelection - from ._models_py3 import Filters - from ._models_py3 import FirstQuality - from ._models_py3 import Format - from ._models_py3 import FromAllInputFile - from ._models_py3 import FromEachInputFile - from ._models_py3 import H264Layer - from ._models_py3 import H264Video - from ._models_py3 import H265Layer - from ._models_py3 import H265Video - from ._models_py3 import H265VideoLayer - from ._models_py3 import Hls - from ._models_py3 import IPAccessControl - from ._models_py3 import IPRange - from ._models_py3 import Image - from ._models_py3 import ImageFormat - from ._models_py3 import InputDefinition - from ._models_py3 import InputFile - from ._models_py3 import Job - from ._models_py3 import JobCollection - from ._models_py3 import JobError - from ._models_py3 import JobErrorDetail - from ._models_py3 import JobInput - from ._models_py3 import JobInputAsset - from ._models_py3 import JobInputClip - from ._models_py3 import JobInputHttp - from ._models_py3 import JobInputSequence - from ._models_py3 import JobInputs - from ._models_py3 import JobOutput - from ._models_py3 import JobOutputAsset - from ._models_py3 import JpgFormat - from ._models_py3 import JpgImage - from ._models_py3 import JpgLayer - from ._models_py3 import KeyDelivery - from ._models_py3 import KeyVaultProperties - from ._models_py3 import Layer - from ._models_py3 import ListContainerSasInput - from ._models_py3 import ListContentKeysResponse - from ._models_py3 import ListEdgePoliciesInput - from ._models_py3 import ListPathsResponse - from ._models_py3 import ListStreamingLocatorsResponse - from ._models_py3 import LiveEvent - from ._models_py3 import LiveEventActionInput - from ._models_py3 import LiveEventEncoding - from ._models_py3 import LiveEventEndpoint - from ._models_py3 import LiveEventInput - from ._models_py3 import LiveEventInputAccessControl - from ._models_py3 import LiveEventInputTrackSelection - from ._models_py3 import LiveEventListResult - from ._models_py3 import LiveEventOutputTranscriptionTrack - from ._models_py3 import LiveEventPreview - from ._models_py3 import LiveEventPreviewAccessControl - from ._models_py3 import LiveEventTranscription - from ._models_py3 import LiveOutput - from ._models_py3 import LiveOutputListResult - from ._models_py3 import LogSpecification - from ._models_py3 import MediaService - from ._models_py3 import MediaServiceCollection - from ._models_py3 import MediaServiceIdentity - from ._models_py3 import MediaServiceUpdate - from ._models_py3 import MetricDimension - from ._models_py3 import MetricSpecification - from ._models_py3 import Mp4Format - from ._models_py3 import MultiBitrateFormat - from ._models_py3 import NoEncryption - from ._models_py3 import Operation - from ._models_py3 import OperationCollection - from ._models_py3 import OperationDisplay - from ._models_py3 import OutputFile - from ._models_py3 import Overlay - from ._models_py3 import PngFormat - from ._models_py3 import PngImage - from ._models_py3 import PngLayer - from ._models_py3 import PresentationTimeRange - from ._models_py3 import Preset - from ._models_py3 import PresetConfigurations - 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 Properties - from ._models_py3 import ProxyResource - from ._models_py3 import Rectangle - from ._models_py3 import Resource - from ._models_py3 import ResourceIdentity - from ._models_py3 import SelectAudioTrackByAttribute - from ._models_py3 import SelectAudioTrackById - from ._models_py3 import SelectVideoTrackByAttribute - from ._models_py3 import SelectVideoTrackById - from ._models_py3 import ServiceSpecification - from ._models_py3 import StandardEncoderPreset - from ._models_py3 import StorageAccount - from ._models_py3 import StorageEncryptedAssetDecryptionData - from ._models_py3 import StreamingEndpoint - from ._models_py3 import StreamingEndpointAccessControl - from ._models_py3 import StreamingEndpointListResult - from ._models_py3 import StreamingEntityScaleUnit - from ._models_py3 import StreamingLocator - from ._models_py3 import StreamingLocatorCollection - from ._models_py3 import StreamingLocatorContentKey - from ._models_py3 import StreamingPath - from ._models_py3 import StreamingPolicy - from ._models_py3 import StreamingPolicyCollection - from ._models_py3 import StreamingPolicyContentKey - from ._models_py3 import StreamingPolicyContentKeys - from ._models_py3 import StreamingPolicyFairPlayConfiguration - from ._models_py3 import StreamingPolicyPlayReadyConfiguration - from ._models_py3 import StreamingPolicyWidevineConfiguration - from ._models_py3 import SyncStorageKeysInput - from ._models_py3 import SystemData - from ._models_py3 import TrackDescriptor - from ._models_py3 import TrackPropertyCondition - from ._models_py3 import TrackSelection - from ._models_py3 import TrackedResource - from ._models_py3 import Transform - from ._models_py3 import TransformCollection - from ._models_py3 import TransformOutput - from ._models_py3 import TransportStreamFormat - from ._models_py3 import UserAssignedManagedIdentity - from ._models_py3 import UtcClipTime - from ._models_py3 import Video - from ._models_py3 import VideoAnalyzerPreset - from ._models_py3 import VideoLayer - from ._models_py3 import VideoOverlay - from ._models_py3 import VideoTrackDescriptor -except (SyntaxError, ImportError): - from ._models import AacAudio # type: ignore - from ._models import AbsoluteClipTime # type: ignore - from ._models import AccessControl # type: ignore - from ._models import AccountEncryption # type: ignore - from ._models import AccountFilter # type: ignore - from ._models import AccountFilterCollection # type: ignore - from ._models import AkamaiAccessControl # type: ignore - from ._models import AkamaiSignatureHeaderAuthenticationKey # type: ignore - from ._models import Asset # type: ignore - from ._models import AssetCollection # type: ignore - from ._models import AssetContainerSas # type: ignore - from ._models import AssetFileEncryptionMetadata # type: ignore - from ._models import AssetFilter # type: ignore - from ._models import AssetFilterCollection # type: ignore - from ._models import AssetStreamingLocator # type: ignore - from ._models import Audio # type: ignore - from ._models import AudioAnalyzerPreset # type: ignore - from ._models import AudioOverlay # type: ignore - from ._models import AudioTrackDescriptor # type: ignore - from ._models import BuiltInStandardEncoderPreset # type: ignore - from ._models import CbcsDrmConfiguration # type: ignore - from ._models import CencDrmConfiguration # type: ignore - from ._models import CheckNameAvailabilityInput # type: ignore - from ._models import ClipTime # type: ignore - from ._models import Codec # type: ignore - from ._models import CommonEncryptionCbcs # type: ignore - from ._models import CommonEncryptionCenc # type: ignore - from ._models import ContentKeyPolicy # type: ignore - from ._models import ContentKeyPolicyClearKeyConfiguration # type: ignore - from ._models import ContentKeyPolicyCollection # type: ignore - from ._models import ContentKeyPolicyConfiguration # type: ignore - from ._models import ContentKeyPolicyFairPlayConfiguration # type: ignore - from ._models import ContentKeyPolicyFairPlayOfflineRentalConfiguration # type: ignore - from ._models import ContentKeyPolicyOpenRestriction # type: ignore - from ._models import ContentKeyPolicyOption # type: ignore - from ._models import ContentKeyPolicyPlayReadyConfiguration # type: ignore - from ._models import ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader # type: ignore - from ._models import ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier # type: ignore - from ._models import ContentKeyPolicyPlayReadyContentKeyLocation # type: ignore - from ._models import ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction # type: ignore - from ._models import ContentKeyPolicyPlayReadyLicense # type: ignore - from ._models import ContentKeyPolicyPlayReadyPlayRight # type: ignore - from ._models import ContentKeyPolicyProperties # type: ignore - from ._models import ContentKeyPolicyRestriction # type: ignore - from ._models import ContentKeyPolicyRestrictionTokenKey # type: ignore - from ._models import ContentKeyPolicyRsaTokenKey # type: ignore - from ._models import ContentKeyPolicySymmetricTokenKey # type: ignore - from ._models import ContentKeyPolicyTokenClaim # type: ignore - from ._models import ContentKeyPolicyTokenRestriction # type: ignore - from ._models import ContentKeyPolicyUnknownConfiguration # type: ignore - from ._models import ContentKeyPolicyUnknownRestriction # type: ignore - from ._models import ContentKeyPolicyWidevineConfiguration # type: ignore - from ._models import ContentKeyPolicyX509CertificateTokenKey # type: ignore - from ._models import CopyAudio # type: ignore - from ._models import CopyVideo # type: ignore - from ._models import CrossSiteAccessPolicies # type: ignore - from ._models import DefaultKey # type: ignore - from ._models import Deinterlace # type: ignore - from ._models import EdgePolicies # type: ignore - from ._models import EdgeUsageDataCollectionPolicy # type: ignore - from ._models import EdgeUsageDataEventHub # type: ignore - from ._models import EnabledProtocols # type: ignore - from ._models import EntityNameAvailabilityCheckOutput # type: ignore - from ._models import EnvelopeEncryption # type: ignore - from ._models import ErrorAdditionalInfo # type: ignore - from ._models import ErrorDetail # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import FaceDetectorPreset # type: ignore - from ._models import FilterTrackPropertyCondition # type: ignore - from ._models import FilterTrackSelection # type: ignore - from ._models import Filters # type: ignore - from ._models import FirstQuality # type: ignore - from ._models import Format # type: ignore - from ._models import FromAllInputFile # type: ignore - from ._models import FromEachInputFile # type: ignore - from ._models import H264Layer # type: ignore - from ._models import H264Video # type: ignore - from ._models import H265Layer # type: ignore - from ._models import H265Video # type: ignore - from ._models import H265VideoLayer # type: ignore - from ._models import Hls # type: ignore - from ._models import IPAccessControl # type: ignore - from ._models import IPRange # type: ignore - from ._models import Image # type: ignore - from ._models import ImageFormat # type: ignore - from ._models import InputDefinition # type: ignore - from ._models import InputFile # type: ignore - from ._models import Job # type: ignore - from ._models import JobCollection # type: ignore - from ._models import JobError # type: ignore - from ._models import JobErrorDetail # type: ignore - from ._models import JobInput # type: ignore - from ._models import JobInputAsset # type: ignore - from ._models import JobInputClip # type: ignore - from ._models import JobInputHttp # type: ignore - from ._models import JobInputSequence # type: ignore - from ._models import JobInputs # type: ignore - from ._models import JobOutput # type: ignore - from ._models import JobOutputAsset # type: ignore - from ._models import JpgFormat # type: ignore - from ._models import JpgImage # type: ignore - from ._models import JpgLayer # type: ignore - from ._models import KeyDelivery # type: ignore - from ._models import KeyVaultProperties # type: ignore - from ._models import Layer # type: ignore - from ._models import ListContainerSasInput # type: ignore - from ._models import ListContentKeysResponse # type: ignore - from ._models import ListEdgePoliciesInput # type: ignore - from ._models import ListPathsResponse # type: ignore - from ._models import ListStreamingLocatorsResponse # type: ignore - from ._models import LiveEvent # type: ignore - from ._models import LiveEventActionInput # type: ignore - from ._models import LiveEventEncoding # type: ignore - from ._models import LiveEventEndpoint # type: ignore - from ._models import LiveEventInput # type: ignore - from ._models import LiveEventInputAccessControl # type: ignore - from ._models import LiveEventInputTrackSelection # type: ignore - from ._models import LiveEventListResult # type: ignore - from ._models import LiveEventOutputTranscriptionTrack # type: ignore - from ._models import LiveEventPreview # type: ignore - from ._models import LiveEventPreviewAccessControl # type: ignore - from ._models import LiveEventTranscription # type: ignore - from ._models import LiveOutput # type: ignore - from ._models import LiveOutputListResult # type: ignore - from ._models import LogSpecification # type: ignore - from ._models import MediaService # type: ignore - from ._models import MediaServiceCollection # type: ignore - from ._models import MediaServiceIdentity # type: ignore - from ._models import MediaServiceUpdate # type: ignore - from ._models import MetricDimension # type: ignore - from ._models import MetricSpecification # type: ignore - from ._models import Mp4Format # type: ignore - from ._models import MultiBitrateFormat # type: ignore - from ._models import NoEncryption # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationCollection # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OutputFile # type: ignore - from ._models import Overlay # type: ignore - from ._models import PngFormat # type: ignore - from ._models import PngImage # type: ignore - from ._models import PngLayer # type: ignore - from ._models import PresentationTimeRange # type: ignore - from ._models import Preset # type: ignore - from ._models import PresetConfigurations # 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 Properties # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import Rectangle # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceIdentity # type: ignore - from ._models import SelectAudioTrackByAttribute # type: ignore - from ._models import SelectAudioTrackById # type: ignore - from ._models import SelectVideoTrackByAttribute # type: ignore - from ._models import SelectVideoTrackById # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import StandardEncoderPreset # type: ignore - from ._models import StorageAccount # type: ignore - from ._models import StorageEncryptedAssetDecryptionData # type: ignore - from ._models import StreamingEndpoint # type: ignore - from ._models import StreamingEndpointAccessControl # type: ignore - from ._models import StreamingEndpointListResult # type: ignore - from ._models import StreamingEntityScaleUnit # type: ignore - from ._models import StreamingLocator # type: ignore - from ._models import StreamingLocatorCollection # type: ignore - from ._models import StreamingLocatorContentKey # type: ignore - from ._models import StreamingPath # type: ignore - from ._models import StreamingPolicy # type: ignore - from ._models import StreamingPolicyCollection # type: ignore - from ._models import StreamingPolicyContentKey # type: ignore - from ._models import StreamingPolicyContentKeys # type: ignore - from ._models import StreamingPolicyFairPlayConfiguration # type: ignore - from ._models import StreamingPolicyPlayReadyConfiguration # type: ignore - from ._models import StreamingPolicyWidevineConfiguration # type: ignore - from ._models import SyncStorageKeysInput # type: ignore - from ._models import SystemData # type: ignore - from ._models import TrackDescriptor # type: ignore - from ._models import TrackPropertyCondition # type: ignore - from ._models import TrackSelection # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import Transform # type: ignore - from ._models import TransformCollection # type: ignore - from ._models import TransformOutput # type: ignore - from ._models import TransportStreamFormat # type: ignore - from ._models import UserAssignedManagedIdentity # type: ignore - from ._models import UtcClipTime # type: ignore - from ._models import Video # type: ignore - from ._models import VideoAnalyzerPreset # type: ignore - from ._models import VideoLayer # type: ignore - from ._models import VideoOverlay # type: ignore - from ._models import VideoTrackDescriptor # type: ignore +from ._models_py3 import AacAudio +from ._models_py3 import AbsoluteClipTime +from ._models_py3 import AccessControl +from ._models_py3 import AccountEncryption +from ._models_py3 import AccountFilter +from ._models_py3 import AccountFilterCollection +from ._models_py3 import AkamaiAccessControl +from ._models_py3 import AkamaiSignatureHeaderAuthenticationKey +from ._models_py3 import ArmStreamingEndpointCapacity +from ._models_py3 import ArmStreamingEndpointCurrentSku +from ._models_py3 import ArmStreamingEndpointSku +from ._models_py3 import ArmStreamingEndpointSkuInfo +from ._models_py3 import Asset +from ._models_py3 import AssetCollection +from ._models_py3 import AssetContainerSas +from ._models_py3 import AssetFileEncryptionMetadata +from ._models_py3 import AssetFilter +from ._models_py3 import AssetFilterCollection +from ._models_py3 import AssetStreamingLocator +from ._models_py3 import AssetTrack +from ._models_py3 import AssetTrackCollection +from ._models_py3 import AssetTrackOperationStatus +from ._models_py3 import Audio +from ._models_py3 import AudioAnalyzerPreset +from ._models_py3 import AudioOverlay +from ._models_py3 import AudioTrack +from ._models_py3 import AudioTrackDescriptor +from ._models_py3 import BuiltInStandardEncoderPreset +from ._models_py3 import CbcsDrmConfiguration +from ._models_py3 import CencDrmConfiguration +from ._models_py3 import CheckNameAvailabilityInput +from ._models_py3 import ClipTime +from ._models_py3 import Codec +from ._models_py3 import CommonEncryptionCbcs +from ._models_py3 import CommonEncryptionCenc +from ._models_py3 import ContentKeyPolicy +from ._models_py3 import ContentKeyPolicyClearKeyConfiguration +from ._models_py3 import ContentKeyPolicyCollection +from ._models_py3 import ContentKeyPolicyConfiguration +from ._models_py3 import ContentKeyPolicyFairPlayConfiguration +from ._models_py3 import ContentKeyPolicyFairPlayOfflineRentalConfiguration +from ._models_py3 import ContentKeyPolicyOpenRestriction +from ._models_py3 import ContentKeyPolicyOption +from ._models_py3 import ContentKeyPolicyPlayReadyConfiguration +from ._models_py3 import ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader +from ._models_py3 import ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier +from ._models_py3 import ContentKeyPolicyPlayReadyContentKeyLocation +from ._models_py3 import ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction +from ._models_py3 import ContentKeyPolicyPlayReadyLicense +from ._models_py3 import ContentKeyPolicyPlayReadyPlayRight +from ._models_py3 import ContentKeyPolicyProperties +from ._models_py3 import ContentKeyPolicyRestriction +from ._models_py3 import ContentKeyPolicyRestrictionTokenKey +from ._models_py3 import ContentKeyPolicyRsaTokenKey +from ._models_py3 import ContentKeyPolicySymmetricTokenKey +from ._models_py3 import ContentKeyPolicyTokenClaim +from ._models_py3 import ContentKeyPolicyTokenRestriction +from ._models_py3 import ContentKeyPolicyUnknownConfiguration +from ._models_py3 import ContentKeyPolicyUnknownRestriction +from ._models_py3 import ContentKeyPolicyWidevineConfiguration +from ._models_py3 import ContentKeyPolicyX509CertificateTokenKey +from ._models_py3 import CopyAudio +from ._models_py3 import CopyVideo +from ._models_py3 import CrossSiteAccessPolicies +from ._models_py3 import DefaultKey +from ._models_py3 import Deinterlace +from ._models_py3 import EdgePolicies +from ._models_py3 import EdgeUsageDataCollectionPolicy +from ._models_py3 import EdgeUsageDataEventHub +from ._models_py3 import EnabledProtocols +from ._models_py3 import EntityNameAvailabilityCheckOutput +from ._models_py3 import EnvelopeEncryption +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import FaceDetectorPreset +from ._models_py3 import FilterTrackPropertyCondition +from ._models_py3 import FilterTrackSelection +from ._models_py3 import Filters +from ._models_py3 import FirstQuality +from ._models_py3 import Format +from ._models_py3 import FromAllInputFile +from ._models_py3 import FromEachInputFile +from ._models_py3 import H264Layer +from ._models_py3 import H264Video +from ._models_py3 import H265Layer +from ._models_py3 import H265Video +from ._models_py3 import H265VideoLayer +from ._models_py3 import Hls +from ._models_py3 import HlsSettings +from ._models_py3 import IPAccessControl +from ._models_py3 import IPRange +from ._models_py3 import Image +from ._models_py3 import ImageFormat +from ._models_py3 import InputDefinition +from ._models_py3 import InputFile +from ._models_py3 import Job +from ._models_py3 import JobCollection +from ._models_py3 import JobError +from ._models_py3 import JobErrorDetail +from ._models_py3 import JobInput +from ._models_py3 import JobInputAsset +from ._models_py3 import JobInputClip +from ._models_py3 import JobInputHttp +from ._models_py3 import JobInputSequence +from ._models_py3 import JobInputs +from ._models_py3 import JobOutput +from ._models_py3 import JobOutputAsset +from ._models_py3 import JpgFormat +from ._models_py3 import JpgImage +from ._models_py3 import JpgLayer +from ._models_py3 import KeyDelivery +from ._models_py3 import KeyVaultProperties +from ._models_py3 import Layer +from ._models_py3 import ListContainerSasInput +from ._models_py3 import ListContentKeysResponse +from ._models_py3 import ListEdgePoliciesInput +from ._models_py3 import ListPathsResponse +from ._models_py3 import ListStreamingLocatorsResponse +from ._models_py3 import LiveEvent +from ._models_py3 import LiveEventActionInput +from ._models_py3 import LiveEventEncoding +from ._models_py3 import LiveEventEndpoint +from ._models_py3 import LiveEventInput +from ._models_py3 import LiveEventInputAccessControl +from ._models_py3 import LiveEventInputTrackSelection +from ._models_py3 import LiveEventListResult +from ._models_py3 import LiveEventOutputTranscriptionTrack +from ._models_py3 import LiveEventPreview +from ._models_py3 import LiveEventPreviewAccessControl +from ._models_py3 import LiveEventTranscription +from ._models_py3 import LiveOutput +from ._models_py3 import LiveOutputListResult +from ._models_py3 import LogSpecification +from ._models_py3 import MediaService +from ._models_py3 import MediaServiceCollection +from ._models_py3 import MediaServiceIdentity +from ._models_py3 import MediaServiceUpdate +from ._models_py3 import MetricDimension +from ._models_py3 import MetricSpecification +from ._models_py3 import Mp4Format +from ._models_py3 import MultiBitrateFormat +from ._models_py3 import NoEncryption +from ._models_py3 import Operation +from ._models_py3 import OperationCollection +from ._models_py3 import OperationDisplay +from ._models_py3 import OutputFile +from ._models_py3 import Overlay +from ._models_py3 import PngFormat +from ._models_py3 import PngImage +from ._models_py3 import PngLayer +from ._models_py3 import PresentationTimeRange +from ._models_py3 import Preset +from ._models_py3 import PresetConfigurations +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 Properties +from ._models_py3 import ProxyResource +from ._models_py3 import Rectangle +from ._models_py3 import Resource +from ._models_py3 import ResourceIdentity +from ._models_py3 import SelectAudioTrackByAttribute +from ._models_py3 import SelectAudioTrackById +from ._models_py3 import SelectVideoTrackByAttribute +from ._models_py3 import SelectVideoTrackById +from ._models_py3 import ServiceSpecification +from ._models_py3 import StandardEncoderPreset +from ._models_py3 import StorageAccount +from ._models_py3 import StorageEncryptedAssetDecryptionData +from ._models_py3 import StreamingEndpoint +from ._models_py3 import StreamingEndpointAccessControl +from ._models_py3 import StreamingEndpointListResult +from ._models_py3 import StreamingEndpointSkuInfoListResult +from ._models_py3 import StreamingEntityScaleUnit +from ._models_py3 import StreamingLocator +from ._models_py3 import StreamingLocatorCollection +from ._models_py3 import StreamingLocatorContentKey +from ._models_py3 import StreamingPath +from ._models_py3 import StreamingPolicy +from ._models_py3 import StreamingPolicyCollection +from ._models_py3 import StreamingPolicyContentKey +from ._models_py3 import StreamingPolicyContentKeys +from ._models_py3 import StreamingPolicyFairPlayConfiguration +from ._models_py3 import StreamingPolicyPlayReadyConfiguration +from ._models_py3 import StreamingPolicyWidevineConfiguration +from ._models_py3 import SyncStorageKeysInput +from ._models_py3 import SystemData +from ._models_py3 import TextTrack +from ._models_py3 import TrackBase +from ._models_py3 import TrackDescriptor +from ._models_py3 import TrackPropertyCondition +from ._models_py3 import TrackSelection +from ._models_py3 import TrackedResource +from ._models_py3 import Transform +from ._models_py3 import TransformCollection +from ._models_py3 import TransformOutput +from ._models_py3 import TransportStreamFormat +from ._models_py3 import UserAssignedManagedIdentity +from ._models_py3 import UtcClipTime +from ._models_py3 import Video +from ._models_py3 import VideoAnalyzerPreset +from ._models_py3 import VideoLayer +from ._models_py3 import VideoOverlay +from ._models_py3 import VideoTrack +from ._models_py3 import VideoTrackDescriptor + from ._azure_media_services_enums import ( AacAudioProfile, @@ -429,6 +245,7 @@ FilterTrackPropertyCompareOperation, FilterTrackPropertyType, H264Complexity, + H264RateControlMode, H264VideoProfile, H265Complexity, H265VideoProfile, @@ -448,6 +265,7 @@ Priority, PrivateEndpointConnectionProvisioningState, PrivateEndpointServiceConnectionStatus, + ProvisioningState, PublicNetworkAccess, Rotation, StorageAccountType, @@ -461,6 +279,7 @@ TrackPropertyCompareOperation, TrackPropertyType, VideoSyncMode, + Visibility, ) __all__ = [ @@ -472,6 +291,10 @@ 'AccountFilterCollection', 'AkamaiAccessControl', 'AkamaiSignatureHeaderAuthenticationKey', + 'ArmStreamingEndpointCapacity', + 'ArmStreamingEndpointCurrentSku', + 'ArmStreamingEndpointSku', + 'ArmStreamingEndpointSkuInfo', 'Asset', 'AssetCollection', 'AssetContainerSas', @@ -479,9 +302,13 @@ 'AssetFilter', 'AssetFilterCollection', 'AssetStreamingLocator', + 'AssetTrack', + 'AssetTrackCollection', + 'AssetTrackOperationStatus', 'Audio', 'AudioAnalyzerPreset', 'AudioOverlay', + 'AudioTrack', 'AudioTrackDescriptor', 'BuiltInStandardEncoderPreset', 'CbcsDrmConfiguration', @@ -545,6 +372,7 @@ 'H265Video', 'H265VideoLayer', 'Hls', + 'HlsSettings', 'IPAccessControl', 'IPRange', 'Image', @@ -631,6 +459,7 @@ 'StreamingEndpoint', 'StreamingEndpointAccessControl', 'StreamingEndpointListResult', + 'StreamingEndpointSkuInfoListResult', 'StreamingEntityScaleUnit', 'StreamingLocator', 'StreamingLocatorCollection', @@ -645,6 +474,8 @@ 'StreamingPolicyWidevineConfiguration', 'SyncStorageKeysInput', 'SystemData', + 'TextTrack', + 'TrackBase', 'TrackDescriptor', 'TrackPropertyCondition', 'TrackSelection', @@ -659,6 +490,7 @@ 'VideoAnalyzerPreset', 'VideoLayer', 'VideoOverlay', + 'VideoTrack', 'VideoTrackDescriptor', 'AacAudioProfile', 'AccountEncryptionKeyType', @@ -687,6 +519,7 @@ 'FilterTrackPropertyCompareOperation', 'FilterTrackPropertyType', 'H264Complexity', + 'H264RateControlMode', 'H264VideoProfile', 'H265Complexity', 'H265VideoProfile', @@ -706,6 +539,7 @@ 'Priority', 'PrivateEndpointConnectionProvisioningState', 'PrivateEndpointServiceConnectionStatus', + 'ProvisioningState', 'PublicNetworkAccess', 'Rotation', 'StorageAccountType', @@ -719,4 +553,5 @@ 'TrackPropertyCompareOperation', 'TrackPropertyType', 'VideoSyncMode', + 'Visibility', ] diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/models/_azure_media_services_enums.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/models/_azure_media_services_enums.py index 3921bd52a02c..ff3e4bd7a15d 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/models/_azure_media_services_enums.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/models/_azure_media_services_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AacAudioProfile(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AacAudioProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The encoding profile to be used when encoding audio with AAC. """ @@ -37,7 +22,7 @@ class AacAudioProfile(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Specifies that the output audio is to be encoded into HE-AAC v2 profile. HE_AAC_V2 = "HeAacV2" -class AccountEncryptionKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccountEncryptionKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of key used to encrypt the Account Key. """ @@ -46,14 +31,14 @@ class AccountEncryptionKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu #: The Account Key is encrypted with a Customer Key. CUSTOMER_KEY = "CustomerKey" -class ActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates the action type. """ #: An internal action. INTERNAL = "Internal" -class AnalysisResolution(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AnalysisResolution(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the maximum resolution at which your video is analyzed. The default behavior is "SourceResolution," which will keep the input video at its original resolution when analyzed. Using "StandardDefinition" will resize input videos to standard definition while preserving the @@ -68,7 +53,7 @@ class AnalysisResolution(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SOURCE_RESOLUTION = "SourceResolution" STANDARD_DEFINITION = "StandardDefinition" -class AssetContainerPermission(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AssetContainerPermission(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The permissions to set on the SAS URL. """ @@ -79,7 +64,7 @@ class AssetContainerPermission(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu #: The SAS URL will allow read, write and delete access to the container. READ_WRITE_DELETE = "ReadWriteDelete" -class AssetStorageEncryptionFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AssetStorageEncryptionFormat(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Asset encryption format. One of None or MediaStorageEncryption. """ @@ -89,7 +74,7 @@ class AssetStorageEncryptionFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, #: The Asset is encrypted with Media Services client-side encryption. MEDIA_STORAGE_CLIENT_ENCRYPTION = "MediaStorageClientEncryption" -class AttributeFilter(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AttributeFilter(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of AttributeFilter to apply to the TrackAttribute in order to select the tracks. """ @@ -104,7 +89,7 @@ class AttributeFilter(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Any tracks that have an attribute equal to the value given will be included. VALUE_EQUALS = "ValueEquals" -class AudioAnalysisMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AudioAnalysisMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Determines the set of audio analysis operations to be performed. If unspecified, the Standard AudioAnalysisMode would be chosen. """ @@ -118,7 +103,7 @@ class AudioAnalysisMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: not included in this mode. BASIC = "Basic" -class BlurType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BlurType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Blur type """ @@ -133,7 +118,7 @@ class BlurType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Black: Black out filter. BLACK = "Black" -class ChannelMapping(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ChannelMapping(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Optional designation for single channel audio tracks. Can be used to combine the tracks into stereo or multi-channel audio tracks. """ @@ -155,7 +140,7 @@ class ChannelMapping(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: The Right Stereo channel. Sometimes referred to as Down Mix Right. STEREO_RIGHT = "StereoRight" -class Complexity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Complexity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Allows you to configure the encoder settings to control the balance between speed and quality. Example: set Complexity as Speed for faster encoding but less compression efficiency. """ @@ -169,7 +154,7 @@ class Complexity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: expense of slower overall encode time. QUALITY = "Quality" -class ContentKeyPolicyFairPlayRentalAndLeaseKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ContentKeyPolicyFairPlayRentalAndLeaseKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The rental and lease key type. """ @@ -185,7 +170,7 @@ class ContentKeyPolicyFairPlayRentalAndLeaseKeyType(with_metaclass(_CaseInsensit #: Content key can be persisted and the valid duration is limited by the Rental Duration value. PERSISTENT_LIMITED = "PersistentLimited" -class ContentKeyPolicyPlayReadyContentType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ContentKeyPolicyPlayReadyContentType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The PlayReady content type. """ @@ -198,7 +183,7 @@ class ContentKeyPolicyPlayReadyContentType(with_metaclass(_CaseInsensitiveEnumMe #: Ultraviolet streaming content type. ULTRA_VIOLET_STREAMING = "UltraVioletStreaming" -class ContentKeyPolicyPlayReadyLicenseType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ContentKeyPolicyPlayReadyLicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The license type. """ @@ -209,7 +194,7 @@ class ContentKeyPolicyPlayReadyLicenseType(with_metaclass(_CaseInsensitiveEnumMe #: Persistent license. Allows offline playback. PERSISTENT = "Persistent" -class ContentKeyPolicyPlayReadyUnknownOutputPassingOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ContentKeyPolicyPlayReadyUnknownOutputPassingOption(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Configures Unknown output handling settings of the license. """ @@ -224,7 +209,7 @@ class ContentKeyPolicyPlayReadyUnknownOutputPassingOption(with_metaclass(_CaseIn #: constrained resolution. ALLOWED_WITH_VIDEO_CONSTRICTION = "AllowedWithVideoConstriction" -class ContentKeyPolicyRestrictionTokenType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ContentKeyPolicyRestrictionTokenType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of token. """ @@ -235,7 +220,7 @@ class ContentKeyPolicyRestrictionTokenType(with_metaclass(_CaseInsensitiveEnumMe #: JSON Web Token. JWT = "Jwt" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -244,7 +229,7 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class DefaultAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DefaultAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The behavior for IP access control in Key Delivery. """ @@ -253,7 +238,7 @@ class DefaultAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Public IP addresses are blocked. DENY = "Deny" -class DeinterlaceMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeinterlaceMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The deinterlacing mode. Defaults to AutoPixelAdaptive. """ @@ -262,7 +247,7 @@ class DeinterlaceMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Apply automatic pixel adaptive de-interlacing on each frame in the input video. AUTO_PIXEL_ADAPTIVE = "AutoPixelAdaptive" -class DeinterlaceParity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeinterlaceParity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The field parity for de-interlacing, defaults to Auto. """ @@ -273,7 +258,7 @@ class DeinterlaceParity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Apply bottom field first processing of input video. BOTTOM_FIELD_FIRST = "BottomFieldFirst" -class EncoderNamedPreset(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncoderNamedPreset(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The built-in preset to be used for encoding videos. """ @@ -342,7 +327,7 @@ class EncoderNamedPreset(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: height of 2160 pixels, and the stereo audio is encoded with AAC-LC codec at 128 kbps. H265_SINGLE_BITRATE4_K = "H265SingleBitrate4K" -class EncryptionScheme(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionScheme(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Encryption scheme """ @@ -355,7 +340,7 @@ class EncryptionScheme(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: CommonEncryptionCbcs scheme. COMMON_ENCRYPTION_CBCS = "CommonEncryptionCbcs" -class EntropyMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EntropyMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The entropy mode to be used for this layer. If not specified, the encoder chooses the mode that is appropriate for the profile and level. """ @@ -365,7 +350,7 @@ class EntropyMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Context Adaptive Variable Length Coder (CAVLC) entropy encoding. CAVLC = "Cavlc" -class FaceRedactorMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class FaceRedactorMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This mode provides the ability to choose between the following settings: 1) Analyze - For detection only.This mode generates a metadata JSON file marking appearances of faces throughout the video.Where possible, appearances of the same person are assigned the same ID. 2) Combined @@ -384,7 +369,7 @@ class FaceRedactorMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: not desired. COMBINED = "Combined" -class FilterTrackPropertyCompareOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class FilterTrackPropertyCompareOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The track property condition operation. """ @@ -393,7 +378,7 @@ class FilterTrackPropertyCompareOperation(with_metaclass(_CaseInsensitiveEnumMet #: The not equal operation. NOT_EQUAL = "NotEqual" -class FilterTrackPropertyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class FilterTrackPropertyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The track property type. """ @@ -410,7 +395,7 @@ class FilterTrackPropertyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum #: The bitrate. BITRATE = "Bitrate" -class H264Complexity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class H264Complexity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Tells the encoder how to choose its encoding settings. The default value is Balanced. """ @@ -423,7 +408,18 @@ class H264Complexity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: expense of slower overall encode time. QUALITY = "Quality" -class H264VideoProfile(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class H264RateControlMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The video rate control mode + """ + + #: Average Bitrate (ABR) mode that hits the target bitrate: Default mode. + ABR = "ABR" + #: Constant Bitrate (CBR) mode that tightens bitrate variations around target bitrate. + CBR = "CBR" + #: Constant Rate Factor (CRF) mode that targets at constant subjective quality. + CRF = "CRF" + +class H264VideoProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """We currently support Baseline, Main, High, High422, High444. Default is Auto. """ @@ -440,7 +436,7 @@ class H264VideoProfile(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: High 4:4:4 predictive profile. HIGH444 = "High444" -class H265Complexity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class H265Complexity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Tells the encoder how to choose its encoding settings. Quality will provide for a higher compression ratio but at a higher cost and longer compute time. Speed will produce a relatively larger file but is faster and more economical. The default value is Balanced. @@ -455,7 +451,7 @@ class H265Complexity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: expense of slower overall encode time. QUALITY = "Quality" -class H265VideoProfile(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class H265VideoProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """We currently support Main. Default is Auto. """ @@ -464,8 +460,10 @@ class H265VideoProfile(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Main profile #: (https://x265.readthedocs.io/en/default/cli.html?highlight=profile#profile-level-tier). MAIN = "Main" + #: Main 10 profile (https://en.wikipedia.org/wiki/High_Efficiency_Video_Coding#Main_10). + MAIN10 = "Main10" -class InsightsType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class InsightsType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Defines the type of insights that you want the service to generate. The allowed values are 'AudioInsightsOnly', 'VideoInsightsOnly', and 'AllInsights'. The default is AllInsights. If you set this to AllInsights and the input is audio only, then only audio insights are generated. @@ -482,7 +480,7 @@ class InsightsType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Generate both audio and video insights. Fails if either audio or video Insights fail. ALL_INSIGHTS = "AllInsights" -class InterleaveOutput(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class InterleaveOutput(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Sets the interleave mode of the output to control how audio and video are stored in the container format. Example: set InterleavedOutput as NonInterleavedOutput to produce audio-only and video-only outputs in separate MP4 files. @@ -493,7 +491,7 @@ class InterleaveOutput(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: The output includes both audio and video. INTERLEAVED_OUTPUT = "InterleavedOutput" -class JobErrorCategory(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JobErrorCategory(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Helps with categorization of errors. """ @@ -508,7 +506,7 @@ class JobErrorCategory(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: The error is related to data in the input files. CONTENT = "Content" -class JobErrorCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JobErrorCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Error code describing the error. """ @@ -539,7 +537,7 @@ class JobErrorCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: file/codec), check the validity of the input files. CONTENT_UNSUPPORTED = "ContentUnsupported" -class JobRetry(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JobRetry(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates that it may be possible to retry the Job. If retry is unsuccessful, please contact Azure support via Azure Portal. """ @@ -550,7 +548,7 @@ class JobRetry(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Issue may be resolved after waiting for a period of time and resubmitting the same Job. MAY_RETRY = "MayRetry" -class JobState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JobState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describes the state of the JobOutput. """ @@ -571,16 +569,16 @@ class JobState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: queued and processing states. SCHEDULED = "Scheduled" -class LiveEventEncodingType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Live event type. When encodingType is set to None, the service simply passes through the - incoming video and audio layer(s) to the output. When encodingType is set to Standard or - Premium1080p, a live encoder transcodes the incoming stream into multiple bitrates or layers. - See https://go.microsoft.com/fwlink/?linkid=2095101 for more information. This property cannot - be modified after the live event is created. +class LiveEventEncodingType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Live event type. When encodingType is set to PassthroughBasic or PassthroughStandard, the + service simply passes through the incoming video and audio layer(s) to the output. When + encodingType is set to Standard or Premium1080p, a live encoder transcodes the incoming stream + into multiple bitrates or layers. See https://go.microsoft.com/fwlink/?linkid=2095101 for more + information. This property cannot be modified after the live event is created. """ - #: A contribution live encoder sends a multiple bitrate stream. The ingested stream passes through - #: the live event without any further processing. It is also called the pass-through mode. + #: This is the same as PassthroughStandard, please see description below. This enumeration value + #: is being deprecated. NONE = "None" #: A contribution live encoder sends a single bitrate stream to the live event and Media Services #: creates multiple bitrate streams. The output cannot exceed 720p in resolution. @@ -588,12 +586,16 @@ class LiveEventEncodingType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) #: A contribution live encoder sends a single bitrate stream to the live event and Media Services #: creates multiple bitrate streams. The output cannot exceed 1080p in resolution. PREMIUM1080_P = "Premium1080p" - #: Pending update... + #: The ingested stream passes through the live event from the contribution encoder without any + #: further processing. In the PassthroughBasic mode, ingestion is limited to up to 5Mbps and only + #: 1 concurrent live output is allowed. Live transcription is not available. PASSTHROUGH_BASIC = "PassthroughBasic" - #: Pending update... + #: The ingested stream passes through the live event from the contribution encoder without any + #: further processing. Live transcription is available. Ingestion bitrate limits are much higher + #: and up to 3 concurrent live outputs are allowed. PASSTHROUGH_STANDARD = "PassthroughStandard" -class LiveEventInputProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LiveEventInputProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The input protocol for the live event. This is specified at creation time and cannot be updated. """ @@ -603,7 +605,7 @@ class LiveEventInputProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) #: RTMP input will be sent by the contribution encoder to the live event. RTMP = "RTMP" -class LiveEventResourceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LiveEventResourceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The resource state of the live event. See https://go.microsoft.com/fwlink/?linkid=2139012 for more information. """ @@ -634,7 +636,7 @@ class LiveEventResourceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) #: streaming are not allowed during this state. DELETING = "Deleting" -class LiveOutputResourceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LiveOutputResourceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The resource state of the live output. """ @@ -648,7 +650,7 @@ class LiveOutputResourceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum #: Any streaming URLs created on the live output asset continue to work. DELETING = "Deleting" -class MetricAggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MetricAggregationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The metric aggregation type """ @@ -659,7 +661,7 @@ class MetricAggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) #: The sum. TOTAL = "Total" -class MetricUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MetricUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The metric unit """ @@ -670,7 +672,7 @@ class MetricUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: The number of milliseconds. MILLISECONDS = "Milliseconds" -class OnErrorType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OnErrorType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """A Transform can define more than one outputs. This property defines what the service should do when one output fails - either continue to produce other outputs, or, stop the other outputs. The overall Job state will not reflect failures of outputs that are specified with @@ -684,7 +686,7 @@ class OnErrorType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: continue. CONTINUE_JOB = "ContinueJob" -class Priority(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Priority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Sets the relative priority of the TransformOutputs within a Transform. This sets the priority that the service uses for processing TransformOutputs. The default priority is Normal. """ @@ -697,7 +699,7 @@ class Priority(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Used for TransformOutputs that should take precedence over others. HIGH = "High" -class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current provisioning state. """ @@ -706,7 +708,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitive DELETING = "Deleting" FAILED = "Failed" -class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The private endpoint connection status. """ @@ -714,7 +716,18 @@ class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnum APPROVED = "Approved" REJECTED = "Rejected" -class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the asset track. + """ + + #: 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 Media Services account. """ @@ -723,7 +736,7 @@ class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Public network access is disabled. DISABLED = "Disabled" -class Rotation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Rotation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The rotation, if any, to be applied to the input video, before it is encoded. Default is Auto """ @@ -741,7 +754,7 @@ class Rotation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Rotate 270 degrees clockwise. ROTATE270 = "Rotate270" -class StorageAccountType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAccountType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the storage account. """ @@ -750,14 +763,14 @@ class StorageAccountType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: A secondary storage account for the Media Services account. SECONDARY = "Secondary" -class StorageAuthentication(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAuthentication(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: System authentication. SYSTEM = "System" #: Managed Identity authentication. MANAGED_IDENTITY = "ManagedIdentity" -class StreamingEndpointResourceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StreamingEndpointResourceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The resource state of the streaming endpoint. """ @@ -775,7 +788,7 @@ class StreamingEndpointResourceState(with_metaclass(_CaseInsensitiveEnumMeta, st #: The streaming endpoint is increasing or decreasing scale units. SCALING = "Scaling" -class StreamingLocatorContentKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StreamingLocatorContentKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Encryption type of Content Key """ @@ -786,7 +799,7 @@ class StreamingLocatorContentKeyType(with_metaclass(_CaseInsensitiveEnumMeta, st #: Envelope Encryption. ENVELOPE_ENCRYPTION = "EnvelopeEncryption" -class StreamingPolicyStreamingProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StreamingPolicyStreamingProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Streaming protocol """ @@ -799,15 +812,19 @@ class StreamingPolicyStreamingProtocol(with_metaclass(_CaseInsensitiveEnumMeta, #: Download protocol. DOWNLOAD = "Download" -class StreamOptionsFlag(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StreamOptionsFlag(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Live streaming with no special latency optimizations. DEFAULT = "Default" - #: The live event provides lower end to end latency by reducing its internal buffers. This could - #: result in more client buffering during playback if network bandwidth is low. + #: The live event provides lower end to end latency by reducing its internal buffers. LOW_LATENCY = "LowLatency" + #: The live event is optimized for end to end latency. This option is only available for encoding + #: live events with RTMP input. The outputs can be streamed using HLS or DASH formats. The + #: outputs' archive or DVR rewind length is limited to 6 hours. Use "LowLatency" stream option for + #: all other scenarios. + LOW_LATENCY_V2 = "LowLatencyV2" -class StretchMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StretchMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The resizing mode - how the input video will be resized to fit the desired output resolution(s). Default is AutoSize """ @@ -827,7 +844,7 @@ class StretchMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: and pillar box regions 280 pixels wide at the left and right. AUTO_FIT = "AutoFit" -class TrackAttribute(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TrackAttribute(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The TrackAttribute to filter the tracks by. """ @@ -836,7 +853,7 @@ class TrackAttribute(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: The language of the track. LANGUAGE = "Language" -class TrackPropertyCompareOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TrackPropertyCompareOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Track property condition operation """ @@ -845,7 +862,7 @@ class TrackPropertyCompareOperation(with_metaclass(_CaseInsensitiveEnumMeta, str #: Equal operation. EQUAL = "Equal" -class TrackPropertyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TrackPropertyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Track property type """ @@ -854,7 +871,7 @@ class TrackPropertyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Track FourCC. FOUR_CC = "FourCC" -class VideoSyncMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VideoSyncMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Video Sync Mode """ @@ -876,3 +893,14 @@ class VideoSyncMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: the number of output frames is expected to be equal to the number of input frames. For example, #: the output is used to calculate a quality metric like PSNR against the input. VFR = "Vfr" + +class Visibility(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """When PlayerVisibility is set to "Visible", the text track will be present in the DASH manifest + or HLS playlist when requested by a client. When the PlayerVisibility is set to "Hidden", the + text will not be available to the client. The default value is "Visible". + """ + + #: The track is hidden to video player. + HIDDEN = "Hidden" + #: The track is visible to video player. + VISIBLE = "Visible" diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/models/_models.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/models/_models.py deleted file mode 100644 index 1b00f983dc35..000000000000 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/models/_models.py +++ /dev/null @@ -1,7824 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class Codec(msrest.serialization.Model): - """Describes the basic properties of all codecs. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: Audio, CopyAudio, CopyVideo, Video. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param label: An optional label for the codec. The label can be used to control muxing - behavior. - :type label: str - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - } - - _subtype_map = { - 'odata_type': {'#Microsoft.Media.Audio': 'Audio', '#Microsoft.Media.CopyAudio': 'CopyAudio', '#Microsoft.Media.CopyVideo': 'CopyVideo', '#Microsoft.Media.Video': 'Video'} - } - - def __init__( - self, - **kwargs - ): - super(Codec, self).__init__(**kwargs) - self.odata_type = None # type: Optional[str] - self.label = kwargs.get('label', None) - - -class Audio(Codec): - """Defines the common properties for all audio codecs. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AacAudio. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param label: An optional label for the codec. The label can be used to control muxing - behavior. - :type label: str - :param channels: The number of channels in the audio. - :type channels: int - :param sampling_rate: The sampling rate to use for encoding in hertz. - :type sampling_rate: int - :param bitrate: The bitrate, in bits per second, of the output encoded audio. - :type bitrate: int - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'channels': {'key': 'channels', 'type': 'int'}, - 'sampling_rate': {'key': 'samplingRate', 'type': 'int'}, - 'bitrate': {'key': 'bitrate', 'type': 'int'}, - } - - _subtype_map = { - 'odata_type': {'#Microsoft.Media.AacAudio': 'AacAudio'} - } - - def __init__( - self, - **kwargs - ): - super(Audio, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.Audio' # type: str - self.channels = kwargs.get('channels', None) - self.sampling_rate = kwargs.get('sampling_rate', None) - self.bitrate = kwargs.get('bitrate', None) - - -class AacAudio(Audio): - """Describes Advanced Audio Codec (AAC) audio encoding settings. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param label: An optional label for the codec. The label can be used to control muxing - behavior. - :type label: str - :param channels: The number of channels in the audio. - :type channels: int - :param sampling_rate: The sampling rate to use for encoding in hertz. - :type sampling_rate: int - :param bitrate: The bitrate, in bits per second, of the output encoded audio. - :type bitrate: int - :param profile: The encoding profile to be used when encoding audio with AAC. Possible values - include: "AacLc", "HeAacV1", "HeAacV2". - :type profile: str or ~azure.mgmt.media.models.AacAudioProfile - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'channels': {'key': 'channels', 'type': 'int'}, - 'sampling_rate': {'key': 'samplingRate', 'type': 'int'}, - 'bitrate': {'key': 'bitrate', 'type': 'int'}, - 'profile': {'key': 'profile', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AacAudio, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.AacAudio' # type: str - self.profile = kwargs.get('profile', None) - - -class ClipTime(msrest.serialization.Model): - """Base class for specifying a clip time. Use sub classes of this class to specify the time position in the media. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AbsoluteClipTime, UtcClipTime. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - } - - _subtype_map = { - 'odata_type': {'#Microsoft.Media.AbsoluteClipTime': 'AbsoluteClipTime', '#Microsoft.Media.UtcClipTime': 'UtcClipTime'} - } - - def __init__( - self, - **kwargs - ): - super(ClipTime, self).__init__(**kwargs) - self.odata_type = None # type: Optional[str] - - -class AbsoluteClipTime(ClipTime): - """Specifies the clip time as an absolute time position in the media file. The absolute time can point to a different position depending on whether the media file starts from a timestamp of zero or not. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param time: Required. The time position on the timeline of the input media. It is usually - specified as an ISO8601 period. e.g PT30S for 30 seconds. - :type time: ~datetime.timedelta - """ - - _validation = { - 'odata_type': {'required': True}, - 'time': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'time': {'key': 'time', 'type': 'duration'}, - } - - def __init__( - self, - **kwargs - ): - super(AbsoluteClipTime, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.AbsoluteClipTime' # type: str - self.time = kwargs['time'] - - -class AccessControl(msrest.serialization.Model): - """AccessControl. - - :param default_action: The behavior for IP access control in Key Delivery. Possible values - include: "Allow", "Deny". - :type default_action: str or ~azure.mgmt.media.models.DefaultAction - :param ip_allow_list: The IP allow list for access control in Key Delivery. If the default - action is set to 'Allow', the IP allow list must be empty. - :type ip_allow_list: list[str] - """ - - _attribute_map = { - 'default_action': {'key': 'defaultAction', 'type': 'str'}, - 'ip_allow_list': {'key': 'ipAllowList', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(AccessControl, self).__init__(**kwargs) - self.default_action = kwargs.get('default_action', None) - self.ip_allow_list = kwargs.get('ip_allow_list', None) - - -class AccountEncryption(msrest.serialization.Model): - """AccountEncryption. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of key used to encrypt the Account Key. Possible values - include: "SystemKey", "CustomerKey". - :type type: str or ~azure.mgmt.media.models.AccountEncryptionKeyType - :param key_vault_properties: The properties of the key used to encrypt the account. - :type key_vault_properties: ~azure.mgmt.media.models.KeyVaultProperties - :param identity: The Key Vault identity. - :type identity: ~azure.mgmt.media.models.ResourceIdentity - :ivar status: The current status of the Key Vault mapping. - :vartype status: str - """ - - _validation = { - 'type': {'required': True}, - 'status': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'key_vault_properties': {'key': 'keyVaultProperties', 'type': 'KeyVaultProperties'}, - 'identity': {'key': 'identity', 'type': 'ResourceIdentity'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccountEncryption, self).__init__(**kwargs) - self.type = kwargs['type'] - self.key_vault_properties = kwargs.get('key_vault_properties', None) - self.identity = kwargs.get('identity', None) - self.status = None - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - -class AccountFilter(ProxyResource): - """An Account Filter. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: The system metadata relating to this resource. - :vartype system_data: ~azure.mgmt.media.models.SystemData - :param presentation_time_range: The presentation time range. - :type presentation_time_range: ~azure.mgmt.media.models.PresentationTimeRange - :param first_quality: The first quality. - :type first_quality: ~azure.mgmt.media.models.FirstQuality - :param tracks: The tracks selection conditions. - :type tracks: list[~azure.mgmt.media.models.FilterTrackSelection] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'presentation_time_range': {'key': 'properties.presentationTimeRange', 'type': 'PresentationTimeRange'}, - 'first_quality': {'key': 'properties.firstQuality', 'type': 'FirstQuality'}, - 'tracks': {'key': 'properties.tracks', 'type': '[FilterTrackSelection]'}, - } - - def __init__( - self, - **kwargs - ): - super(AccountFilter, self).__init__(**kwargs) - self.system_data = None - self.presentation_time_range = kwargs.get('presentation_time_range', None) - self.first_quality = kwargs.get('first_quality', None) - self.tracks = kwargs.get('tracks', None) - - -class AccountFilterCollection(msrest.serialization.Model): - """A collection of AccountFilter items. - - :param value: A collection of AccountFilter items. - :type value: list[~azure.mgmt.media.models.AccountFilter] - :param odata_next_link: A link to the next page of the collection (when the collection contains - too many results to return in one response). - :type odata_next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AccountFilter]'}, - 'odata_next_link': {'key': '@odata\\.nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccountFilterCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.odata_next_link = kwargs.get('odata_next_link', None) - - -class AkamaiAccessControl(msrest.serialization.Model): - """Akamai access control. - - :param akamai_signature_header_authentication_key_list: authentication key list. - :type akamai_signature_header_authentication_key_list: - list[~azure.mgmt.media.models.AkamaiSignatureHeaderAuthenticationKey] - """ - - _attribute_map = { - 'akamai_signature_header_authentication_key_list': {'key': 'akamaiSignatureHeaderAuthenticationKeyList', 'type': '[AkamaiSignatureHeaderAuthenticationKey]'}, - } - - def __init__( - self, - **kwargs - ): - super(AkamaiAccessControl, self).__init__(**kwargs) - self.akamai_signature_header_authentication_key_list = kwargs.get('akamai_signature_header_authentication_key_list', None) - - -class AkamaiSignatureHeaderAuthenticationKey(msrest.serialization.Model): - """Akamai Signature Header authentication key. - - :param identifier: identifier of the key. - :type identifier: str - :param base64_key: authentication key. - :type base64_key: str - :param expiration: The expiration time of the authentication key. - :type expiration: ~datetime.datetime - """ - - _attribute_map = { - 'identifier': {'key': 'identifier', 'type': 'str'}, - 'base64_key': {'key': 'base64Key', 'type': 'str'}, - 'expiration': {'key': 'expiration', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(AkamaiSignatureHeaderAuthenticationKey, self).__init__(**kwargs) - self.identifier = kwargs.get('identifier', None) - self.base64_key = kwargs.get('base64_key', None) - self.expiration = kwargs.get('expiration', None) - - -class Asset(ProxyResource): - """An Asset. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: The system metadata relating to this resource. - :vartype system_data: ~azure.mgmt.media.models.SystemData - :ivar asset_id: The Asset ID. - :vartype asset_id: str - :ivar created: The creation date of the Asset. - :vartype created: ~datetime.datetime - :ivar last_modified: The last modified date of the Asset. - :vartype last_modified: ~datetime.datetime - :param alternate_id: The alternate ID of the Asset. - :type alternate_id: str - :param description: The Asset description. - :type description: str - :param container: The name of the asset blob container. - :type container: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :ivar storage_encryption_format: The Asset encryption format. One of None or - MediaStorageEncryption. Possible values include: "None", "MediaStorageClientEncryption". - :vartype storage_encryption_format: str or - ~azure.mgmt.media.models.AssetStorageEncryptionFormat - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'asset_id': {'readonly': True}, - 'created': {'readonly': True}, - 'last_modified': {'readonly': True}, - 'storage_encryption_format': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'asset_id': {'key': 'properties.assetId', 'type': 'str'}, - 'created': {'key': 'properties.created', 'type': 'iso-8601'}, - 'last_modified': {'key': 'properties.lastModified', 'type': 'iso-8601'}, - 'alternate_id': {'key': 'properties.alternateId', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'container': {'key': 'properties.container', 'type': 'str'}, - 'storage_account_name': {'key': 'properties.storageAccountName', 'type': 'str'}, - 'storage_encryption_format': {'key': 'properties.storageEncryptionFormat', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Asset, self).__init__(**kwargs) - self.system_data = None - self.asset_id = None - self.created = None - self.last_modified = None - self.alternate_id = kwargs.get('alternate_id', None) - self.description = kwargs.get('description', None) - self.container = kwargs.get('container', None) - self.storage_account_name = kwargs.get('storage_account_name', None) - self.storage_encryption_format = None - - -class AssetCollection(msrest.serialization.Model): - """A collection of Asset items. - - :param value: A collection of Asset items. - :type value: list[~azure.mgmt.media.models.Asset] - :param odata_next_link: A link to the next page of the collection (when the collection contains - too many results to return in one response). - :type odata_next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Asset]'}, - 'odata_next_link': {'key': '@odata\\.nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AssetCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.odata_next_link = kwargs.get('odata_next_link', None) - - -class AssetContainerSas(msrest.serialization.Model): - """The Asset Storage container SAS URLs. - - :param asset_container_sas_urls: The list of Asset container SAS URLs. - :type asset_container_sas_urls: list[str] - """ - - _attribute_map = { - 'asset_container_sas_urls': {'key': 'assetContainerSasUrls', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(AssetContainerSas, self).__init__(**kwargs) - self.asset_container_sas_urls = kwargs.get('asset_container_sas_urls', None) - - -class AssetFileEncryptionMetadata(msrest.serialization.Model): - """The Asset File Storage encryption metadata. - - All required parameters must be populated in order to send to Azure. - - :param initialization_vector: The Asset File initialization vector. - :type initialization_vector: str - :param asset_file_name: The Asset File name. - :type asset_file_name: str - :param asset_file_id: Required. The Asset File Id. - :type asset_file_id: str - """ - - _validation = { - 'asset_file_id': {'required': True}, - } - - _attribute_map = { - 'initialization_vector': {'key': 'initializationVector', 'type': 'str'}, - 'asset_file_name': {'key': 'assetFileName', 'type': 'str'}, - 'asset_file_id': {'key': 'assetFileId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AssetFileEncryptionMetadata, self).__init__(**kwargs) - self.initialization_vector = kwargs.get('initialization_vector', None) - self.asset_file_name = kwargs.get('asset_file_name', None) - self.asset_file_id = kwargs['asset_file_id'] - - -class AssetFilter(ProxyResource): - """An Asset Filter. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: The system metadata relating to this resource. - :vartype system_data: ~azure.mgmt.media.models.SystemData - :param presentation_time_range: The presentation time range. - :type presentation_time_range: ~azure.mgmt.media.models.PresentationTimeRange - :param first_quality: The first quality. - :type first_quality: ~azure.mgmt.media.models.FirstQuality - :param tracks: The tracks selection conditions. - :type tracks: list[~azure.mgmt.media.models.FilterTrackSelection] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'presentation_time_range': {'key': 'properties.presentationTimeRange', 'type': 'PresentationTimeRange'}, - 'first_quality': {'key': 'properties.firstQuality', 'type': 'FirstQuality'}, - 'tracks': {'key': 'properties.tracks', 'type': '[FilterTrackSelection]'}, - } - - def __init__( - self, - **kwargs - ): - super(AssetFilter, self).__init__(**kwargs) - self.system_data = None - self.presentation_time_range = kwargs.get('presentation_time_range', None) - self.first_quality = kwargs.get('first_quality', None) - self.tracks = kwargs.get('tracks', None) - - -class AssetFilterCollection(msrest.serialization.Model): - """A collection of AssetFilter items. - - :param value: A collection of AssetFilter items. - :type value: list[~azure.mgmt.media.models.AssetFilter] - :param odata_next_link: A link to the next page of the collection (when the collection contains - too many results to return in one response). - :type odata_next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AssetFilter]'}, - 'odata_next_link': {'key': '@odata\\.nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AssetFilterCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.odata_next_link = kwargs.get('odata_next_link', None) - - -class AssetStreamingLocator(msrest.serialization.Model): - """Properties of the Streaming Locator. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Streaming Locator name. - :vartype name: str - :ivar asset_name: Asset Name. - :vartype asset_name: str - :ivar created: The creation time of the Streaming Locator. - :vartype created: ~datetime.datetime - :ivar start_time: The start time of the Streaming Locator. - :vartype start_time: ~datetime.datetime - :ivar end_time: The end time of the Streaming Locator. - :vartype end_time: ~datetime.datetime - :ivar streaming_locator_id: StreamingLocatorId of the Streaming Locator. - :vartype streaming_locator_id: str - :ivar streaming_policy_name: Name of the Streaming Policy used by this Streaming Locator. - :vartype streaming_policy_name: str - :ivar default_content_key_policy_name: Name of the default ContentKeyPolicy used by this - Streaming Locator. - :vartype default_content_key_policy_name: str - """ - - _validation = { - 'name': {'readonly': True}, - 'asset_name': {'readonly': True}, - 'created': {'readonly': True}, - 'start_time': {'readonly': True}, - 'end_time': {'readonly': True}, - 'streaming_locator_id': {'readonly': True}, - 'streaming_policy_name': {'readonly': True}, - 'default_content_key_policy_name': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'asset_name': {'key': 'assetName', 'type': 'str'}, - 'created': {'key': 'created', 'type': 'iso-8601'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'streaming_locator_id': {'key': 'streamingLocatorId', 'type': 'str'}, - 'streaming_policy_name': {'key': 'streamingPolicyName', 'type': 'str'}, - 'default_content_key_policy_name': {'key': 'defaultContentKeyPolicyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AssetStreamingLocator, self).__init__(**kwargs) - self.name = None - self.asset_name = None - self.created = None - self.start_time = None - self.end_time = None - self.streaming_locator_id = None - self.streaming_policy_name = None - self.default_content_key_policy_name = None - - -class Preset(msrest.serialization.Model): - """Base type for all Presets, which define the recipe or instructions on how the input media files should be processed. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AudioAnalyzerPreset, BuiltInStandardEncoderPreset, FaceDetectorPreset, StandardEncoderPreset. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - } - - _subtype_map = { - 'odata_type': {'#Microsoft.Media.AudioAnalyzerPreset': 'AudioAnalyzerPreset', '#Microsoft.Media.BuiltInStandardEncoderPreset': 'BuiltInStandardEncoderPreset', '#Microsoft.Media.FaceDetectorPreset': 'FaceDetectorPreset', '#Microsoft.Media.StandardEncoderPreset': 'StandardEncoderPreset'} - } - - def __init__( - self, - **kwargs - ): - super(Preset, self).__init__(**kwargs) - self.odata_type = None # type: Optional[str] - - -class AudioAnalyzerPreset(Preset): - """The Audio Analyzer preset applies a pre-defined set of AI-based analysis operations, including speech transcription. Currently, the preset supports processing of content with a single audio track. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: VideoAnalyzerPreset. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param audio_language: The language for the audio payload in the input using the BCP-47 format - of 'language tag-region' (e.g: 'en-US'). If you know the language of your content, it is - recommended that you specify it. The language must be specified explicitly for - AudioAnalysisMode::Basic, since automatic language detection is not included in basic mode. If - the language isn't specified or set to null, automatic language detection will choose the first - language detected and process with the selected language for the duration of the file. It does - not currently support dynamically switching between languages after the first language is - detected. The automatic detection works best with audio recordings with clearly discernable - speech. If automatic detection fails to find the language, transcription would fallback to - 'en-US'." The list of supported languages is available here: - https://go.microsoft.com/fwlink/?linkid=2109463. - :type audio_language: str - :param mode: Determines the set of audio analysis operations to be performed. If unspecified, - the Standard AudioAnalysisMode would be chosen. Possible values include: "Standard", "Basic". - :type mode: str or ~azure.mgmt.media.models.AudioAnalysisMode - :param experimental_options: Dictionary containing key value pairs for parameters not exposed - in the preset itself. - :type experimental_options: dict[str, str] - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'audio_language': {'key': 'audioLanguage', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'experimental_options': {'key': 'experimentalOptions', 'type': '{str}'}, - } - - _subtype_map = { - 'odata_type': {'#Microsoft.Media.VideoAnalyzerPreset': 'VideoAnalyzerPreset'} - } - - def __init__( - self, - **kwargs - ): - super(AudioAnalyzerPreset, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.AudioAnalyzerPreset' # type: str - self.audio_language = kwargs.get('audio_language', None) - self.mode = kwargs.get('mode', None) - self.experimental_options = kwargs.get('experimental_options', None) - - -class Overlay(msrest.serialization.Model): - """Base type for all overlays - image, audio or video. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AudioOverlay, VideoOverlay. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param input_label: Required. The label of the job input which is to be used as an overlay. The - Input must specify exactly one file. You can specify an image file in JPG, PNG, GIF or BMP - format, or an audio file (such as a WAV, MP3, WMA or M4A file), or a video file. See - https://aka.ms/mesformats for the complete list of supported audio and video file formats. - :type input_label: str - :param start: The start position, with reference to the input video, at which the overlay - starts. The value should be in ISO 8601 format. For example, PT05S to start the overlay at 5 - seconds into the input video. If not specified the overlay starts from the beginning of the - input video. - :type start: ~datetime.timedelta - :param end: The end position, with reference to the input video, at which the overlay ends. The - value should be in ISO 8601 format. For example, PT30S to end the overlay at 30 seconds into - the input video. If not specified or the value is greater than the input video duration, the - overlay will be applied until the end of the input video if the overlay media duration is - greater than the input video duration, else the overlay will last as long as the overlay media - duration. - :type end: ~datetime.timedelta - :param fade_in_duration: The duration over which the overlay fades in onto the input video. The - value should be in ISO 8601 duration format. If not specified the default behavior is to have - no fade in (same as PT0S). - :type fade_in_duration: ~datetime.timedelta - :param fade_out_duration: The duration over which the overlay fades out of the input video. The - value should be in ISO 8601 duration format. If not specified the default behavior is to have - no fade out (same as PT0S). - :type fade_out_duration: ~datetime.timedelta - :param audio_gain_level: The gain level of audio in the overlay. The value should be in the - range [0, 1.0]. The default is 1.0. - :type audio_gain_level: float - """ - - _validation = { - 'odata_type': {'required': True}, - 'input_label': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'input_label': {'key': 'inputLabel', 'type': 'str'}, - 'start': {'key': 'start', 'type': 'duration'}, - 'end': {'key': 'end', 'type': 'duration'}, - 'fade_in_duration': {'key': 'fadeInDuration', 'type': 'duration'}, - 'fade_out_duration': {'key': 'fadeOutDuration', 'type': 'duration'}, - 'audio_gain_level': {'key': 'audioGainLevel', 'type': 'float'}, - } - - _subtype_map = { - 'odata_type': {'#Microsoft.Media.AudioOverlay': 'AudioOverlay', '#Microsoft.Media.VideoOverlay': 'VideoOverlay'} - } - - def __init__( - self, - **kwargs - ): - super(Overlay, self).__init__(**kwargs) - self.odata_type = None # type: Optional[str] - self.input_label = kwargs['input_label'] - self.start = kwargs.get('start', None) - self.end = kwargs.get('end', None) - self.fade_in_duration = kwargs.get('fade_in_duration', None) - self.fade_out_duration = kwargs.get('fade_out_duration', None) - self.audio_gain_level = kwargs.get('audio_gain_level', None) - - -class AudioOverlay(Overlay): - """Describes the properties of an audio overlay. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param input_label: Required. The label of the job input which is to be used as an overlay. The - Input must specify exactly one file. You can specify an image file in JPG, PNG, GIF or BMP - format, or an audio file (such as a WAV, MP3, WMA or M4A file), or a video file. See - https://aka.ms/mesformats for the complete list of supported audio and video file formats. - :type input_label: str - :param start: The start position, with reference to the input video, at which the overlay - starts. The value should be in ISO 8601 format. For example, PT05S to start the overlay at 5 - seconds into the input video. If not specified the overlay starts from the beginning of the - input video. - :type start: ~datetime.timedelta - :param end: The end position, with reference to the input video, at which the overlay ends. The - value should be in ISO 8601 format. For example, PT30S to end the overlay at 30 seconds into - the input video. If not specified or the value is greater than the input video duration, the - overlay will be applied until the end of the input video if the overlay media duration is - greater than the input video duration, else the overlay will last as long as the overlay media - duration. - :type end: ~datetime.timedelta - :param fade_in_duration: The duration over which the overlay fades in onto the input video. The - value should be in ISO 8601 duration format. If not specified the default behavior is to have - no fade in (same as PT0S). - :type fade_in_duration: ~datetime.timedelta - :param fade_out_duration: The duration over which the overlay fades out of the input video. The - value should be in ISO 8601 duration format. If not specified the default behavior is to have - no fade out (same as PT0S). - :type fade_out_duration: ~datetime.timedelta - :param audio_gain_level: The gain level of audio in the overlay. The value should be in the - range [0, 1.0]. The default is 1.0. - :type audio_gain_level: float - """ - - _validation = { - 'odata_type': {'required': True}, - 'input_label': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'input_label': {'key': 'inputLabel', 'type': 'str'}, - 'start': {'key': 'start', 'type': 'duration'}, - 'end': {'key': 'end', 'type': 'duration'}, - 'fade_in_duration': {'key': 'fadeInDuration', 'type': 'duration'}, - 'fade_out_duration': {'key': 'fadeOutDuration', 'type': 'duration'}, - 'audio_gain_level': {'key': 'audioGainLevel', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(AudioOverlay, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.AudioOverlay' # type: str - - -class TrackDescriptor(msrest.serialization.Model): - """Base type for all TrackDescriptor types, which define the metadata and selection for tracks that should be processed by a Job. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AudioTrackDescriptor, VideoTrackDescriptor. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - } - - _subtype_map = { - 'odata_type': {'#Microsoft.Media.AudioTrackDescriptor': 'AudioTrackDescriptor', '#Microsoft.Media.VideoTrackDescriptor': 'VideoTrackDescriptor'} - } - - def __init__( - self, - **kwargs - ): - super(TrackDescriptor, self).__init__(**kwargs) - self.odata_type = None # type: Optional[str] - - -class AudioTrackDescriptor(TrackDescriptor): - """A TrackSelection to select audio tracks. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: SelectAudioTrackByAttribute, SelectAudioTrackById. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param channel_mapping: Optional designation for single channel audio tracks. Can be used to - combine the tracks into stereo or multi-channel audio tracks. Possible values include: - "FrontLeft", "FrontRight", "Center", "LowFrequencyEffects", "BackLeft", "BackRight", - "StereoLeft", "StereoRight". - :type channel_mapping: str or ~azure.mgmt.media.models.ChannelMapping - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'channel_mapping': {'key': 'channelMapping', 'type': 'str'}, - } - - _subtype_map = { - 'odata_type': {'#Microsoft.Media.SelectAudioTrackByAttribute': 'SelectAudioTrackByAttribute', '#Microsoft.Media.SelectAudioTrackById': 'SelectAudioTrackById'} - } - - def __init__( - self, - **kwargs - ): - super(AudioTrackDescriptor, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.AudioTrackDescriptor' # type: str - self.channel_mapping = kwargs.get('channel_mapping', None) - - -class BuiltInStandardEncoderPreset(Preset): - """Describes a built-in preset for encoding the input video with the Standard Encoder. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param configurations: PresetConfigurations are only supported for the ContentAwareEncoding and - H265ContentAwareEncoding built-in presets. These settings will not affect other built-in or - custom defined presets. - :type configurations: ~azure.mgmt.media.models.PresetConfigurations - :param preset_name: Required. The built-in preset to be used for encoding videos. Possible - values include: "H264SingleBitrateSD", "H264SingleBitrate720p", "H264SingleBitrate1080p", - "AdaptiveStreaming", "AACGoodQualityAudio", "ContentAwareEncodingExperimental", - "ContentAwareEncoding", "CopyAllBitrateNonInterleaved", "H264MultipleBitrate1080p", - "H264MultipleBitrate720p", "H264MultipleBitrateSD", "H265ContentAwareEncoding", - "H265AdaptiveStreaming", "H265SingleBitrate720p", "H265SingleBitrate1080p", - "H265SingleBitrate4K". - :type preset_name: str or ~azure.mgmt.media.models.EncoderNamedPreset - """ - - _validation = { - 'odata_type': {'required': True}, - 'preset_name': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'configurations': {'key': 'configurations', 'type': 'PresetConfigurations'}, - 'preset_name': {'key': 'presetName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BuiltInStandardEncoderPreset, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.BuiltInStandardEncoderPreset' # type: str - self.configurations = kwargs.get('configurations', None) - self.preset_name = kwargs['preset_name'] - - -class CbcsDrmConfiguration(msrest.serialization.Model): - """Class to specify DRM configurations of CommonEncryptionCbcs scheme in Streaming Policy. - - :param fair_play: FairPlay configurations. - :type fair_play: ~azure.mgmt.media.models.StreamingPolicyFairPlayConfiguration - :param play_ready: PlayReady configurations. - :type play_ready: ~azure.mgmt.media.models.StreamingPolicyPlayReadyConfiguration - :param widevine: Widevine configurations. - :type widevine: ~azure.mgmt.media.models.StreamingPolicyWidevineConfiguration - """ - - _attribute_map = { - 'fair_play': {'key': 'fairPlay', 'type': 'StreamingPolicyFairPlayConfiguration'}, - 'play_ready': {'key': 'playReady', 'type': 'StreamingPolicyPlayReadyConfiguration'}, - 'widevine': {'key': 'widevine', 'type': 'StreamingPolicyWidevineConfiguration'}, - } - - def __init__( - self, - **kwargs - ): - super(CbcsDrmConfiguration, self).__init__(**kwargs) - self.fair_play = kwargs.get('fair_play', None) - self.play_ready = kwargs.get('play_ready', None) - self.widevine = kwargs.get('widevine', None) - - -class CencDrmConfiguration(msrest.serialization.Model): - """Class to specify DRM configurations of CommonEncryptionCenc scheme in Streaming Policy. - - :param play_ready: PlayReady configurations. - :type play_ready: ~azure.mgmt.media.models.StreamingPolicyPlayReadyConfiguration - :param widevine: Widevine configurations. - :type widevine: ~azure.mgmt.media.models.StreamingPolicyWidevineConfiguration - """ - - _attribute_map = { - 'play_ready': {'key': 'playReady', 'type': 'StreamingPolicyPlayReadyConfiguration'}, - 'widevine': {'key': 'widevine', 'type': 'StreamingPolicyWidevineConfiguration'}, - } - - def __init__( - self, - **kwargs - ): - super(CencDrmConfiguration, self).__init__(**kwargs) - self.play_ready = kwargs.get('play_ready', None) - self.widevine = kwargs.get('widevine', None) - - -class CheckNameAvailabilityInput(msrest.serialization.Model): - """The input to the check name availability request. - - :param name: The account name. - :type name: str - :param type: The account type. For a Media Services account, this should be 'MediaServices'. - :type type: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityInput, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) - - -class CommonEncryptionCbcs(msrest.serialization.Model): - """Class for CommonEncryptionCbcs encryption scheme. - - :param enabled_protocols: Representing supported protocols. - :type enabled_protocols: ~azure.mgmt.media.models.EnabledProtocols - :param clear_tracks: Representing which tracks should not be encrypted. - :type clear_tracks: list[~azure.mgmt.media.models.TrackSelection] - :param content_keys: Representing default content key for each encryption scheme and separate - content keys for specific tracks. - :type content_keys: ~azure.mgmt.media.models.StreamingPolicyContentKeys - :param drm: Configuration of DRMs for current encryption scheme. - :type drm: ~azure.mgmt.media.models.CbcsDrmConfiguration - """ - - _attribute_map = { - 'enabled_protocols': {'key': 'enabledProtocols', 'type': 'EnabledProtocols'}, - 'clear_tracks': {'key': 'clearTracks', 'type': '[TrackSelection]'}, - 'content_keys': {'key': 'contentKeys', 'type': 'StreamingPolicyContentKeys'}, - 'drm': {'key': 'drm', 'type': 'CbcsDrmConfiguration'}, - } - - def __init__( - self, - **kwargs - ): - super(CommonEncryptionCbcs, self).__init__(**kwargs) - self.enabled_protocols = kwargs.get('enabled_protocols', None) - self.clear_tracks = kwargs.get('clear_tracks', None) - self.content_keys = kwargs.get('content_keys', None) - self.drm = kwargs.get('drm', None) - - -class CommonEncryptionCenc(msrest.serialization.Model): - """Class for envelope encryption scheme. - - :param enabled_protocols: Representing supported protocols. - :type enabled_protocols: ~azure.mgmt.media.models.EnabledProtocols - :param clear_tracks: Representing which tracks should not be encrypted. - :type clear_tracks: list[~azure.mgmt.media.models.TrackSelection] - :param content_keys: Representing default content key for each encryption scheme and separate - content keys for specific tracks. - :type content_keys: ~azure.mgmt.media.models.StreamingPolicyContentKeys - :param drm: Configuration of DRMs for CommonEncryptionCenc encryption scheme. - :type drm: ~azure.mgmt.media.models.CencDrmConfiguration - """ - - _attribute_map = { - 'enabled_protocols': {'key': 'enabledProtocols', 'type': 'EnabledProtocols'}, - 'clear_tracks': {'key': 'clearTracks', 'type': '[TrackSelection]'}, - 'content_keys': {'key': 'contentKeys', 'type': 'StreamingPolicyContentKeys'}, - 'drm': {'key': 'drm', 'type': 'CencDrmConfiguration'}, - } - - def __init__( - self, - **kwargs - ): - super(CommonEncryptionCenc, self).__init__(**kwargs) - self.enabled_protocols = kwargs.get('enabled_protocols', None) - self.clear_tracks = kwargs.get('clear_tracks', None) - self.content_keys = kwargs.get('content_keys', None) - self.drm = kwargs.get('drm', None) - - -class ContentKeyPolicy(ProxyResource): - """A Content Key Policy resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: The system metadata relating to this resource. - :vartype system_data: ~azure.mgmt.media.models.SystemData - :ivar policy_id: The legacy Policy ID. - :vartype policy_id: str - :ivar created: The creation date of the Policy. - :vartype created: ~datetime.datetime - :ivar last_modified: The last modified date of the Policy. - :vartype last_modified: ~datetime.datetime - :param description: A description for the Policy. - :type description: str - :param options: The Key Policy options. - :type options: list[~azure.mgmt.media.models.ContentKeyPolicyOption] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'policy_id': {'readonly': True}, - 'created': {'readonly': True}, - 'last_modified': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'policy_id': {'key': 'properties.policyId', 'type': 'str'}, - 'created': {'key': 'properties.created', 'type': 'iso-8601'}, - 'last_modified': {'key': 'properties.lastModified', 'type': 'iso-8601'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'options': {'key': 'properties.options', 'type': '[ContentKeyPolicyOption]'}, - } - - def __init__( - self, - **kwargs - ): - super(ContentKeyPolicy, self).__init__(**kwargs) - self.system_data = None - self.policy_id = None - self.created = None - self.last_modified = None - self.description = kwargs.get('description', None) - self.options = kwargs.get('options', None) - - -class ContentKeyPolicyConfiguration(msrest.serialization.Model): - """Base class for Content Key Policy configuration. A derived class must be used to create a configuration. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ContentKeyPolicyClearKeyConfiguration, ContentKeyPolicyFairPlayConfiguration, ContentKeyPolicyPlayReadyConfiguration, ContentKeyPolicyUnknownConfiguration, ContentKeyPolicyWidevineConfiguration. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - } - - _subtype_map = { - 'odata_type': {'#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration': 'ContentKeyPolicyClearKeyConfiguration', '#Microsoft.Media.ContentKeyPolicyFairPlayConfiguration': 'ContentKeyPolicyFairPlayConfiguration', '#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration': 'ContentKeyPolicyPlayReadyConfiguration', '#Microsoft.Media.ContentKeyPolicyUnknownConfiguration': 'ContentKeyPolicyUnknownConfiguration', '#Microsoft.Media.ContentKeyPolicyWidevineConfiguration': 'ContentKeyPolicyWidevineConfiguration'} - } - - def __init__( - self, - **kwargs - ): - super(ContentKeyPolicyConfiguration, self).__init__(**kwargs) - self.odata_type = None # type: Optional[str] - - -class ContentKeyPolicyClearKeyConfiguration(ContentKeyPolicyConfiguration): - """Represents a configuration for non-DRM keys. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ContentKeyPolicyClearKeyConfiguration, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration' # type: str - - -class ContentKeyPolicyCollection(msrest.serialization.Model): - """A collection of ContentKeyPolicy items. - - :param value: A collection of ContentKeyPolicy items. - :type value: list[~azure.mgmt.media.models.ContentKeyPolicy] - :param odata_next_link: A link to the next page of the collection (when the collection contains - too many results to return in one response). - :type odata_next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ContentKeyPolicy]'}, - 'odata_next_link': {'key': '@odata\\.nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ContentKeyPolicyCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.odata_next_link = kwargs.get('odata_next_link', None) - - -class ContentKeyPolicyFairPlayConfiguration(ContentKeyPolicyConfiguration): - """Specifies a configuration for FairPlay licenses. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param ask: Required. The key that must be used as FairPlay Application Secret key. - :type ask: bytearray - :param fair_play_pfx_password: Required. The password encrypting FairPlay certificate in PKCS - 12 (pfx) format. - :type fair_play_pfx_password: str - :param fair_play_pfx: Required. The Base64 representation of FairPlay certificate in PKCS 12 - (pfx) format (including private key). - :type fair_play_pfx: str - :param rental_and_lease_key_type: Required. The rental and lease key type. Possible values - include: "Unknown", "Undefined", "DualExpiry", "PersistentUnlimited", "PersistentLimited". - :type rental_and_lease_key_type: str or - ~azure.mgmt.media.models.ContentKeyPolicyFairPlayRentalAndLeaseKeyType - :param rental_duration: Required. The rental duration. Must be greater than or equal to 0. - :type rental_duration: long - :param offline_rental_configuration: Offline rental policy. - :type offline_rental_configuration: - ~azure.mgmt.media.models.ContentKeyPolicyFairPlayOfflineRentalConfiguration - """ - - _validation = { - 'odata_type': {'required': True}, - 'ask': {'required': True}, - 'fair_play_pfx_password': {'required': True}, - 'fair_play_pfx': {'required': True}, - 'rental_and_lease_key_type': {'required': True}, - 'rental_duration': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'ask': {'key': 'ask', 'type': 'bytearray'}, - 'fair_play_pfx_password': {'key': 'fairPlayPfxPassword', 'type': 'str'}, - 'fair_play_pfx': {'key': 'fairPlayPfx', 'type': 'str'}, - 'rental_and_lease_key_type': {'key': 'rentalAndLeaseKeyType', 'type': 'str'}, - 'rental_duration': {'key': 'rentalDuration', 'type': 'long'}, - 'offline_rental_configuration': {'key': 'offlineRentalConfiguration', 'type': 'ContentKeyPolicyFairPlayOfflineRentalConfiguration'}, - } - - def __init__( - self, - **kwargs - ): - super(ContentKeyPolicyFairPlayConfiguration, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.ContentKeyPolicyFairPlayConfiguration' # type: str - self.ask = kwargs['ask'] - self.fair_play_pfx_password = kwargs['fair_play_pfx_password'] - self.fair_play_pfx = kwargs['fair_play_pfx'] - self.rental_and_lease_key_type = kwargs['rental_and_lease_key_type'] - self.rental_duration = kwargs['rental_duration'] - self.offline_rental_configuration = kwargs.get('offline_rental_configuration', None) - - -class ContentKeyPolicyFairPlayOfflineRentalConfiguration(msrest.serialization.Model): - """ContentKeyPolicyFairPlayOfflineRentalConfiguration. - - All required parameters must be populated in order to send to Azure. - - :param playback_duration_seconds: Required. Playback duration. - :type playback_duration_seconds: long - :param storage_duration_seconds: Required. Storage duration. - :type storage_duration_seconds: long - """ - - _validation = { - 'playback_duration_seconds': {'required': True}, - 'storage_duration_seconds': {'required': True}, - } - - _attribute_map = { - 'playback_duration_seconds': {'key': 'playbackDurationSeconds', 'type': 'long'}, - 'storage_duration_seconds': {'key': 'storageDurationSeconds', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(ContentKeyPolicyFairPlayOfflineRentalConfiguration, self).__init__(**kwargs) - self.playback_duration_seconds = kwargs['playback_duration_seconds'] - self.storage_duration_seconds = kwargs['storage_duration_seconds'] - - -class ContentKeyPolicyRestriction(msrest.serialization.Model): - """Base class for Content Key Policy restrictions. A derived class must be used to create a restriction. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ContentKeyPolicyOpenRestriction, ContentKeyPolicyTokenRestriction, ContentKeyPolicyUnknownRestriction. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - } - - _subtype_map = { - 'odata_type': {'#Microsoft.Media.ContentKeyPolicyOpenRestriction': 'ContentKeyPolicyOpenRestriction', '#Microsoft.Media.ContentKeyPolicyTokenRestriction': 'ContentKeyPolicyTokenRestriction', '#Microsoft.Media.ContentKeyPolicyUnknownRestriction': 'ContentKeyPolicyUnknownRestriction'} - } - - def __init__( - self, - **kwargs - ): - super(ContentKeyPolicyRestriction, self).__init__(**kwargs) - self.odata_type = None # type: Optional[str] - - -class ContentKeyPolicyOpenRestriction(ContentKeyPolicyRestriction): - """Represents an open restriction. License or key will be delivered on every request. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ContentKeyPolicyOpenRestriction, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.ContentKeyPolicyOpenRestriction' # type: str - - -class ContentKeyPolicyOption(msrest.serialization.Model): - """Represents a policy option. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar policy_option_id: The legacy Policy Option ID. - :vartype policy_option_id: str - :param name: The Policy Option description. - :type name: str - :param configuration: Required. The key delivery configuration. - :type configuration: ~azure.mgmt.media.models.ContentKeyPolicyConfiguration - :param restriction: Required. The requirements that must be met to deliver keys with this - configuration. - :type restriction: ~azure.mgmt.media.models.ContentKeyPolicyRestriction - """ - - _validation = { - 'policy_option_id': {'readonly': True}, - 'configuration': {'required': True}, - 'restriction': {'required': True}, - } - - _attribute_map = { - 'policy_option_id': {'key': 'policyOptionId', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'configuration': {'key': 'configuration', 'type': 'ContentKeyPolicyConfiguration'}, - 'restriction': {'key': 'restriction', 'type': 'ContentKeyPolicyRestriction'}, - } - - def __init__( - self, - **kwargs - ): - super(ContentKeyPolicyOption, self).__init__(**kwargs) - self.policy_option_id = None - self.name = kwargs.get('name', None) - self.configuration = kwargs['configuration'] - self.restriction = kwargs['restriction'] - - -class ContentKeyPolicyPlayReadyConfiguration(ContentKeyPolicyConfiguration): - """Specifies a configuration for PlayReady licenses. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param licenses: Required. The PlayReady licenses. - :type licenses: list[~azure.mgmt.media.models.ContentKeyPolicyPlayReadyLicense] - :param response_custom_data: The custom response data. - :type response_custom_data: str - """ - - _validation = { - 'odata_type': {'required': True}, - 'licenses': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'licenses': {'key': 'licenses', 'type': '[ContentKeyPolicyPlayReadyLicense]'}, - 'response_custom_data': {'key': 'responseCustomData', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ContentKeyPolicyPlayReadyConfiguration, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration' # type: str - self.licenses = kwargs['licenses'] - self.response_custom_data = kwargs.get('response_custom_data', None) - - -class ContentKeyPolicyPlayReadyContentKeyLocation(msrest.serialization.Model): - """Base class for content key ID location. A derived class must be used to represent the location. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader, ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - } - - _subtype_map = { - 'odata_type': {'#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader': 'ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader', '#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier': 'ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier'} - } - - def __init__( - self, - **kwargs - ): - super(ContentKeyPolicyPlayReadyContentKeyLocation, self).__init__(**kwargs) - self.odata_type = None # type: Optional[str] - - -class ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader(ContentKeyPolicyPlayReadyContentKeyLocation): - """Specifies that the content key ID is in the PlayReady header. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader' # type: str - - -class ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier(ContentKeyPolicyPlayReadyContentKeyLocation): - """Specifies that the content key ID is specified in the PlayReady configuration. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param key_id: Required. The content key ID. - :type key_id: str - """ - - _validation = { - 'odata_type': {'required': True}, - 'key_id': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'key_id': {'key': 'keyId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier' # type: str - self.key_id = kwargs['key_id'] - - -class ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction(msrest.serialization.Model): - """Configures the Explicit Analog Television Output Restriction control bits. For further details see the PlayReady Compliance Rules. - - All required parameters must be populated in order to send to Azure. - - :param best_effort: Required. Indicates whether this restriction is enforced on a Best Effort - basis. - :type best_effort: bool - :param configuration_data: Required. Configures the restriction control bits. Must be between 0 - and 3 inclusive. - :type configuration_data: int - """ - - _validation = { - 'best_effort': {'required': True}, - 'configuration_data': {'required': True}, - } - - _attribute_map = { - 'best_effort': {'key': 'bestEffort', 'type': 'bool'}, - 'configuration_data': {'key': 'configurationData', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction, self).__init__(**kwargs) - self.best_effort = kwargs['best_effort'] - self.configuration_data = kwargs['configuration_data'] - - -class ContentKeyPolicyPlayReadyLicense(msrest.serialization.Model): - """The PlayReady license. - - All required parameters must be populated in order to send to Azure. - - :param allow_test_devices: Required. A flag indicating whether test devices can use the - license. - :type allow_test_devices: bool - :param begin_date: The begin date of license. - :type begin_date: ~datetime.datetime - :param expiration_date: The expiration date of license. - :type expiration_date: ~datetime.datetime - :param relative_begin_date: The relative begin date of license. - :type relative_begin_date: ~datetime.timedelta - :param relative_expiration_date: The relative expiration date of license. - :type relative_expiration_date: ~datetime.timedelta - :param grace_period: The grace period of license. - :type grace_period: ~datetime.timedelta - :param play_right: The license PlayRight. - :type play_right: ~azure.mgmt.media.models.ContentKeyPolicyPlayReadyPlayRight - :param license_type: Required. The license type. Possible values include: "Unknown", - "NonPersistent", "Persistent". - :type license_type: str or ~azure.mgmt.media.models.ContentKeyPolicyPlayReadyLicenseType - :param content_key_location: Required. The content key location. - :type content_key_location: - ~azure.mgmt.media.models.ContentKeyPolicyPlayReadyContentKeyLocation - :param content_type: Required. The PlayReady content type. Possible values include: "Unknown", - "Unspecified", "UltraVioletDownload", "UltraVioletStreaming". - :type content_type: str or ~azure.mgmt.media.models.ContentKeyPolicyPlayReadyContentType - """ - - _validation = { - 'allow_test_devices': {'required': True}, - 'license_type': {'required': True}, - 'content_key_location': {'required': True}, - 'content_type': {'required': True}, - } - - _attribute_map = { - 'allow_test_devices': {'key': 'allowTestDevices', 'type': 'bool'}, - 'begin_date': {'key': 'beginDate', 'type': 'iso-8601'}, - 'expiration_date': {'key': 'expirationDate', 'type': 'iso-8601'}, - 'relative_begin_date': {'key': 'relativeBeginDate', 'type': 'duration'}, - 'relative_expiration_date': {'key': 'relativeExpirationDate', 'type': 'duration'}, - 'grace_period': {'key': 'gracePeriod', 'type': 'duration'}, - 'play_right': {'key': 'playRight', 'type': 'ContentKeyPolicyPlayReadyPlayRight'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'content_key_location': {'key': 'contentKeyLocation', 'type': 'ContentKeyPolicyPlayReadyContentKeyLocation'}, - 'content_type': {'key': 'contentType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ContentKeyPolicyPlayReadyLicense, self).__init__(**kwargs) - self.allow_test_devices = kwargs['allow_test_devices'] - self.begin_date = kwargs.get('begin_date', None) - self.expiration_date = kwargs.get('expiration_date', None) - self.relative_begin_date = kwargs.get('relative_begin_date', None) - self.relative_expiration_date = kwargs.get('relative_expiration_date', None) - self.grace_period = kwargs.get('grace_period', None) - self.play_right = kwargs.get('play_right', None) - self.license_type = kwargs['license_type'] - self.content_key_location = kwargs['content_key_location'] - self.content_type = kwargs['content_type'] - - -class ContentKeyPolicyPlayReadyPlayRight(msrest.serialization.Model): - """Configures the Play Right in the PlayReady license. - - All required parameters must be populated in order to send to Azure. - - :param first_play_expiration: The amount of time that the license is valid after the license is - first used to play content. - :type first_play_expiration: ~datetime.timedelta - :param scms_restriction: Configures the Serial Copy Management System (SCMS) in the license. - Must be between 0 and 3 inclusive. - :type scms_restriction: int - :param agc_and_color_stripe_restriction: Configures Automatic Gain Control (AGC) and Color - Stripe in the license. Must be between 0 and 3 inclusive. - :type agc_and_color_stripe_restriction: int - :param explicit_analog_television_output_restriction: Configures the Explicit Analog Television - Output Restriction in the license. Configuration data must be between 0 and 3 inclusive. - :type explicit_analog_television_output_restriction: - ~azure.mgmt.media.models.ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction - :param digital_video_only_content_restriction: Required. Enables the Image Constraint For - Analog Component Video Restriction in the license. - :type digital_video_only_content_restriction: bool - :param image_constraint_for_analog_component_video_restriction: Required. Enables the Image - Constraint For Analog Component Video Restriction in the license. - :type image_constraint_for_analog_component_video_restriction: bool - :param image_constraint_for_analog_computer_monitor_restriction: Required. Enables the Image - Constraint For Analog Component Video Restriction in the license. - :type image_constraint_for_analog_computer_monitor_restriction: bool - :param allow_passing_video_content_to_unknown_output: Required. Configures Unknown output - handling settings of the license. Possible values include: "Unknown", "NotAllowed", "Allowed", - "AllowedWithVideoConstriction". - :type allow_passing_video_content_to_unknown_output: str or - ~azure.mgmt.media.models.ContentKeyPolicyPlayReadyUnknownOutputPassingOption - :param uncompressed_digital_video_opl: Specifies the output protection level for uncompressed - digital video. - :type uncompressed_digital_video_opl: int - :param compressed_digital_video_opl: Specifies the output protection level for compressed - digital video. - :type compressed_digital_video_opl: int - :param analog_video_opl: Specifies the output protection level for compressed digital audio. - :type analog_video_opl: int - :param compressed_digital_audio_opl: Specifies the output protection level for compressed - digital audio. - :type compressed_digital_audio_opl: int - :param uncompressed_digital_audio_opl: Specifies the output protection level for uncompressed - digital audio. - :type uncompressed_digital_audio_opl: int - """ - - _validation = { - 'digital_video_only_content_restriction': {'required': True}, - 'image_constraint_for_analog_component_video_restriction': {'required': True}, - 'image_constraint_for_analog_computer_monitor_restriction': {'required': True}, - 'allow_passing_video_content_to_unknown_output': {'required': True}, - } - - _attribute_map = { - 'first_play_expiration': {'key': 'firstPlayExpiration', 'type': 'duration'}, - 'scms_restriction': {'key': 'scmsRestriction', 'type': 'int'}, - 'agc_and_color_stripe_restriction': {'key': 'agcAndColorStripeRestriction', 'type': 'int'}, - 'explicit_analog_television_output_restriction': {'key': 'explicitAnalogTelevisionOutputRestriction', 'type': 'ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction'}, - 'digital_video_only_content_restriction': {'key': 'digitalVideoOnlyContentRestriction', 'type': 'bool'}, - 'image_constraint_for_analog_component_video_restriction': {'key': 'imageConstraintForAnalogComponentVideoRestriction', 'type': 'bool'}, - 'image_constraint_for_analog_computer_monitor_restriction': {'key': 'imageConstraintForAnalogComputerMonitorRestriction', 'type': 'bool'}, - 'allow_passing_video_content_to_unknown_output': {'key': 'allowPassingVideoContentToUnknownOutput', 'type': 'str'}, - 'uncompressed_digital_video_opl': {'key': 'uncompressedDigitalVideoOpl', 'type': 'int'}, - 'compressed_digital_video_opl': {'key': 'compressedDigitalVideoOpl', 'type': 'int'}, - 'analog_video_opl': {'key': 'analogVideoOpl', 'type': 'int'}, - 'compressed_digital_audio_opl': {'key': 'compressedDigitalAudioOpl', 'type': 'int'}, - 'uncompressed_digital_audio_opl': {'key': 'uncompressedDigitalAudioOpl', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ContentKeyPolicyPlayReadyPlayRight, self).__init__(**kwargs) - self.first_play_expiration = kwargs.get('first_play_expiration', None) - self.scms_restriction = kwargs.get('scms_restriction', None) - self.agc_and_color_stripe_restriction = kwargs.get('agc_and_color_stripe_restriction', None) - self.explicit_analog_television_output_restriction = kwargs.get('explicit_analog_television_output_restriction', None) - self.digital_video_only_content_restriction = kwargs['digital_video_only_content_restriction'] - self.image_constraint_for_analog_component_video_restriction = kwargs['image_constraint_for_analog_component_video_restriction'] - self.image_constraint_for_analog_computer_monitor_restriction = kwargs['image_constraint_for_analog_computer_monitor_restriction'] - self.allow_passing_video_content_to_unknown_output = kwargs['allow_passing_video_content_to_unknown_output'] - self.uncompressed_digital_video_opl = kwargs.get('uncompressed_digital_video_opl', None) - self.compressed_digital_video_opl = kwargs.get('compressed_digital_video_opl', None) - self.analog_video_opl = kwargs.get('analog_video_opl', None) - self.compressed_digital_audio_opl = kwargs.get('compressed_digital_audio_opl', None) - self.uncompressed_digital_audio_opl = kwargs.get('uncompressed_digital_audio_opl', None) - - -class ContentKeyPolicyProperties(msrest.serialization.Model): - """The properties of the Content Key Policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar policy_id: The legacy Policy ID. - :vartype policy_id: str - :ivar created: The creation date of the Policy. - :vartype created: ~datetime.datetime - :ivar last_modified: The last modified date of the Policy. - :vartype last_modified: ~datetime.datetime - :param description: A description for the Policy. - :type description: str - :param options: Required. The Key Policy options. - :type options: list[~azure.mgmt.media.models.ContentKeyPolicyOption] - """ - - _validation = { - 'policy_id': {'readonly': True}, - 'created': {'readonly': True}, - 'last_modified': {'readonly': True}, - 'options': {'required': True}, - } - - _attribute_map = { - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'created': {'key': 'created', 'type': 'iso-8601'}, - 'last_modified': {'key': 'lastModified', 'type': 'iso-8601'}, - 'description': {'key': 'description', 'type': 'str'}, - 'options': {'key': 'options', 'type': '[ContentKeyPolicyOption]'}, - } - - def __init__( - self, - **kwargs - ): - super(ContentKeyPolicyProperties, self).__init__(**kwargs) - self.policy_id = None - self.created = None - self.last_modified = None - self.description = kwargs.get('description', None) - self.options = kwargs['options'] - - -class ContentKeyPolicyRestrictionTokenKey(msrest.serialization.Model): - """Base class for Content Key Policy key for token validation. A derived class must be used to create a token key. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ContentKeyPolicyRsaTokenKey, ContentKeyPolicySymmetricTokenKey, ContentKeyPolicyX509CertificateTokenKey. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - } - - _subtype_map = { - 'odata_type': {'#Microsoft.Media.ContentKeyPolicyRsaTokenKey': 'ContentKeyPolicyRsaTokenKey', '#Microsoft.Media.ContentKeyPolicySymmetricTokenKey': 'ContentKeyPolicySymmetricTokenKey', '#Microsoft.Media.ContentKeyPolicyX509CertificateTokenKey': 'ContentKeyPolicyX509CertificateTokenKey'} - } - - def __init__( - self, - **kwargs - ): - super(ContentKeyPolicyRestrictionTokenKey, self).__init__(**kwargs) - self.odata_type = None # type: Optional[str] - - -class ContentKeyPolicyRsaTokenKey(ContentKeyPolicyRestrictionTokenKey): - """Specifies a RSA key for token validation. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param exponent: Required. The RSA Parameter exponent. - :type exponent: bytearray - :param modulus: Required. The RSA Parameter modulus. - :type modulus: bytearray - """ - - _validation = { - 'odata_type': {'required': True}, - 'exponent': {'required': True}, - 'modulus': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'exponent': {'key': 'exponent', 'type': 'bytearray'}, - 'modulus': {'key': 'modulus', 'type': 'bytearray'}, - } - - def __init__( - self, - **kwargs - ): - super(ContentKeyPolicyRsaTokenKey, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.ContentKeyPolicyRsaTokenKey' # type: str - self.exponent = kwargs['exponent'] - self.modulus = kwargs['modulus'] - - -class ContentKeyPolicySymmetricTokenKey(ContentKeyPolicyRestrictionTokenKey): - """Specifies a symmetric key for token validation. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param key_value: Required. The key value of the key. - :type key_value: bytearray - """ - - _validation = { - 'odata_type': {'required': True}, - 'key_value': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'key_value': {'key': 'keyValue', 'type': 'bytearray'}, - } - - def __init__( - self, - **kwargs - ): - super(ContentKeyPolicySymmetricTokenKey, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.ContentKeyPolicySymmetricTokenKey' # type: str - self.key_value = kwargs['key_value'] - - -class ContentKeyPolicyTokenClaim(msrest.serialization.Model): - """Represents a token claim. - - :param claim_type: Token claim type. - :type claim_type: str - :param claim_value: Token claim value. - :type claim_value: str - """ - - _attribute_map = { - 'claim_type': {'key': 'claimType', 'type': 'str'}, - 'claim_value': {'key': 'claimValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ContentKeyPolicyTokenClaim, self).__init__(**kwargs) - self.claim_type = kwargs.get('claim_type', None) - self.claim_value = kwargs.get('claim_value', None) - - -class ContentKeyPolicyTokenRestriction(ContentKeyPolicyRestriction): - """Represents a token restriction. Provided token must match these requirements for successful license or key delivery. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param issuer: Required. The token issuer. - :type issuer: str - :param audience: Required. The audience for the token. - :type audience: str - :param primary_verification_key: Required. The primary verification key. - :type primary_verification_key: ~azure.mgmt.media.models.ContentKeyPolicyRestrictionTokenKey - :param alternate_verification_keys: A list of alternative verification keys. - :type alternate_verification_keys: - list[~azure.mgmt.media.models.ContentKeyPolicyRestrictionTokenKey] - :param required_claims: A list of required token claims. - :type required_claims: list[~azure.mgmt.media.models.ContentKeyPolicyTokenClaim] - :param restriction_token_type: Required. The type of token. Possible values include: "Unknown", - "Swt", "Jwt". - :type restriction_token_type: str or - ~azure.mgmt.media.models.ContentKeyPolicyRestrictionTokenType - :param open_id_connect_discovery_document: The OpenID connect discovery document. - :type open_id_connect_discovery_document: str - """ - - _validation = { - 'odata_type': {'required': True}, - 'issuer': {'required': True}, - 'audience': {'required': True}, - 'primary_verification_key': {'required': True}, - 'restriction_token_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'issuer': {'key': 'issuer', 'type': 'str'}, - 'audience': {'key': 'audience', 'type': 'str'}, - 'primary_verification_key': {'key': 'primaryVerificationKey', 'type': 'ContentKeyPolicyRestrictionTokenKey'}, - 'alternate_verification_keys': {'key': 'alternateVerificationKeys', 'type': '[ContentKeyPolicyRestrictionTokenKey]'}, - 'required_claims': {'key': 'requiredClaims', 'type': '[ContentKeyPolicyTokenClaim]'}, - 'restriction_token_type': {'key': 'restrictionTokenType', 'type': 'str'}, - 'open_id_connect_discovery_document': {'key': 'openIdConnectDiscoveryDocument', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ContentKeyPolicyTokenRestriction, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.ContentKeyPolicyTokenRestriction' # type: str - self.issuer = kwargs['issuer'] - self.audience = kwargs['audience'] - self.primary_verification_key = kwargs['primary_verification_key'] - self.alternate_verification_keys = kwargs.get('alternate_verification_keys', None) - self.required_claims = kwargs.get('required_claims', None) - self.restriction_token_type = kwargs['restriction_token_type'] - self.open_id_connect_discovery_document = kwargs.get('open_id_connect_discovery_document', None) - - -class ContentKeyPolicyUnknownConfiguration(ContentKeyPolicyConfiguration): - """Represents a ContentKeyPolicyConfiguration that is unavailable in the current API version. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ContentKeyPolicyUnknownConfiguration, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.ContentKeyPolicyUnknownConfiguration' # type: str - - -class ContentKeyPolicyUnknownRestriction(ContentKeyPolicyRestriction): - """Represents a ContentKeyPolicyRestriction that is unavailable in the current API version. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ContentKeyPolicyUnknownRestriction, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.ContentKeyPolicyUnknownRestriction' # type: str - - -class ContentKeyPolicyWidevineConfiguration(ContentKeyPolicyConfiguration): - """Specifies a configuration for Widevine licenses. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param widevine_template: Required. The Widevine template. - :type widevine_template: str - """ - - _validation = { - 'odata_type': {'required': True}, - 'widevine_template': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'widevine_template': {'key': 'widevineTemplate', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ContentKeyPolicyWidevineConfiguration, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.ContentKeyPolicyWidevineConfiguration' # type: str - self.widevine_template = kwargs['widevine_template'] - - -class ContentKeyPolicyX509CertificateTokenKey(ContentKeyPolicyRestrictionTokenKey): - """Specifies a certificate for token validation. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param raw_body: Required. The raw data field of a certificate in PKCS 12 format - (X509Certificate2 in .NET). - :type raw_body: bytearray - """ - - _validation = { - 'odata_type': {'required': True}, - 'raw_body': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'raw_body': {'key': 'rawBody', 'type': 'bytearray'}, - } - - def __init__( - self, - **kwargs - ): - super(ContentKeyPolicyX509CertificateTokenKey, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.ContentKeyPolicyX509CertificateTokenKey' # type: str - self.raw_body = kwargs['raw_body'] - - -class CopyAudio(Codec): - """A codec flag, which tells the encoder to copy the input audio bitstream. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param label: An optional label for the codec. The label can be used to control muxing - behavior. - :type label: str - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CopyAudio, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.CopyAudio' # type: str - - -class CopyVideo(Codec): - """A codec flag, which tells the encoder to copy the input video bitstream without re-encoding. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param label: An optional label for the codec. The label can be used to control muxing - behavior. - :type label: str - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CopyVideo, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.CopyVideo' # type: str - - -class CrossSiteAccessPolicies(msrest.serialization.Model): - """The client access policy. - - :param client_access_policy: The content of clientaccesspolicy.xml used by Silverlight. - :type client_access_policy: str - :param cross_domain_policy: The content of crossdomain.xml used by Silverlight. - :type cross_domain_policy: str - """ - - _attribute_map = { - 'client_access_policy': {'key': 'clientAccessPolicy', 'type': 'str'}, - 'cross_domain_policy': {'key': 'crossDomainPolicy', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CrossSiteAccessPolicies, self).__init__(**kwargs) - self.client_access_policy = kwargs.get('client_access_policy', None) - self.cross_domain_policy = kwargs.get('cross_domain_policy', None) - - -class DefaultKey(msrest.serialization.Model): - """Class to specify properties of default content key for each encryption scheme. - - :param label: Label can be used to specify Content Key when creating a Streaming Locator. - :type label: str - :param policy_name: Policy used by Default Key. - :type policy_name: str - """ - - _attribute_map = { - 'label': {'key': 'label', 'type': 'str'}, - 'policy_name': {'key': 'policyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DefaultKey, self).__init__(**kwargs) - self.label = kwargs.get('label', None) - self.policy_name = kwargs.get('policy_name', None) - - -class Deinterlace(msrest.serialization.Model): - """Describes the de-interlacing settings. - - :param parity: The field parity for de-interlacing, defaults to Auto. Possible values include: - "Auto", "TopFieldFirst", "BottomFieldFirst". - :type parity: str or ~azure.mgmt.media.models.DeinterlaceParity - :param mode: The deinterlacing mode. Defaults to AutoPixelAdaptive. Possible values include: - "Off", "AutoPixelAdaptive". - :type mode: str or ~azure.mgmt.media.models.DeinterlaceMode - """ - - _attribute_map = { - 'parity': {'key': 'parity', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Deinterlace, self).__init__(**kwargs) - self.parity = kwargs.get('parity', None) - self.mode = kwargs.get('mode', None) - - -class EdgePolicies(msrest.serialization.Model): - """EdgePolicies. - - :param usage_data_collection_policy: - :type usage_data_collection_policy: ~azure.mgmt.media.models.EdgeUsageDataCollectionPolicy - """ - - _attribute_map = { - 'usage_data_collection_policy': {'key': 'usageDataCollectionPolicy', 'type': 'EdgeUsageDataCollectionPolicy'}, - } - - def __init__( - self, - **kwargs - ): - super(EdgePolicies, self).__init__(**kwargs) - self.usage_data_collection_policy = kwargs.get('usage_data_collection_policy', None) - - -class EdgeUsageDataCollectionPolicy(msrest.serialization.Model): - """EdgeUsageDataCollectionPolicy. - - :param data_collection_frequency: Usage data collection frequency in ISO 8601 duration format - e.g. PT10M , PT5H. - :type data_collection_frequency: str - :param data_reporting_frequency: Usage data reporting frequency in ISO 8601 duration format - e.g. PT10M , PT5H. - :type data_reporting_frequency: str - :param max_allowed_unreported_usage_duration: Maximum time for which the functionality of the - device will not be hampered for not reporting the usage data. - :type max_allowed_unreported_usage_duration: str - :param event_hub_details: Details of Event Hub where the usage will be reported. - :type event_hub_details: ~azure.mgmt.media.models.EdgeUsageDataEventHub - """ - - _attribute_map = { - 'data_collection_frequency': {'key': 'dataCollectionFrequency', 'type': 'str'}, - 'data_reporting_frequency': {'key': 'dataReportingFrequency', 'type': 'str'}, - 'max_allowed_unreported_usage_duration': {'key': 'maxAllowedUnreportedUsageDuration', 'type': 'str'}, - 'event_hub_details': {'key': 'eventHubDetails', 'type': 'EdgeUsageDataEventHub'}, - } - - def __init__( - self, - **kwargs - ): - super(EdgeUsageDataCollectionPolicy, self).__init__(**kwargs) - self.data_collection_frequency = kwargs.get('data_collection_frequency', None) - self.data_reporting_frequency = kwargs.get('data_reporting_frequency', None) - self.max_allowed_unreported_usage_duration = kwargs.get('max_allowed_unreported_usage_duration', None) - self.event_hub_details = kwargs.get('event_hub_details', None) - - -class EdgeUsageDataEventHub(msrest.serialization.Model): - """EdgeUsageDataEventHub. - - :param name: Name of the Event Hub where usage will be reported. - :type name: str - :param namespace: Namespace of the Event Hub where usage will be reported. - :type namespace: str - :param token: SAS token needed to interact with Event Hub. - :type token: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'token': {'key': 'token', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EdgeUsageDataEventHub, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.namespace = kwargs.get('namespace', None) - self.token = kwargs.get('token', None) - - -class EnabledProtocols(msrest.serialization.Model): - """Class to specify which protocols are enabled. - - All required parameters must be populated in order to send to Azure. - - :param download: Required. Enable Download protocol or not. - :type download: bool - :param dash: Required. Enable DASH protocol or not. - :type dash: bool - :param hls: Required. Enable HLS protocol or not. - :type hls: bool - :param smooth_streaming: Required. Enable SmoothStreaming protocol or not. - :type smooth_streaming: bool - """ - - _validation = { - 'download': {'required': True}, - 'dash': {'required': True}, - 'hls': {'required': True}, - 'smooth_streaming': {'required': True}, - } - - _attribute_map = { - 'download': {'key': 'download', 'type': 'bool'}, - 'dash': {'key': 'dash', 'type': 'bool'}, - 'hls': {'key': 'hls', 'type': 'bool'}, - 'smooth_streaming': {'key': 'smoothStreaming', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(EnabledProtocols, self).__init__(**kwargs) - self.download = kwargs['download'] - self.dash = kwargs['dash'] - self.hls = kwargs['hls'] - self.smooth_streaming = kwargs['smooth_streaming'] - - -class EntityNameAvailabilityCheckOutput(msrest.serialization.Model): - """The response from the check name availability request. - - All required parameters must be populated in order to send to Azure. - - :param name_available: Required. Specifies if the name is available. - :type name_available: bool - :param reason: Specifies the reason if the name is not available. - :type reason: str - :param message: Specifies the detailed reason if the name is not available. - :type message: str - """ - - _validation = { - 'name_available': {'required': True}, - } - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EntityNameAvailabilityCheckOutput, self).__init__(**kwargs) - self.name_available = kwargs['name_available'] - self.reason = kwargs.get('reason', None) - self.message = kwargs.get('message', None) - - -class EnvelopeEncryption(msrest.serialization.Model): - """Class for EnvelopeEncryption encryption scheme. - - :param enabled_protocols: Representing supported protocols. - :type enabled_protocols: ~azure.mgmt.media.models.EnabledProtocols - :param clear_tracks: Representing which tracks should not be encrypted. - :type clear_tracks: list[~azure.mgmt.media.models.TrackSelection] - :param content_keys: Representing default content key for each encryption scheme and separate - content keys for specific tracks. - :type content_keys: ~azure.mgmt.media.models.StreamingPolicyContentKeys - :param custom_key_acquisition_url_template: Template for the URL of the custom service - delivering keys to end user players. Not required when using Azure Media Services for issuing - keys. The template supports replaceable tokens that the service will update at runtime with - the value specific to the request. The currently supported token values are - {AlternativeMediaId}, which is replaced with the value of - StreamingLocatorId.AlternativeMediaId, and {ContentKeyId}, which is replaced with the value of - identifier of the key being requested. - :type custom_key_acquisition_url_template: str - """ - - _attribute_map = { - 'enabled_protocols': {'key': 'enabledProtocols', 'type': 'EnabledProtocols'}, - 'clear_tracks': {'key': 'clearTracks', 'type': '[TrackSelection]'}, - 'content_keys': {'key': 'contentKeys', 'type': 'StreamingPolicyContentKeys'}, - 'custom_key_acquisition_url_template': {'key': 'customKeyAcquisitionUrlTemplate', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EnvelopeEncryption, self).__init__(**kwargs) - self.enabled_protocols = kwargs.get('enabled_protocols', None) - self.clear_tracks = kwargs.get('clear_tracks', None) - self.content_keys = kwargs.get('content_keys', None) - self.custom_key_acquisition_url_template = kwargs.get('custom_key_acquisition_url_template', None) - - -class ErrorAdditionalInfo(msrest.serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: any - """ - - _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorAdditionalInfo, self).__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(msrest.serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.mgmt.media.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.media.models.ErrorAdditionalInfo] - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetail]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorDetail, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -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: ~azure.mgmt.media.models.ErrorDetail - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class FaceDetectorPreset(Preset): - """Describes all the settings to be used when analyzing a video in order to detect (and optionally redact) all the faces present. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param resolution: Specifies the maximum resolution at which your video is analyzed. The - default behavior is "SourceResolution," which will keep the input video at its original - resolution when analyzed. Using "StandardDefinition" will resize input videos to standard - definition while preserving the appropriate aspect ratio. It will only resize if the video is - of higher resolution. For example, a 1920x1080 input would be scaled to 640x360 before - processing. Switching to "StandardDefinition" will reduce the time it takes to process high - resolution video. It may also reduce the cost of using this component (see - https://azure.microsoft.com/en-us/pricing/details/media-services/#analytics for details). - However, faces that end up being too small in the resized video may not be detected. Possible - values include: "SourceResolution", "StandardDefinition". - :type resolution: str or ~azure.mgmt.media.models.AnalysisResolution - :param mode: This mode provides the ability to choose between the following settings: 1) - Analyze - For detection only.This mode generates a metadata JSON file marking appearances of - faces throughout the video.Where possible, appearances of the same person are assigned the same - ID. 2) Combined - Additionally redacts(blurs) detected faces. 3) Redact - This enables a 2-pass - process, allowing for selective redaction of a subset of detected faces.It takes in the - metadata file from a prior analyze pass, along with the source video, and a user-selected - subset of IDs that require redaction. Possible values include: "Analyze", "Redact", "Combined". - :type mode: str or ~azure.mgmt.media.models.FaceRedactorMode - :param blur_type: Blur type. Possible values include: "Box", "Low", "Med", "High", "Black". - :type blur_type: str or ~azure.mgmt.media.models.BlurType - :param experimental_options: Dictionary containing key value pairs for parameters not exposed - in the preset itself. - :type experimental_options: dict[str, str] - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'resolution': {'key': 'resolution', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'blur_type': {'key': 'blurType', 'type': 'str'}, - 'experimental_options': {'key': 'experimentalOptions', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(FaceDetectorPreset, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.FaceDetectorPreset' # type: str - self.resolution = kwargs.get('resolution', None) - self.mode = kwargs.get('mode', None) - self.blur_type = kwargs.get('blur_type', None) - self.experimental_options = kwargs.get('experimental_options', None) - - -class Filters(msrest.serialization.Model): - """Describes all the filtering operations, such as de-interlacing, rotation etc. that are to be applied to the input media before encoding. - - :param deinterlace: The de-interlacing settings. - :type deinterlace: ~azure.mgmt.media.models.Deinterlace - :param rotation: The rotation, if any, to be applied to the input video, before it is encoded. - Default is Auto. Possible values include: "Auto", "None", "Rotate0", "Rotate90", "Rotate180", - "Rotate270". - :type rotation: str or ~azure.mgmt.media.models.Rotation - :param crop: The parameters for the rectangular window with which to crop the input video. - :type crop: ~azure.mgmt.media.models.Rectangle - :param overlays: The properties of overlays to be applied to the input video. These could be - audio, image or video overlays. - :type overlays: list[~azure.mgmt.media.models.Overlay] - """ - - _attribute_map = { - 'deinterlace': {'key': 'deinterlace', 'type': 'Deinterlace'}, - 'rotation': {'key': 'rotation', 'type': 'str'}, - 'crop': {'key': 'crop', 'type': 'Rectangle'}, - 'overlays': {'key': 'overlays', 'type': '[Overlay]'}, - } - - def __init__( - self, - **kwargs - ): - super(Filters, self).__init__(**kwargs) - self.deinterlace = kwargs.get('deinterlace', None) - self.rotation = kwargs.get('rotation', None) - self.crop = kwargs.get('crop', None) - self.overlays = kwargs.get('overlays', None) - - -class FilterTrackPropertyCondition(msrest.serialization.Model): - """The class to specify one track property condition. - - All required parameters must be populated in order to send to Azure. - - :param property: Required. The track property type. Possible values include: "Unknown", "Type", - "Name", "Language", "FourCC", "Bitrate". - :type property: str or ~azure.mgmt.media.models.FilterTrackPropertyType - :param value: Required. The track property value. - :type value: str - :param operation: Required. The track property condition operation. Possible values include: - "Equal", "NotEqual". - :type operation: str or ~azure.mgmt.media.models.FilterTrackPropertyCompareOperation - """ - - _validation = { - 'property': {'required': True}, - 'value': {'required': True}, - 'operation': {'required': True}, - } - - _attribute_map = { - 'property': {'key': 'property', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FilterTrackPropertyCondition, self).__init__(**kwargs) - self.property = kwargs['property'] - self.value = kwargs['value'] - self.operation = kwargs['operation'] - - -class FilterTrackSelection(msrest.serialization.Model): - """Representing a list of FilterTrackPropertyConditions to select a track. The filters are combined using a logical AND operation. - - All required parameters must be populated in order to send to Azure. - - :param track_selections: Required. The track selections. - :type track_selections: list[~azure.mgmt.media.models.FilterTrackPropertyCondition] - """ - - _validation = { - 'track_selections': {'required': True}, - } - - _attribute_map = { - 'track_selections': {'key': 'trackSelections', 'type': '[FilterTrackPropertyCondition]'}, - } - - def __init__( - self, - **kwargs - ): - super(FilterTrackSelection, self).__init__(**kwargs) - self.track_selections = kwargs['track_selections'] - - -class FirstQuality(msrest.serialization.Model): - """Filter First Quality. - - All required parameters must be populated in order to send to Azure. - - :param bitrate: Required. The first quality bitrate. - :type bitrate: int - """ - - _validation = { - 'bitrate': {'required': True}, - } - - _attribute_map = { - 'bitrate': {'key': 'bitrate', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(FirstQuality, self).__init__(**kwargs) - self.bitrate = kwargs['bitrate'] - - -class Format(msrest.serialization.Model): - """Base class for output. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ImageFormat, MultiBitrateFormat. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param filename_pattern: Required. The pattern of the file names for the generated output - files. The following macros are supported in the file name: {Basename} - An expansion macro - that will use the name of the input video file. If the base name(the file suffix is not - included) of the input video file is less than 32 characters long, the base name of input video - files will be used. If the length of base name of the input video file exceeds 32 characters, - the base name is truncated to the first 32 characters in total length. {Extension} - The - appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - - A unique index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video - bitrate. Not applicable to thumbnails. {Codec} - The type of the audio/video codec. - {Resolution} - The video resolution. Any unsubstituted macros will be collapsed and removed - from the filename. - :type filename_pattern: str - """ - - _validation = { - 'odata_type': {'required': True}, - 'filename_pattern': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'filename_pattern': {'key': 'filenamePattern', 'type': 'str'}, - } - - _subtype_map = { - 'odata_type': {'#Microsoft.Media.ImageFormat': 'ImageFormat', '#Microsoft.Media.MultiBitrateFormat': 'MultiBitrateFormat'} - } - - def __init__( - self, - **kwargs - ): - super(Format, self).__init__(**kwargs) - self.odata_type = None # type: Optional[str] - self.filename_pattern = kwargs['filename_pattern'] - - -class InputDefinition(msrest.serialization.Model): - """Base class for defining an input. Use sub classes of this class to specify tracks selections and related metadata. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: FromAllInputFile, FromEachInputFile, InputFile. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param included_tracks: The list of TrackDescriptors which define the metadata and selection of - tracks in the input. - :type included_tracks: list[~azure.mgmt.media.models.TrackDescriptor] - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'included_tracks': {'key': 'includedTracks', 'type': '[TrackDescriptor]'}, - } - - _subtype_map = { - 'odata_type': {'#Microsoft.Media.FromAllInputFile': 'FromAllInputFile', '#Microsoft.Media.FromEachInputFile': 'FromEachInputFile', '#Microsoft.Media.InputFile': 'InputFile'} - } - - def __init__( - self, - **kwargs - ): - super(InputDefinition, self).__init__(**kwargs) - self.odata_type = None # type: Optional[str] - self.included_tracks = kwargs.get('included_tracks', None) - - -class FromAllInputFile(InputDefinition): - """An InputDefinition that looks across all of the files provided to select tracks specified by the IncludedTracks property. Generally used with the AudioTrackByAttribute and VideoTrackByAttribute to allow selection of a single track across a set of input files. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param included_tracks: The list of TrackDescriptors which define the metadata and selection of - tracks in the input. - :type included_tracks: list[~azure.mgmt.media.models.TrackDescriptor] - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'included_tracks': {'key': 'includedTracks', 'type': '[TrackDescriptor]'}, - } - - def __init__( - self, - **kwargs - ): - super(FromAllInputFile, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.FromAllInputFile' # type: str - - -class FromEachInputFile(InputDefinition): - """An InputDefinition that looks at each input file provided to select tracks specified by the IncludedTracks property. Generally used with the AudioTrackByAttribute and VideoTrackByAttribute to select tracks from each file given. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param included_tracks: The list of TrackDescriptors which define the metadata and selection of - tracks in the input. - :type included_tracks: list[~azure.mgmt.media.models.TrackDescriptor] - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'included_tracks': {'key': 'includedTracks', 'type': '[TrackDescriptor]'}, - } - - def __init__( - self, - **kwargs - ): - super(FromEachInputFile, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.FromEachInputFile' # type: str - - -class Layer(msrest.serialization.Model): - """The encoder can be configured to produce video and/or images (thumbnails) at different resolutions, by specifying a layer for each desired resolution. A layer represents the properties for the video or image at a resolution. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: H265VideoLayer, JpgLayer, PngLayer, VideoLayer. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param width: The width of the output video for this layer. The value can be absolute (in - pixels) or relative (in percentage). For example 50% means the output video has half as many - pixels in width as the input. - :type width: str - :param height: The height of the output video for this layer. The value can be absolute (in - pixels) or relative (in percentage). For example 50% means the output video has half as many - pixels in height as the input. - :type height: str - :param label: The alphanumeric label for this layer, which can be used in multiplexing - different video and audio layers, or in naming the output file. - :type label: str - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'width': {'key': 'width', 'type': 'str'}, - 'height': {'key': 'height', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - } - - _subtype_map = { - 'odata_type': {'#Microsoft.Media.H265VideoLayer': 'H265VideoLayer', '#Microsoft.Media.JpgLayer': 'JpgLayer', '#Microsoft.Media.PngLayer': 'PngLayer', '#Microsoft.Media.VideoLayer': 'VideoLayer'} - } - - def __init__( - self, - **kwargs - ): - super(Layer, self).__init__(**kwargs) - self.odata_type = None # type: Optional[str] - self.width = kwargs.get('width', None) - self.height = kwargs.get('height', None) - self.label = kwargs.get('label', None) - - -class VideoLayer(Layer): - """Describes the settings to be used when encoding the input video into a desired output bitrate layer. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: H264Layer. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param width: The width of the output video for this layer. The value can be absolute (in - pixels) or relative (in percentage). For example 50% means the output video has half as many - pixels in width as the input. - :type width: str - :param height: The height of the output video for this layer. The value can be absolute (in - pixels) or relative (in percentage). For example 50% means the output video has half as many - pixels in height as the input. - :type height: str - :param label: The alphanumeric label for this layer, which can be used in multiplexing - different video and audio layers, or in naming the output file. - :type label: str - :param bitrate: Required. The average bitrate in bits per second at which to encode the input - video when generating this layer. This is a required field. - :type bitrate: int - :param max_bitrate: The maximum bitrate (in bits per second), at which the VBV buffer should be - assumed to refill. If not specified, defaults to the same value as bitrate. - :type max_bitrate: int - :param b_frames: The number of B-frames to be used when encoding this layer. If not specified, - the encoder chooses an appropriate number based on the video profile and level. - :type b_frames: int - :param frame_rate: The frame rate (in frames per second) at which to encode this layer. The - value can be in the form of M/N where M and N are integers (For example, 30000/1001), or in the - form of a number (For example, 30, or 29.97). The encoder enforces constraints on allowed frame - rates based on the profile and level. If it is not specified, the encoder will use the same - frame rate as the input video. - :type frame_rate: str - :param slices: The number of slices to be used when encoding this layer. If not specified, - default is zero, which means that encoder will use a single slice for each frame. - :type slices: int - :param adaptive_b_frame: Whether or not adaptive B-frames are to be used when encoding this - layer. If not specified, the encoder will turn it on whenever the video profile permits its - use. - :type adaptive_b_frame: bool - """ - - _validation = { - 'odata_type': {'required': True}, - 'bitrate': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'width': {'key': 'width', 'type': 'str'}, - 'height': {'key': 'height', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'bitrate': {'key': 'bitrate', 'type': 'int'}, - 'max_bitrate': {'key': 'maxBitrate', 'type': 'int'}, - 'b_frames': {'key': 'bFrames', 'type': 'int'}, - 'frame_rate': {'key': 'frameRate', 'type': 'str'}, - 'slices': {'key': 'slices', 'type': 'int'}, - 'adaptive_b_frame': {'key': 'adaptiveBFrame', 'type': 'bool'}, - } - - _subtype_map = { - 'odata_type': {'#Microsoft.Media.H264Layer': 'H264Layer'} - } - - def __init__( - self, - **kwargs - ): - super(VideoLayer, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.VideoLayer' # type: str - self.bitrate = kwargs['bitrate'] - self.max_bitrate = kwargs.get('max_bitrate', None) - self.b_frames = kwargs.get('b_frames', None) - self.frame_rate = kwargs.get('frame_rate', None) - self.slices = kwargs.get('slices', None) - self.adaptive_b_frame = kwargs.get('adaptive_b_frame', None) - - -class H264Layer(VideoLayer): - """Describes the settings to be used when encoding the input video into a desired output bitrate layer with the H.264 video codec. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param width: The width of the output video for this layer. The value can be absolute (in - pixels) or relative (in percentage). For example 50% means the output video has half as many - pixels in width as the input. - :type width: str - :param height: The height of the output video for this layer. The value can be absolute (in - pixels) or relative (in percentage). For example 50% means the output video has half as many - pixels in height as the input. - :type height: str - :param label: The alphanumeric label for this layer, which can be used in multiplexing - different video and audio layers, or in naming the output file. - :type label: str - :param bitrate: Required. The average bitrate in bits per second at which to encode the input - video when generating this layer. This is a required field. - :type bitrate: int - :param max_bitrate: The maximum bitrate (in bits per second), at which the VBV buffer should be - assumed to refill. If not specified, defaults to the same value as bitrate. - :type max_bitrate: int - :param b_frames: The number of B-frames to be used when encoding this layer. If not specified, - the encoder chooses an appropriate number based on the video profile and level. - :type b_frames: int - :param frame_rate: The frame rate (in frames per second) at which to encode this layer. The - value can be in the form of M/N where M and N are integers (For example, 30000/1001), or in the - form of a number (For example, 30, or 29.97). The encoder enforces constraints on allowed frame - rates based on the profile and level. If it is not specified, the encoder will use the same - frame rate as the input video. - :type frame_rate: str - :param slices: The number of slices to be used when encoding this layer. If not specified, - default is zero, which means that encoder will use a single slice for each frame. - :type slices: int - :param adaptive_b_frame: Whether or not adaptive B-frames are to be used when encoding this - layer. If not specified, the encoder will turn it on whenever the video profile permits its - use. - :type adaptive_b_frame: bool - :param profile: We currently support Baseline, Main, High, High422, High444. Default is Auto. - Possible values include: "Auto", "Baseline", "Main", "High", "High422", "High444". - :type profile: str or ~azure.mgmt.media.models.H264VideoProfile - :param level: We currently support Level up to 6.2. The value can be Auto, or a number that - matches the H.264 profile. If not specified, the default is Auto, which lets the encoder choose - the Level that is appropriate for this layer. - :type level: str - :param buffer_window: The VBV buffer window length. The value should be in ISO 8601 format. The - value should be in the range [0.1-100] seconds. The default is 5 seconds (for example, PT5S). - :type buffer_window: ~datetime.timedelta - :param reference_frames: The number of reference frames to be used when encoding this layer. If - not specified, the encoder determines an appropriate number based on the encoder complexity - setting. - :type reference_frames: int - :param entropy_mode: The entropy mode to be used for this layer. If not specified, the encoder - chooses the mode that is appropriate for the profile and level. Possible values include: - "Cabac", "Cavlc". - :type entropy_mode: str or ~azure.mgmt.media.models.EntropyMode - """ - - _validation = { - 'odata_type': {'required': True}, - 'bitrate': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'width': {'key': 'width', 'type': 'str'}, - 'height': {'key': 'height', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'bitrate': {'key': 'bitrate', 'type': 'int'}, - 'max_bitrate': {'key': 'maxBitrate', 'type': 'int'}, - 'b_frames': {'key': 'bFrames', 'type': 'int'}, - 'frame_rate': {'key': 'frameRate', 'type': 'str'}, - 'slices': {'key': 'slices', 'type': 'int'}, - 'adaptive_b_frame': {'key': 'adaptiveBFrame', 'type': 'bool'}, - 'profile': {'key': 'profile', 'type': 'str'}, - 'level': {'key': 'level', 'type': 'str'}, - 'buffer_window': {'key': 'bufferWindow', 'type': 'duration'}, - 'reference_frames': {'key': 'referenceFrames', 'type': 'int'}, - 'entropy_mode': {'key': 'entropyMode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(H264Layer, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.H264Layer' # type: str - self.profile = kwargs.get('profile', None) - self.level = kwargs.get('level', None) - self.buffer_window = kwargs.get('buffer_window', None) - self.reference_frames = kwargs.get('reference_frames', None) - self.entropy_mode = kwargs.get('entropy_mode', None) - - -class Video(Codec): - """Describes the basic properties for encoding the input video. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: H264Video, H265Video, Image. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param label: An optional label for the codec. The label can be used to control muxing - behavior. - :type label: str - :param key_frame_interval: The distance between two key frames. The value should be non-zero in - the range [0.5, 20] seconds, specified in ISO 8601 format. The default is 2 seconds(PT2S). Note - that this setting is ignored if VideoSyncMode.Passthrough is set, where the KeyFrameInterval - value will follow the input source setting. - :type key_frame_interval: ~datetime.timedelta - :param stretch_mode: The resizing mode - how the input video will be resized to fit the desired - output resolution(s). Default is AutoSize. Possible values include: "None", "AutoSize", - "AutoFit". - :type stretch_mode: str or ~azure.mgmt.media.models.StretchMode - :param sync_mode: The Video Sync Mode. Possible values include: "Auto", "Passthrough", "Cfr", - "Vfr". - :type sync_mode: str or ~azure.mgmt.media.models.VideoSyncMode - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'key_frame_interval': {'key': 'keyFrameInterval', 'type': 'duration'}, - 'stretch_mode': {'key': 'stretchMode', 'type': 'str'}, - 'sync_mode': {'key': 'syncMode', 'type': 'str'}, - } - - _subtype_map = { - 'odata_type': {'#Microsoft.Media.H264Video': 'H264Video', '#Microsoft.Media.H265Video': 'H265Video', '#Microsoft.Media.Image': 'Image'} - } - - def __init__( - self, - **kwargs - ): - super(Video, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.Video' # type: str - self.key_frame_interval = kwargs.get('key_frame_interval', None) - self.stretch_mode = kwargs.get('stretch_mode', None) - self.sync_mode = kwargs.get('sync_mode', None) - - -class H264Video(Video): - """Describes all the properties for encoding a video with the H.264 codec. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param label: An optional label for the codec. The label can be used to control muxing - behavior. - :type label: str - :param key_frame_interval: The distance between two key frames. The value should be non-zero in - the range [0.5, 20] seconds, specified in ISO 8601 format. The default is 2 seconds(PT2S). Note - that this setting is ignored if VideoSyncMode.Passthrough is set, where the KeyFrameInterval - value will follow the input source setting. - :type key_frame_interval: ~datetime.timedelta - :param stretch_mode: The resizing mode - how the input video will be resized to fit the desired - output resolution(s). Default is AutoSize. Possible values include: "None", "AutoSize", - "AutoFit". - :type stretch_mode: str or ~azure.mgmt.media.models.StretchMode - :param sync_mode: The Video Sync Mode. Possible values include: "Auto", "Passthrough", "Cfr", - "Vfr". - :type sync_mode: str or ~azure.mgmt.media.models.VideoSyncMode - :param scene_change_detection: Whether or not the encoder should insert key frames at scene - changes. If not specified, the default is false. This flag should be set to true only when the - encoder is being configured to produce a single output video. - :type scene_change_detection: bool - :param complexity: Tells the encoder how to choose its encoding settings. The default value is - Balanced. Possible values include: "Speed", "Balanced", "Quality". - :type complexity: str or ~azure.mgmt.media.models.H264Complexity - :param layers: The collection of output H.264 layers to be produced by the encoder. - :type layers: list[~azure.mgmt.media.models.H264Layer] - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'key_frame_interval': {'key': 'keyFrameInterval', 'type': 'duration'}, - 'stretch_mode': {'key': 'stretchMode', 'type': 'str'}, - 'sync_mode': {'key': 'syncMode', 'type': 'str'}, - 'scene_change_detection': {'key': 'sceneChangeDetection', 'type': 'bool'}, - 'complexity': {'key': 'complexity', 'type': 'str'}, - 'layers': {'key': 'layers', 'type': '[H264Layer]'}, - } - - def __init__( - self, - **kwargs - ): - super(H264Video, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.H264Video' # type: str - self.scene_change_detection = kwargs.get('scene_change_detection', None) - self.complexity = kwargs.get('complexity', None) - self.layers = kwargs.get('layers', None) - - -class H265VideoLayer(Layer): - """Describes the settings to be used when encoding the input video into a desired output bitrate layer. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: H265Layer. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param width: The width of the output video for this layer. The value can be absolute (in - pixels) or relative (in percentage). For example 50% means the output video has half as many - pixels in width as the input. - :type width: str - :param height: The height of the output video for this layer. The value can be absolute (in - pixels) or relative (in percentage). For example 50% means the output video has half as many - pixels in height as the input. - :type height: str - :param label: The alphanumeric label for this layer, which can be used in multiplexing - different video and audio layers, or in naming the output file. - :type label: str - :param bitrate: Required. The average bitrate in bits per second at which to encode the input - video when generating this layer. For example: a target bitrate of 3000Kbps or 3Mbps means this - value should be 3000000 This is a required field. - :type bitrate: int - :param max_bitrate: The maximum bitrate (in bits per second), at which the VBV buffer should be - assumed to refill. If not specified, defaults to the same value as bitrate. - :type max_bitrate: int - :param b_frames: The number of B-frames to be used when encoding this layer. If not specified, - the encoder chooses an appropriate number based on the video profile and level. - :type b_frames: int - :param frame_rate: The frame rate (in frames per second) at which to encode this layer. The - value can be in the form of M/N where M and N are integers (For example, 30000/1001), or in the - form of a number (For example, 30, or 29.97). The encoder enforces constraints on allowed frame - rates based on the profile and level. If it is not specified, the encoder will use the same - frame rate as the input video. - :type frame_rate: str - :param slices: The number of slices to be used when encoding this layer. If not specified, - default is zero, which means that encoder will use a single slice for each frame. - :type slices: int - :param adaptive_b_frame: Specifies whether or not adaptive B-frames are to be used when - encoding this layer. If not specified, the encoder will turn it on whenever the video profile - permits its use. - :type adaptive_b_frame: bool - """ - - _validation = { - 'odata_type': {'required': True}, - 'bitrate': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'width': {'key': 'width', 'type': 'str'}, - 'height': {'key': 'height', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'bitrate': {'key': 'bitrate', 'type': 'int'}, - 'max_bitrate': {'key': 'maxBitrate', 'type': 'int'}, - 'b_frames': {'key': 'bFrames', 'type': 'int'}, - 'frame_rate': {'key': 'frameRate', 'type': 'str'}, - 'slices': {'key': 'slices', 'type': 'int'}, - 'adaptive_b_frame': {'key': 'adaptiveBFrame', 'type': 'bool'}, - } - - _subtype_map = { - 'odata_type': {'#Microsoft.Media.H265Layer': 'H265Layer'} - } - - def __init__( - self, - **kwargs - ): - super(H265VideoLayer, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.H265VideoLayer' # type: str - self.bitrate = kwargs['bitrate'] - self.max_bitrate = kwargs.get('max_bitrate', None) - self.b_frames = kwargs.get('b_frames', None) - self.frame_rate = kwargs.get('frame_rate', None) - self.slices = kwargs.get('slices', None) - self.adaptive_b_frame = kwargs.get('adaptive_b_frame', None) - - -class H265Layer(H265VideoLayer): - """Describes the settings to be used when encoding the input video into a desired output bitrate layer with the H.265 video codec. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param width: The width of the output video for this layer. The value can be absolute (in - pixels) or relative (in percentage). For example 50% means the output video has half as many - pixels in width as the input. - :type width: str - :param height: The height of the output video for this layer. The value can be absolute (in - pixels) or relative (in percentage). For example 50% means the output video has half as many - pixels in height as the input. - :type height: str - :param label: The alphanumeric label for this layer, which can be used in multiplexing - different video and audio layers, or in naming the output file. - :type label: str - :param bitrate: Required. The average bitrate in bits per second at which to encode the input - video when generating this layer. For example: a target bitrate of 3000Kbps or 3Mbps means this - value should be 3000000 This is a required field. - :type bitrate: int - :param max_bitrate: The maximum bitrate (in bits per second), at which the VBV buffer should be - assumed to refill. If not specified, defaults to the same value as bitrate. - :type max_bitrate: int - :param b_frames: The number of B-frames to be used when encoding this layer. If not specified, - the encoder chooses an appropriate number based on the video profile and level. - :type b_frames: int - :param frame_rate: The frame rate (in frames per second) at which to encode this layer. The - value can be in the form of M/N where M and N are integers (For example, 30000/1001), or in the - form of a number (For example, 30, or 29.97). The encoder enforces constraints on allowed frame - rates based on the profile and level. If it is not specified, the encoder will use the same - frame rate as the input video. - :type frame_rate: str - :param slices: The number of slices to be used when encoding this layer. If not specified, - default is zero, which means that encoder will use a single slice for each frame. - :type slices: int - :param adaptive_b_frame: Specifies whether or not adaptive B-frames are to be used when - encoding this layer. If not specified, the encoder will turn it on whenever the video profile - permits its use. - :type adaptive_b_frame: bool - :param profile: We currently support Main. Default is Auto. Possible values include: "Auto", - "Main". - :type profile: str or ~azure.mgmt.media.models.H265VideoProfile - :param level: We currently support Level up to 6.2. The value can be Auto, or a number that - matches the H.265 profile. If not specified, the default is Auto, which lets the encoder choose - the Level that is appropriate for this layer. - :type level: str - :param buffer_window: The VBV buffer window length. The value should be in ISO 8601 format. The - value should be in the range [0.1-100] seconds. The default is 5 seconds (for example, PT5S). - :type buffer_window: ~datetime.timedelta - :param reference_frames: The number of reference frames to be used when encoding this layer. If - not specified, the encoder determines an appropriate number based on the encoder complexity - setting. - :type reference_frames: int - """ - - _validation = { - 'odata_type': {'required': True}, - 'bitrate': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'width': {'key': 'width', 'type': 'str'}, - 'height': {'key': 'height', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'bitrate': {'key': 'bitrate', 'type': 'int'}, - 'max_bitrate': {'key': 'maxBitrate', 'type': 'int'}, - 'b_frames': {'key': 'bFrames', 'type': 'int'}, - 'frame_rate': {'key': 'frameRate', 'type': 'str'}, - 'slices': {'key': 'slices', 'type': 'int'}, - 'adaptive_b_frame': {'key': 'adaptiveBFrame', 'type': 'bool'}, - 'profile': {'key': 'profile', 'type': 'str'}, - 'level': {'key': 'level', 'type': 'str'}, - 'buffer_window': {'key': 'bufferWindow', 'type': 'duration'}, - 'reference_frames': {'key': 'referenceFrames', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(H265Layer, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.H265Layer' # type: str - self.profile = kwargs.get('profile', None) - self.level = kwargs.get('level', None) - self.buffer_window = kwargs.get('buffer_window', None) - self.reference_frames = kwargs.get('reference_frames', None) - - -class H265Video(Video): - """Describes all the properties for encoding a video with the H.265 codec. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param label: An optional label for the codec. The label can be used to control muxing - behavior. - :type label: str - :param key_frame_interval: The distance between two key frames. The value should be non-zero in - the range [0.5, 20] seconds, specified in ISO 8601 format. The default is 2 seconds(PT2S). Note - that this setting is ignored if VideoSyncMode.Passthrough is set, where the KeyFrameInterval - value will follow the input source setting. - :type key_frame_interval: ~datetime.timedelta - :param stretch_mode: The resizing mode - how the input video will be resized to fit the desired - output resolution(s). Default is AutoSize. Possible values include: "None", "AutoSize", - "AutoFit". - :type stretch_mode: str or ~azure.mgmt.media.models.StretchMode - :param sync_mode: The Video Sync Mode. Possible values include: "Auto", "Passthrough", "Cfr", - "Vfr". - :type sync_mode: str or ~azure.mgmt.media.models.VideoSyncMode - :param scene_change_detection: Specifies whether or not the encoder should insert key frames at - scene changes. If not specified, the default is false. This flag should be set to true only - when the encoder is being configured to produce a single output video. - :type scene_change_detection: bool - :param complexity: Tells the encoder how to choose its encoding settings. Quality will provide - for a higher compression ratio but at a higher cost and longer compute time. Speed will - produce a relatively larger file but is faster and more economical. The default value is - Balanced. Possible values include: "Speed", "Balanced", "Quality". - :type complexity: str or ~azure.mgmt.media.models.H265Complexity - :param layers: The collection of output H.265 layers to be produced by the encoder. - :type layers: list[~azure.mgmt.media.models.H265Layer] - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'key_frame_interval': {'key': 'keyFrameInterval', 'type': 'duration'}, - 'stretch_mode': {'key': 'stretchMode', 'type': 'str'}, - 'sync_mode': {'key': 'syncMode', 'type': 'str'}, - 'scene_change_detection': {'key': 'sceneChangeDetection', 'type': 'bool'}, - 'complexity': {'key': 'complexity', 'type': 'str'}, - 'layers': {'key': 'layers', 'type': '[H265Layer]'}, - } - - def __init__( - self, - **kwargs - ): - super(H265Video, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.H265Video' # type: str - self.scene_change_detection = kwargs.get('scene_change_detection', None) - self.complexity = kwargs.get('complexity', None) - self.layers = kwargs.get('layers', None) - - -class Hls(msrest.serialization.Model): - """HTTP Live Streaming (HLS) packing setting for the live output. - - :param fragments_per_ts_segment: The number of fragments in an HTTP Live Streaming (HLS) TS - segment in the output of the live event. This value does not affect the packing ratio for HLS - CMAF output. - :type fragments_per_ts_segment: int - """ - - _attribute_map = { - 'fragments_per_ts_segment': {'key': 'fragmentsPerTsSegment', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(Hls, self).__init__(**kwargs) - self.fragments_per_ts_segment = kwargs.get('fragments_per_ts_segment', None) - - -class Image(Video): - """Describes the basic properties for generating thumbnails from the input video. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: JpgImage, PngImage. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param label: An optional label for the codec. The label can be used to control muxing - behavior. - :type label: str - :param key_frame_interval: The distance between two key frames. The value should be non-zero in - the range [0.5, 20] seconds, specified in ISO 8601 format. The default is 2 seconds(PT2S). Note - that this setting is ignored if VideoSyncMode.Passthrough is set, where the KeyFrameInterval - value will follow the input source setting. - :type key_frame_interval: ~datetime.timedelta - :param stretch_mode: The resizing mode - how the input video will be resized to fit the desired - output resolution(s). Default is AutoSize. Possible values include: "None", "AutoSize", - "AutoFit". - :type stretch_mode: str or ~azure.mgmt.media.models.StretchMode - :param sync_mode: The Video Sync Mode. Possible values include: "Auto", "Passthrough", "Cfr", - "Vfr". - :type sync_mode: str or ~azure.mgmt.media.models.VideoSyncMode - :param start: Required. The position in the input video from where to start generating - thumbnails. The value can be in ISO 8601 format (For example, PT05S to start at 5 seconds), or - a frame count (For example, 10 to start at the 10th frame), or a relative value to stream - duration (For example, 10% to start at 10% of stream duration). Also supports a macro {Best}, - which tells the encoder to select the best thumbnail from the first few seconds of the video - and will only produce one thumbnail, no matter what other settings are for Step and Range. The - default value is macro {Best}. - :type start: str - :param step: The intervals at which thumbnails are generated. The value can be in ISO 8601 - format (For example, PT05S for one image every 5 seconds), or a frame count (For example, 30 - for one image every 30 frames), or a relative value to stream duration (For example, 10% for - one image every 10% of stream duration). Note: Step value will affect the first generated - thumbnail, which may not be exactly the one specified at transform preset start time. This is - due to the encoder, which tries to select the best thumbnail between start time and Step - position from start time as the first output. As the default value is 10%, it means if stream - has long duration, the first generated thumbnail might be far away from the one specified at - start time. Try to select reasonable value for Step if the first thumbnail is expected close to - start time, or set Range value at 1 if only one thumbnail is needed at start time. - :type step: str - :param range: The position relative to transform preset start time in the input video at which - to stop generating thumbnails. The value can be in ISO 8601 format (For example, PT5M30S to - stop at 5 minutes and 30 seconds from start time), or a frame count (For example, 300 to stop - at the 300th frame from the frame at start time. If this value is 1, it means only producing - one thumbnail at start time), or a relative value to the stream duration (For example, 50% to - stop at half of stream duration from start time). The default value is 100%, which means to - stop at the end of the stream. - :type range: str - """ - - _validation = { - 'odata_type': {'required': True}, - 'start': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'key_frame_interval': {'key': 'keyFrameInterval', 'type': 'duration'}, - 'stretch_mode': {'key': 'stretchMode', 'type': 'str'}, - 'sync_mode': {'key': 'syncMode', 'type': 'str'}, - 'start': {'key': 'start', 'type': 'str'}, - 'step': {'key': 'step', 'type': 'str'}, - 'range': {'key': 'range', 'type': 'str'}, - } - - _subtype_map = { - 'odata_type': {'#Microsoft.Media.JpgImage': 'JpgImage', '#Microsoft.Media.PngImage': 'PngImage'} - } - - def __init__( - self, - **kwargs - ): - super(Image, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.Image' # type: str - self.start = kwargs['start'] - self.step = kwargs.get('step', None) - self.range = kwargs.get('range', None) - - -class ImageFormat(Format): - """Describes the properties for an output image file. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: JpgFormat, PngFormat. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param filename_pattern: Required. The pattern of the file names for the generated output - files. The following macros are supported in the file name: {Basename} - An expansion macro - that will use the name of the input video file. If the base name(the file suffix is not - included) of the input video file is less than 32 characters long, the base name of input video - files will be used. If the length of base name of the input video file exceeds 32 characters, - the base name is truncated to the first 32 characters in total length. {Extension} - The - appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - - A unique index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video - bitrate. Not applicable to thumbnails. {Codec} - The type of the audio/video codec. - {Resolution} - The video resolution. Any unsubstituted macros will be collapsed and removed - from the filename. - :type filename_pattern: str - """ - - _validation = { - 'odata_type': {'required': True}, - 'filename_pattern': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'filename_pattern': {'key': 'filenamePattern', 'type': 'str'}, - } - - _subtype_map = { - 'odata_type': {'#Microsoft.Media.JpgFormat': 'JpgFormat', '#Microsoft.Media.PngFormat': 'PngFormat'} - } - - def __init__( - self, - **kwargs - ): - super(ImageFormat, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.ImageFormat' # type: str - - -class InputFile(InputDefinition): - """An InputDefinition for a single file. TrackSelections are scoped to the file specified. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param included_tracks: The list of TrackDescriptors which define the metadata and selection of - tracks in the input. - :type included_tracks: list[~azure.mgmt.media.models.TrackDescriptor] - :param filename: Name of the file that this input definition applies to. - :type filename: str - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'included_tracks': {'key': 'includedTracks', 'type': '[TrackDescriptor]'}, - 'filename': {'key': 'filename', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(InputFile, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.InputFile' # type: str - self.filename = kwargs.get('filename', None) - - -class IPAccessControl(msrest.serialization.Model): - """The IP access control. - - :param allow: The IP allow list. - :type allow: list[~azure.mgmt.media.models.IPRange] - """ - - _attribute_map = { - 'allow': {'key': 'allow', 'type': '[IPRange]'}, - } - - def __init__( - self, - **kwargs - ): - super(IPAccessControl, self).__init__(**kwargs) - self.allow = kwargs.get('allow', None) - - -class IPRange(msrest.serialization.Model): - """The IP address range in the CIDR scheme. - - :param name: The friendly name for the IP address range. - :type name: str - :param address: The IP address. - :type address: str - :param subnet_prefix_length: The subnet mask prefix length (see CIDR notation). - :type subnet_prefix_length: int - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'address': {'key': 'address', 'type': 'str'}, - 'subnet_prefix_length': {'key': 'subnetPrefixLength', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(IPRange, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.address = kwargs.get('address', None) - self.subnet_prefix_length = kwargs.get('subnet_prefix_length', None) - - -class Job(ProxyResource): - """A Job resource type. The progress and state can be obtained by polling a Job or subscribing to events using EventGrid. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: The system metadata relating to this resource. - :vartype system_data: ~azure.mgmt.media.models.SystemData - :ivar created: The UTC date and time when the customer has created the Job, in - 'YYYY-MM-DDThh:mm:ssZ' format. - :vartype created: ~datetime.datetime - :ivar state: The current state of the job. Possible values include: "Canceled", "Canceling", - "Error", "Finished", "Processing", "Queued", "Scheduled". - :vartype state: str or ~azure.mgmt.media.models.JobState - :param description: Optional customer supplied description of the Job. - :type description: str - :param input: The inputs for the Job. - :type input: ~azure.mgmt.media.models.JobInput - :ivar last_modified: The UTC date and time when the customer has last updated the Job, in - 'YYYY-MM-DDThh:mm:ssZ' format. - :vartype last_modified: ~datetime.datetime - :param outputs: The outputs for the Job. - :type outputs: list[~azure.mgmt.media.models.JobOutput] - :param priority: Priority with which the job should be processed. Higher priority jobs are - processed before lower priority jobs. If not set, the default is normal. Possible values - include: "Low", "Normal", "High". - :type priority: str or ~azure.mgmt.media.models.Priority - :param correlation_data: Customer provided key, value pairs that will be returned in Job and - JobOutput state events. - :type correlation_data: dict[str, str] - :ivar start_time: The UTC date and time at which this Job began processing. - :vartype start_time: ~datetime.datetime - :ivar end_time: The UTC date and time at which this Job finished processing. - :vartype end_time: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'created': {'readonly': True}, - 'state': {'readonly': True}, - 'last_modified': {'readonly': True}, - 'start_time': {'readonly': True}, - 'end_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'created': {'key': 'properties.created', 'type': 'iso-8601'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'input': {'key': 'properties.input', 'type': 'JobInput'}, - 'last_modified': {'key': 'properties.lastModified', 'type': 'iso-8601'}, - 'outputs': {'key': 'properties.outputs', 'type': '[JobOutput]'}, - 'priority': {'key': 'properties.priority', 'type': 'str'}, - 'correlation_data': {'key': 'properties.correlationData', 'type': '{str}'}, - 'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'properties.endTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(Job, self).__init__(**kwargs) - self.system_data = None - self.created = None - self.state = None - self.description = kwargs.get('description', None) - self.input = kwargs.get('input', None) - self.last_modified = None - self.outputs = kwargs.get('outputs', None) - self.priority = kwargs.get('priority', None) - self.correlation_data = kwargs.get('correlation_data', None) - self.start_time = None - self.end_time = None - - -class JobCollection(msrest.serialization.Model): - """A collection of Job items. - - :param value: A collection of Job items. - :type value: list[~azure.mgmt.media.models.Job] - :param odata_next_link: A link to the next page of the collection (when the collection contains - too many results to return in one response). - :type odata_next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Job]'}, - 'odata_next_link': {'key': '@odata\\.nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(JobCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.odata_next_link = kwargs.get('odata_next_link', None) - - -class JobError(msrest.serialization.Model): - """Details of JobOutput errors. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: Error code describing the error. Possible values include: "ServiceError", - "ServiceTransientError", "DownloadNotAccessible", "DownloadTransientError", - "UploadNotAccessible", "UploadTransientError", "ConfigurationUnsupported", "ContentMalformed", - "ContentUnsupported". - :vartype code: str or ~azure.mgmt.media.models.JobErrorCode - :ivar message: A human-readable language-dependent representation of the error. - :vartype message: str - :ivar category: Helps with categorization of errors. Possible values include: "Service", - "Download", "Upload", "Configuration", "Content". - :vartype category: str or ~azure.mgmt.media.models.JobErrorCategory - :ivar retry: Indicates that it may be possible to retry the Job. If retry is unsuccessful, - please contact Azure support via Azure Portal. Possible values include: "DoNotRetry", - "MayRetry". - :vartype retry: str or ~azure.mgmt.media.models.JobRetry - :ivar details: An array of details about specific errors that led to this reported error. - :vartype details: list[~azure.mgmt.media.models.JobErrorDetail] - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'category': {'readonly': True}, - 'retry': {'readonly': True}, - 'details': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'category': {'key': 'category', 'type': 'str'}, - 'retry': {'key': 'retry', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[JobErrorDetail]'}, - } - - def __init__( - self, - **kwargs - ): - super(JobError, self).__init__(**kwargs) - self.code = None - self.message = None - self.category = None - self.retry = None - self.details = None - - -class JobErrorDetail(msrest.serialization.Model): - """Details of JobOutput errors. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: Code describing the error detail. - :vartype code: str - :ivar message: A human-readable representation of the error. - :vartype message: str - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(JobErrorDetail, self).__init__(**kwargs) - self.code = None - self.message = None - - -class JobInput(msrest.serialization.Model): - """Base class for inputs to a Job. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: JobInputClip, JobInputSequence, JobInputs. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - } - - _subtype_map = { - 'odata_type': {'#Microsoft.Media.JobInputClip': 'JobInputClip', '#Microsoft.Media.JobInputSequence': 'JobInputSequence', '#Microsoft.Media.JobInputs': 'JobInputs'} - } - - def __init__( - self, - **kwargs - ): - super(JobInput, self).__init__(**kwargs) - self.odata_type = None # type: Optional[str] - - -class JobInputClip(JobInput): - """Represents input files for a Job. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: JobInputAsset, JobInputHttp. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param files: List of files. Required for JobInputHttp. Maximum of 4000 characters each. Query - strings will not be returned in service responses to prevent sensitive data exposure. - :type files: list[str] - :param start: Defines a point on the timeline of the input media at which processing will - start. Defaults to the beginning of the input media. - :type start: ~azure.mgmt.media.models.ClipTime - :param end: Defines a point on the timeline of the input media at which processing will end. - Defaults to the end of the input media. - :type end: ~azure.mgmt.media.models.ClipTime - :param label: A label that is assigned to a JobInputClip, that is used to satisfy a reference - used in the Transform. For example, a Transform can be authored so as to take an image file - with the label 'xyz' and apply it as an overlay onto the input video before it is encoded. When - submitting a Job, exactly one of the JobInputs should be the image file, and it should have the - label 'xyz'. - :type label: str - :param input_definitions: Defines a list of InputDefinitions. For each InputDefinition, it - defines a list of track selections and related metadata. - :type input_definitions: list[~azure.mgmt.media.models.InputDefinition] - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'files': {'key': 'files', 'type': '[str]'}, - 'start': {'key': 'start', 'type': 'ClipTime'}, - 'end': {'key': 'end', 'type': 'ClipTime'}, - 'label': {'key': 'label', 'type': 'str'}, - 'input_definitions': {'key': 'inputDefinitions', 'type': '[InputDefinition]'}, - } - - _subtype_map = { - 'odata_type': {'#Microsoft.Media.JobInputAsset': 'JobInputAsset', '#Microsoft.Media.JobInputHttp': 'JobInputHttp'} - } - - def __init__( - self, - **kwargs - ): - super(JobInputClip, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.JobInputClip' # type: str - self.files = kwargs.get('files', None) - self.start = kwargs.get('start', None) - self.end = kwargs.get('end', None) - self.label = kwargs.get('label', None) - self.input_definitions = kwargs.get('input_definitions', None) - - -class JobInputAsset(JobInputClip): - """Represents an Asset for input into a Job. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param files: List of files. Required for JobInputHttp. Maximum of 4000 characters each. Query - strings will not be returned in service responses to prevent sensitive data exposure. - :type files: list[str] - :param start: Defines a point on the timeline of the input media at which processing will - start. Defaults to the beginning of the input media. - :type start: ~azure.mgmt.media.models.ClipTime - :param end: Defines a point on the timeline of the input media at which processing will end. - Defaults to the end of the input media. - :type end: ~azure.mgmt.media.models.ClipTime - :param label: A label that is assigned to a JobInputClip, that is used to satisfy a reference - used in the Transform. For example, a Transform can be authored so as to take an image file - with the label 'xyz' and apply it as an overlay onto the input video before it is encoded. When - submitting a Job, exactly one of the JobInputs should be the image file, and it should have the - label 'xyz'. - :type label: str - :param input_definitions: Defines a list of InputDefinitions. For each InputDefinition, it - defines a list of track selections and related metadata. - :type input_definitions: list[~azure.mgmt.media.models.InputDefinition] - :param asset_name: Required. The name of the input Asset. - :type asset_name: str - """ - - _validation = { - 'odata_type': {'required': True}, - 'asset_name': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'files': {'key': 'files', 'type': '[str]'}, - 'start': {'key': 'start', 'type': 'ClipTime'}, - 'end': {'key': 'end', 'type': 'ClipTime'}, - 'label': {'key': 'label', 'type': 'str'}, - 'input_definitions': {'key': 'inputDefinitions', 'type': '[InputDefinition]'}, - 'asset_name': {'key': 'assetName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(JobInputAsset, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.JobInputAsset' # type: str - self.asset_name = kwargs['asset_name'] - - -class JobInputHttp(JobInputClip): - """Represents HTTPS job input. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param files: List of files. Required for JobInputHttp. Maximum of 4000 characters each. Query - strings will not be returned in service responses to prevent sensitive data exposure. - :type files: list[str] - :param start: Defines a point on the timeline of the input media at which processing will - start. Defaults to the beginning of the input media. - :type start: ~azure.mgmt.media.models.ClipTime - :param end: Defines a point on the timeline of the input media at which processing will end. - Defaults to the end of the input media. - :type end: ~azure.mgmt.media.models.ClipTime - :param label: A label that is assigned to a JobInputClip, that is used to satisfy a reference - used in the Transform. For example, a Transform can be authored so as to take an image file - with the label 'xyz' and apply it as an overlay onto the input video before it is encoded. When - submitting a Job, exactly one of the JobInputs should be the image file, and it should have the - label 'xyz'. - :type label: str - :param input_definitions: Defines a list of InputDefinitions. For each InputDefinition, it - defines a list of track selections and related metadata. - :type input_definitions: list[~azure.mgmt.media.models.InputDefinition] - :param base_uri: Base URI for HTTPS job input. It will be concatenated with provided file - names. If no base uri is given, then the provided file list is assumed to be fully qualified - uris. Maximum length of 4000 characters. The query strings will not be returned in service - responses to prevent sensitive data exposure. - :type base_uri: str - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'files': {'key': 'files', 'type': '[str]'}, - 'start': {'key': 'start', 'type': 'ClipTime'}, - 'end': {'key': 'end', 'type': 'ClipTime'}, - 'label': {'key': 'label', 'type': 'str'}, - 'input_definitions': {'key': 'inputDefinitions', 'type': '[InputDefinition]'}, - 'base_uri': {'key': 'baseUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(JobInputHttp, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.JobInputHttp' # type: str - self.base_uri = kwargs.get('base_uri', None) - - -class JobInputs(JobInput): - """Describes a list of inputs to a Job. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param inputs: List of inputs to a Job. - :type inputs: list[~azure.mgmt.media.models.JobInput] - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'inputs': {'key': 'inputs', 'type': '[JobInput]'}, - } - - def __init__( - self, - **kwargs - ): - super(JobInputs, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.JobInputs' # type: str - self.inputs = kwargs.get('inputs', None) - - -class JobInputSequence(JobInput): - """A Sequence contains an ordered list of Clips where each clip is a JobInput. The Sequence will be treated as a single input. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param inputs: JobInputs that make up the timeline. - :type inputs: list[~azure.mgmt.media.models.JobInputClip] - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'inputs': {'key': 'inputs', 'type': '[JobInputClip]'}, - } - - def __init__( - self, - **kwargs - ): - super(JobInputSequence, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.JobInputSequence' # type: str - self.inputs = kwargs.get('inputs', None) - - -class JobOutput(msrest.serialization.Model): - """Describes all the properties of a JobOutput. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: JobOutputAsset. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :ivar error: If the JobOutput is in the Error state, it contains the details of the error. - :vartype error: ~azure.mgmt.media.models.JobError - :param preset_override: A preset used to override the preset in the corresponding transform - output. - :type preset_override: ~azure.mgmt.media.models.Preset - :ivar state: Describes the state of the JobOutput. Possible values include: "Canceled", - "Canceling", "Error", "Finished", "Processing", "Queued", "Scheduled". - :vartype state: str or ~azure.mgmt.media.models.JobState - :ivar progress: If the JobOutput is in a Processing state, this contains the Job completion - percentage. The value is an estimate and not intended to be used to predict Job completion - times. To determine if the JobOutput is complete, use the State property. - :vartype progress: int - :param label: A label that is assigned to a JobOutput in order to help uniquely identify it. - This is useful when your Transform has more than one TransformOutput, whereby your Job has more - than one JobOutput. In such cases, when you submit the Job, you will add two or more - JobOutputs, in the same order as TransformOutputs in the Transform. Subsequently, when you - retrieve the Job, either through events or on a GET request, you can use the label to easily - identify the JobOutput. If a label is not provided, a default value of - '{presetName}_{outputIndex}' will be used, where the preset name is the name of the preset in - the corresponding TransformOutput and the output index is the relative index of the this - JobOutput within the Job. Note that this index is the same as the relative index of the - corresponding TransformOutput within its Transform. - :type label: str - :ivar start_time: The UTC date and time at which this Job Output began processing. - :vartype start_time: ~datetime.datetime - :ivar end_time: The UTC date and time at which this Job Output finished processing. - :vartype end_time: ~datetime.datetime - """ - - _validation = { - 'odata_type': {'required': True}, - 'error': {'readonly': True}, - 'state': {'readonly': True}, - 'progress': {'readonly': True}, - 'start_time': {'readonly': True}, - 'end_time': {'readonly': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'JobError'}, - 'preset_override': {'key': 'presetOverride', 'type': 'Preset'}, - 'state': {'key': 'state', 'type': 'str'}, - 'progress': {'key': 'progress', 'type': 'int'}, - 'label': {'key': 'label', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - } - - _subtype_map = { - 'odata_type': {'#Microsoft.Media.JobOutputAsset': 'JobOutputAsset'} - } - - def __init__( - self, - **kwargs - ): - super(JobOutput, self).__init__(**kwargs) - self.odata_type = None # type: Optional[str] - self.error = None - self.preset_override = kwargs.get('preset_override', None) - self.state = None - self.progress = None - self.label = kwargs.get('label', None) - self.start_time = None - self.end_time = None - - -class JobOutputAsset(JobOutput): - """Represents an Asset used as a JobOutput. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :ivar error: If the JobOutput is in the Error state, it contains the details of the error. - :vartype error: ~azure.mgmt.media.models.JobError - :param preset_override: A preset used to override the preset in the corresponding transform - output. - :type preset_override: ~azure.mgmt.media.models.Preset - :ivar state: Describes the state of the JobOutput. Possible values include: "Canceled", - "Canceling", "Error", "Finished", "Processing", "Queued", "Scheduled". - :vartype state: str or ~azure.mgmt.media.models.JobState - :ivar progress: If the JobOutput is in a Processing state, this contains the Job completion - percentage. The value is an estimate and not intended to be used to predict Job completion - times. To determine if the JobOutput is complete, use the State property. - :vartype progress: int - :param label: A label that is assigned to a JobOutput in order to help uniquely identify it. - This is useful when your Transform has more than one TransformOutput, whereby your Job has more - than one JobOutput. In such cases, when you submit the Job, you will add two or more - JobOutputs, in the same order as TransformOutputs in the Transform. Subsequently, when you - retrieve the Job, either through events or on a GET request, you can use the label to easily - identify the JobOutput. If a label is not provided, a default value of - '{presetName}_{outputIndex}' will be used, where the preset name is the name of the preset in - the corresponding TransformOutput and the output index is the relative index of the this - JobOutput within the Job. Note that this index is the same as the relative index of the - corresponding TransformOutput within its Transform. - :type label: str - :ivar start_time: The UTC date and time at which this Job Output began processing. - :vartype start_time: ~datetime.datetime - :ivar end_time: The UTC date and time at which this Job Output finished processing. - :vartype end_time: ~datetime.datetime - :param asset_name: Required. The name of the output Asset. - :type asset_name: str - """ - - _validation = { - 'odata_type': {'required': True}, - 'error': {'readonly': True}, - 'state': {'readonly': True}, - 'progress': {'readonly': True}, - 'start_time': {'readonly': True}, - 'end_time': {'readonly': True}, - 'asset_name': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'JobError'}, - 'preset_override': {'key': 'presetOverride', 'type': 'Preset'}, - 'state': {'key': 'state', 'type': 'str'}, - 'progress': {'key': 'progress', 'type': 'int'}, - 'label': {'key': 'label', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'asset_name': {'key': 'assetName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(JobOutputAsset, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.JobOutputAsset' # type: str - self.asset_name = kwargs['asset_name'] - - -class JpgFormat(ImageFormat): - """Describes the settings for producing JPEG thumbnails. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param filename_pattern: Required. The pattern of the file names for the generated output - files. The following macros are supported in the file name: {Basename} - An expansion macro - that will use the name of the input video file. If the base name(the file suffix is not - included) of the input video file is less than 32 characters long, the base name of input video - files will be used. If the length of base name of the input video file exceeds 32 characters, - the base name is truncated to the first 32 characters in total length. {Extension} - The - appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - - A unique index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video - bitrate. Not applicable to thumbnails. {Codec} - The type of the audio/video codec. - {Resolution} - The video resolution. Any unsubstituted macros will be collapsed and removed - from the filename. - :type filename_pattern: str - """ - - _validation = { - 'odata_type': {'required': True}, - 'filename_pattern': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'filename_pattern': {'key': 'filenamePattern', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(JpgFormat, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.JpgFormat' # type: str - - -class JpgImage(Image): - """Describes the properties for producing a series of JPEG images from the input video. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param label: An optional label for the codec. The label can be used to control muxing - behavior. - :type label: str - :param key_frame_interval: The distance between two key frames. The value should be non-zero in - the range [0.5, 20] seconds, specified in ISO 8601 format. The default is 2 seconds(PT2S). Note - that this setting is ignored if VideoSyncMode.Passthrough is set, where the KeyFrameInterval - value will follow the input source setting. - :type key_frame_interval: ~datetime.timedelta - :param stretch_mode: The resizing mode - how the input video will be resized to fit the desired - output resolution(s). Default is AutoSize. Possible values include: "None", "AutoSize", - "AutoFit". - :type stretch_mode: str or ~azure.mgmt.media.models.StretchMode - :param sync_mode: The Video Sync Mode. Possible values include: "Auto", "Passthrough", "Cfr", - "Vfr". - :type sync_mode: str or ~azure.mgmt.media.models.VideoSyncMode - :param start: Required. The position in the input video from where to start generating - thumbnails. The value can be in ISO 8601 format (For example, PT05S to start at 5 seconds), or - a frame count (For example, 10 to start at the 10th frame), or a relative value to stream - duration (For example, 10% to start at 10% of stream duration). Also supports a macro {Best}, - which tells the encoder to select the best thumbnail from the first few seconds of the video - and will only produce one thumbnail, no matter what other settings are for Step and Range. The - default value is macro {Best}. - :type start: str - :param step: The intervals at which thumbnails are generated. The value can be in ISO 8601 - format (For example, PT05S for one image every 5 seconds), or a frame count (For example, 30 - for one image every 30 frames), or a relative value to stream duration (For example, 10% for - one image every 10% of stream duration). Note: Step value will affect the first generated - thumbnail, which may not be exactly the one specified at transform preset start time. This is - due to the encoder, which tries to select the best thumbnail between start time and Step - position from start time as the first output. As the default value is 10%, it means if stream - has long duration, the first generated thumbnail might be far away from the one specified at - start time. Try to select reasonable value for Step if the first thumbnail is expected close to - start time, or set Range value at 1 if only one thumbnail is needed at start time. - :type step: str - :param range: The position relative to transform preset start time in the input video at which - to stop generating thumbnails. The value can be in ISO 8601 format (For example, PT5M30S to - stop at 5 minutes and 30 seconds from start time), or a frame count (For example, 300 to stop - at the 300th frame from the frame at start time. If this value is 1, it means only producing - one thumbnail at start time), or a relative value to the stream duration (For example, 50% to - stop at half of stream duration from start time). The default value is 100%, which means to - stop at the end of the stream. - :type range: str - :param layers: A collection of output JPEG image layers to be produced by the encoder. - :type layers: list[~azure.mgmt.media.models.JpgLayer] - :param sprite_column: Sets the number of columns used in thumbnail sprite image. The number of - rows are automatically calculated and a VTT file is generated with the coordinate mappings for - each thumbnail in the sprite. Note: this value should be a positive integer and a proper value - is recommended so that the output image resolution will not go beyond JPEG maximum pixel - resolution limit 65535x65535. - :type sprite_column: int - """ - - _validation = { - 'odata_type': {'required': True}, - 'start': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'key_frame_interval': {'key': 'keyFrameInterval', 'type': 'duration'}, - 'stretch_mode': {'key': 'stretchMode', 'type': 'str'}, - 'sync_mode': {'key': 'syncMode', 'type': 'str'}, - 'start': {'key': 'start', 'type': 'str'}, - 'step': {'key': 'step', 'type': 'str'}, - 'range': {'key': 'range', 'type': 'str'}, - 'layers': {'key': 'layers', 'type': '[JpgLayer]'}, - 'sprite_column': {'key': 'spriteColumn', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(JpgImage, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.JpgImage' # type: str - self.layers = kwargs.get('layers', None) - self.sprite_column = kwargs.get('sprite_column', None) - - -class JpgLayer(Layer): - """Describes the settings to produce a JPEG image from the input video. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param width: The width of the output video for this layer. The value can be absolute (in - pixels) or relative (in percentage). For example 50% means the output video has half as many - pixels in width as the input. - :type width: str - :param height: The height of the output video for this layer. The value can be absolute (in - pixels) or relative (in percentage). For example 50% means the output video has half as many - pixels in height as the input. - :type height: str - :param label: The alphanumeric label for this layer, which can be used in multiplexing - different video and audio layers, or in naming the output file. - :type label: str - :param quality: The compression quality of the JPEG output. Range is from 0-100 and the default - is 70. - :type quality: int - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'width': {'key': 'width', 'type': 'str'}, - 'height': {'key': 'height', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'quality': {'key': 'quality', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(JpgLayer, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.JpgLayer' # type: str - self.quality = kwargs.get('quality', None) - - -class KeyDelivery(msrest.serialization.Model): - """KeyDelivery. - - :param access_control: The access control properties for Key Delivery. - :type access_control: ~azure.mgmt.media.models.AccessControl - """ - - _attribute_map = { - 'access_control': {'key': 'accessControl', 'type': 'AccessControl'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyDelivery, self).__init__(**kwargs) - self.access_control = kwargs.get('access_control', None) - - -class KeyVaultProperties(msrest.serialization.Model): - """KeyVaultProperties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param key_identifier: 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 - :ivar current_key_identifier: The current key used to encrypt the Media Services account, - including the key version. - :vartype current_key_identifier: str - """ - - _validation = { - 'current_key_identifier': {'readonly': True}, - } - - _attribute_map = { - 'key_identifier': {'key': 'keyIdentifier', 'type': 'str'}, - 'current_key_identifier': {'key': 'currentKeyIdentifier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultProperties, self).__init__(**kwargs) - self.key_identifier = kwargs.get('key_identifier', None) - self.current_key_identifier = None - - -class ListContainerSasInput(msrest.serialization.Model): - """The parameters to the list SAS request. - - :param permissions: The permissions to set on the SAS URL. Possible values include: "Read", - "ReadWrite", "ReadWriteDelete". - :type permissions: str or ~azure.mgmt.media.models.AssetContainerPermission - :param expiry_time: The SAS URL expiration time. This must be less than 24 hours from the - current time. - :type expiry_time: ~datetime.datetime - """ - - _attribute_map = { - 'permissions': {'key': 'permissions', 'type': 'str'}, - 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(ListContainerSasInput, self).__init__(**kwargs) - self.permissions = kwargs.get('permissions', None) - self.expiry_time = kwargs.get('expiry_time', None) - - -class ListContentKeysResponse(msrest.serialization.Model): - """Class of response for listContentKeys action. - - :param content_keys: ContentKeys used by current Streaming Locator. - :type content_keys: list[~azure.mgmt.media.models.StreamingLocatorContentKey] - """ - - _attribute_map = { - 'content_keys': {'key': 'contentKeys', 'type': '[StreamingLocatorContentKey]'}, - } - - def __init__( - self, - **kwargs - ): - super(ListContentKeysResponse, self).__init__(**kwargs) - self.content_keys = kwargs.get('content_keys', None) - - -class ListEdgePoliciesInput(msrest.serialization.Model): - """ListEdgePoliciesInput. - - :param device_id: Unique identifier of the edge device. - :type device_id: str - """ - - _attribute_map = { - 'device_id': {'key': 'deviceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListEdgePoliciesInput, self).__init__(**kwargs) - self.device_id = kwargs.get('device_id', None) - - -class ListPathsResponse(msrest.serialization.Model): - """Class of response for listPaths action. - - :param streaming_paths: Streaming Paths supported by current Streaming Locator. - :type streaming_paths: list[~azure.mgmt.media.models.StreamingPath] - :param download_paths: Download Paths supported by current Streaming Locator. - :type download_paths: list[str] - """ - - _attribute_map = { - 'streaming_paths': {'key': 'streamingPaths', 'type': '[StreamingPath]'}, - 'download_paths': {'key': 'downloadPaths', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ListPathsResponse, self).__init__(**kwargs) - self.streaming_paths = kwargs.get('streaming_paths', None) - self.download_paths = kwargs.get('download_paths', None) - - -class ListStreamingLocatorsResponse(msrest.serialization.Model): - """The Streaming Locators associated with this Asset. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar streaming_locators: The list of Streaming Locators. - :vartype streaming_locators: list[~azure.mgmt.media.models.AssetStreamingLocator] - """ - - _validation = { - 'streaming_locators': {'readonly': True}, - } - - _attribute_map = { - 'streaming_locators': {'key': 'streamingLocators', 'type': '[AssetStreamingLocator]'}, - } - - def __init__( - self, - **kwargs - ): - super(ListStreamingLocatorsResponse, self).__init__(**kwargs) - self.streaming_locators = None - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :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 - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - - -class LiveEvent(TrackedResource): - """The live event. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :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 - :ivar system_data: The system metadata relating to this resource. - :vartype system_data: ~azure.mgmt.media.models.SystemData - :param description: A description for the live event. - :type description: str - :param input: Live event input settings. It defines how the live event receives input from a - contribution encoder. - :type input: ~azure.mgmt.media.models.LiveEventInput - :param preview: Live event preview settings. Preview allows live event producers to preview the - live streaming content without creating any live output. - :type preview: ~azure.mgmt.media.models.LiveEventPreview - :param encoding: Encoding settings for the live event. It configures whether a live encoder is - used for the live event and settings for the live encoder if it is used. - :type encoding: ~azure.mgmt.media.models.LiveEventEncoding - :param transcriptions: Live transcription settings for the live event. See - https://go.microsoft.com/fwlink/?linkid=2133742 for more information about the live - transcription feature. - :type transcriptions: list[~azure.mgmt.media.models.LiveEventTranscription] - :ivar provisioning_state: The provisioning state of the live event. - :vartype provisioning_state: str - :ivar resource_state: The resource state of the live event. See - https://go.microsoft.com/fwlink/?linkid=2139012 for more information. Possible values include: - "Stopped", "Allocating", "StandBy", "Starting", "Running", "Stopping", "Deleting". - :vartype resource_state: str or ~azure.mgmt.media.models.LiveEventResourceState - :param cross_site_access_policies: Live event cross site access policies. - :type cross_site_access_policies: ~azure.mgmt.media.models.CrossSiteAccessPolicies - :param use_static_hostname: Specifies whether a static hostname would be assigned to the live - event preview and ingest endpoints. This value can only be updated if the live event is in - Standby state. - :type use_static_hostname: bool - :param hostname_prefix: When useStaticHostname is set to true, the hostnamePrefix specifies the - first part of the hostname assigned to the live event preview and ingest endpoints. The final - hostname would be a combination of this prefix, the media service account name and a short code - for the Azure Media Services data center. - :type hostname_prefix: str - :param stream_options: The options to use for the LiveEvent. This value is specified at - creation time and cannot be updated. The valid values for the array entry values are 'Default' - and 'LowLatency'. - :type stream_options: list[str or ~azure.mgmt.media.models.StreamOptionsFlag] - :ivar created: The creation time for the live event. - :vartype created: ~datetime.datetime - :ivar last_modified: The last modified time of the live event. - :vartype last_modified: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'resource_state': {'readonly': True}, - 'created': {'readonly': True}, - 'last_modified': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'input': {'key': 'properties.input', 'type': 'LiveEventInput'}, - 'preview': {'key': 'properties.preview', 'type': 'LiveEventPreview'}, - 'encoding': {'key': 'properties.encoding', 'type': 'LiveEventEncoding'}, - 'transcriptions': {'key': 'properties.transcriptions', 'type': '[LiveEventTranscription]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, - 'cross_site_access_policies': {'key': 'properties.crossSiteAccessPolicies', 'type': 'CrossSiteAccessPolicies'}, - 'use_static_hostname': {'key': 'properties.useStaticHostname', 'type': 'bool'}, - 'hostname_prefix': {'key': 'properties.hostnamePrefix', 'type': 'str'}, - 'stream_options': {'key': 'properties.streamOptions', 'type': '[str]'}, - 'created': {'key': 'properties.created', 'type': 'iso-8601'}, - 'last_modified': {'key': 'properties.lastModified', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(LiveEvent, self).__init__(**kwargs) - self.system_data = None - self.description = kwargs.get('description', None) - self.input = kwargs.get('input', None) - self.preview = kwargs.get('preview', None) - self.encoding = kwargs.get('encoding', None) - self.transcriptions = kwargs.get('transcriptions', None) - self.provisioning_state = None - self.resource_state = None - self.cross_site_access_policies = kwargs.get('cross_site_access_policies', None) - self.use_static_hostname = kwargs.get('use_static_hostname', None) - self.hostname_prefix = kwargs.get('hostname_prefix', None) - self.stream_options = kwargs.get('stream_options', None) - self.created = None - self.last_modified = None - - -class LiveEventActionInput(msrest.serialization.Model): - """The LiveEvent action input parameter definition. - - :param remove_outputs_on_stop: The flag indicates whether live outputs are automatically - deleted when live event is being stopped. Deleting live outputs do not delete the underlying - assets. - :type remove_outputs_on_stop: bool - """ - - _attribute_map = { - 'remove_outputs_on_stop': {'key': 'removeOutputsOnStop', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(LiveEventActionInput, self).__init__(**kwargs) - self.remove_outputs_on_stop = kwargs.get('remove_outputs_on_stop', None) - - -class LiveEventEncoding(msrest.serialization.Model): - """Specifies the live event type and optional encoding settings for encoding live events. - - :param encoding_type: Live event type. When encodingType is set to None, the service simply - passes through the incoming video and audio layer(s) to the output. When encodingType is set to - Standard or Premium1080p, a live encoder transcodes the incoming stream into multiple bitrates - or layers. See https://go.microsoft.com/fwlink/?linkid=2095101 for more information. This - property cannot be modified after the live event is created. Possible values include: "None", - "Standard", "Premium1080p", "PassthroughBasic", "PassthroughStandard". - :type encoding_type: str or ~azure.mgmt.media.models.LiveEventEncodingType - :param preset_name: The optional encoding preset name, used when encodingType is not None. This - value is specified at creation time and cannot be updated. If the encodingType is set to - Standard, then the default preset name is ‘Default720p’. Else if the encodingType is set to - Premium1080p, the default preset is ‘Default1080p’. - :type preset_name: str - :param stretch_mode: Specifies how the input video will be resized to fit the desired output - resolution(s). Default is None. Possible values include: "None", "AutoSize", "AutoFit". - :type stretch_mode: str or ~azure.mgmt.media.models.StretchMode - :param key_frame_interval: Use an ISO 8601 time value between 0.5 to 20 seconds to specify the - output fragment length for the video and audio tracks of an encoding live event. For example, - use PT2S to indicate 2 seconds. For the video track it also defines the key frame interval, or - the length of a GoP (group of pictures). If this value is not set for an encoding live event, - the fragment duration defaults to 2 seconds. The value cannot be set for pass-through live - events. - :type key_frame_interval: ~datetime.timedelta - """ - - _attribute_map = { - 'encoding_type': {'key': 'encodingType', 'type': 'str'}, - 'preset_name': {'key': 'presetName', 'type': 'str'}, - 'stretch_mode': {'key': 'stretchMode', 'type': 'str'}, - 'key_frame_interval': {'key': 'keyFrameInterval', 'type': 'duration'}, - } - - def __init__( - self, - **kwargs - ): - super(LiveEventEncoding, self).__init__(**kwargs) - self.encoding_type = kwargs.get('encoding_type', None) - self.preset_name = kwargs.get('preset_name', None) - self.stretch_mode = kwargs.get('stretch_mode', None) - self.key_frame_interval = kwargs.get('key_frame_interval', None) - - -class LiveEventEndpoint(msrest.serialization.Model): - """The live event endpoint. - - :param protocol: The endpoint protocol. - :type protocol: str - :param url: The endpoint URL. - :type url: str - """ - - _attribute_map = { - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'url': {'key': 'url', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LiveEventEndpoint, self).__init__(**kwargs) - self.protocol = kwargs.get('protocol', None) - self.url = kwargs.get('url', None) - - -class LiveEventInput(msrest.serialization.Model): - """The live event input. - - All required parameters must be populated in order to send to Azure. - - :param streaming_protocol: Required. The input protocol for the live event. This is specified - at creation time and cannot be updated. Possible values include: "FragmentedMP4", "RTMP". - :type streaming_protocol: str or ~azure.mgmt.media.models.LiveEventInputProtocol - :param access_control: Access control for live event input. - :type access_control: ~azure.mgmt.media.models.LiveEventInputAccessControl - :param key_frame_interval_duration: ISO 8601 time duration of the key frame interval duration - of the input. This value sets the EXT-X-TARGETDURATION property in the HLS output. For example, - use PT2S to indicate 2 seconds. Leave the value empty for encoding live events. - :type key_frame_interval_duration: str - :param access_token: A UUID in string form to uniquely identify the stream. This can be - specified at creation time but cannot be updated. If omitted, the service will generate a - unique value. - :type access_token: str - :param endpoints: The input endpoints for the live event. - :type endpoints: list[~azure.mgmt.media.models.LiveEventEndpoint] - """ - - _validation = { - 'streaming_protocol': {'required': True}, - } - - _attribute_map = { - 'streaming_protocol': {'key': 'streamingProtocol', 'type': 'str'}, - 'access_control': {'key': 'accessControl', 'type': 'LiveEventInputAccessControl'}, - 'key_frame_interval_duration': {'key': 'keyFrameIntervalDuration', 'type': 'str'}, - 'access_token': {'key': 'accessToken', 'type': 'str'}, - 'endpoints': {'key': 'endpoints', 'type': '[LiveEventEndpoint]'}, - } - - def __init__( - self, - **kwargs - ): - super(LiveEventInput, self).__init__(**kwargs) - self.streaming_protocol = kwargs['streaming_protocol'] - self.access_control = kwargs.get('access_control', None) - self.key_frame_interval_duration = kwargs.get('key_frame_interval_duration', None) - self.access_token = kwargs.get('access_token', None) - self.endpoints = kwargs.get('endpoints', None) - - -class LiveEventInputAccessControl(msrest.serialization.Model): - """The IP access control for live event input. - - :param ip: The IP access control properties. - :type ip: ~azure.mgmt.media.models.IPAccessControl - """ - - _attribute_map = { - 'ip': {'key': 'ip', 'type': 'IPAccessControl'}, - } - - def __init__( - self, - **kwargs - ): - super(LiveEventInputAccessControl, self).__init__(**kwargs) - self.ip = kwargs.get('ip', None) - - -class LiveEventInputTrackSelection(msrest.serialization.Model): - """A track selection condition. This property is reserved for future use, any value set on this property will be ignored. - - :param property: Property name to select. This property is reserved for future use, any value - set on this property will be ignored. - :type property: str - :param operation: Comparing operation. This property is reserved for future use, any value set - on this property will be ignored. - :type operation: str - :param value: Property value to select. This property is reserved for future use, any value set - on this property will be ignored. - :type value: str - """ - - _attribute_map = { - 'property': {'key': 'property', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LiveEventInputTrackSelection, self).__init__(**kwargs) - self.property = kwargs.get('property', None) - self.operation = kwargs.get('operation', None) - self.value = kwargs.get('value', None) - - -class LiveEventListResult(msrest.serialization.Model): - """The LiveEvent list result. - - :param value: The result of the List Live Event operation. - :type value: list[~azure.mgmt.media.models.LiveEvent] - :param odata_count: The number of result. - :type odata_count: int - :param odata_next_link: The link to the next set of results. Not empty if value contains - incomplete list of live outputs. - :type odata_next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[LiveEvent]'}, - 'odata_count': {'key': '@odata\\.count', 'type': 'int'}, - 'odata_next_link': {'key': '@odata\\.nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LiveEventListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.odata_count = kwargs.get('odata_count', None) - self.odata_next_link = kwargs.get('odata_next_link', None) - - -class LiveEventOutputTranscriptionTrack(msrest.serialization.Model): - """Describes a transcription track in the output of a live event, generated using speech-to-text transcription. This property is reserved for future use, any value set on this property will be ignored. - - All required parameters must be populated in order to send to Azure. - - :param track_name: Required. The output track name. This property is reserved for future use, - any value set on this property will be ignored. - :type track_name: str - """ - - _validation = { - 'track_name': {'required': True}, - } - - _attribute_map = { - 'track_name': {'key': 'trackName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LiveEventOutputTranscriptionTrack, self).__init__(**kwargs) - self.track_name = kwargs['track_name'] - - -class LiveEventPreview(msrest.serialization.Model): - """Live event preview settings. - - :param endpoints: The endpoints for preview. Do not share the preview URL with the live event - audience. - :type endpoints: list[~azure.mgmt.media.models.LiveEventEndpoint] - :param access_control: The access control for live event preview. - :type access_control: ~azure.mgmt.media.models.LiveEventPreviewAccessControl - :param preview_locator: The identifier of the preview locator in Guid format. Specifying this - at creation time allows the caller to know the preview locator url before the event is created. - If omitted, the service will generate a random identifier. This value cannot be updated once - the live event is created. - :type preview_locator: str - :param streaming_policy_name: The name of streaming policy used for the live event preview. - This value is specified at creation time and cannot be updated. - :type streaming_policy_name: str - :param alternative_media_id: An alternative media identifier associated with the streaming - locator created for the preview. This value is specified at creation time and cannot be - updated. The identifier can be used in the CustomLicenseAcquisitionUrlTemplate or the - CustomKeyAcquisitionUrlTemplate of the StreamingPolicy specified in the StreamingPolicyName - field. - :type alternative_media_id: str - """ - - _attribute_map = { - 'endpoints': {'key': 'endpoints', 'type': '[LiveEventEndpoint]'}, - 'access_control': {'key': 'accessControl', 'type': 'LiveEventPreviewAccessControl'}, - 'preview_locator': {'key': 'previewLocator', 'type': 'str'}, - 'streaming_policy_name': {'key': 'streamingPolicyName', 'type': 'str'}, - 'alternative_media_id': {'key': 'alternativeMediaId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LiveEventPreview, self).__init__(**kwargs) - self.endpoints = kwargs.get('endpoints', None) - self.access_control = kwargs.get('access_control', None) - self.preview_locator = kwargs.get('preview_locator', None) - self.streaming_policy_name = kwargs.get('streaming_policy_name', None) - self.alternative_media_id = kwargs.get('alternative_media_id', None) - - -class LiveEventPreviewAccessControl(msrest.serialization.Model): - """The IP access control for the live event preview endpoint. - - :param ip: The IP access control properties. - :type ip: ~azure.mgmt.media.models.IPAccessControl - """ - - _attribute_map = { - 'ip': {'key': 'ip', 'type': 'IPAccessControl'}, - } - - def __init__( - self, - **kwargs - ): - super(LiveEventPreviewAccessControl, self).__init__(**kwargs) - self.ip = kwargs.get('ip', None) - - -class LiveEventTranscription(msrest.serialization.Model): - """Describes the transcription tracks in the output of a live event, generated using speech-to-text transcription. This property is reserved for future use, any value set on this property will be ignored. - - :param language: Specifies the language (locale) to be used for speech-to-text transcription – - it should match the spoken language in the audio track. The value should be in BCP-47 format - (e.g: 'en-US'). See https://go.microsoft.com/fwlink/?linkid=2133742 for more information about - the live transcription feature and the list of supported languages. - :type language: str - :param input_track_selection: Provides a mechanism to select the audio track in the input live - feed, to which speech-to-text transcription is applied. This property is reserved for future - use, any value set on this property will be ignored. - :type input_track_selection: list[~azure.mgmt.media.models.LiveEventInputTrackSelection] - :param output_transcription_track: Describes a transcription track in the output of a live - event, generated using speech-to-text transcription. This property is reserved for future use, - any value set on this property will be ignored. - :type output_transcription_track: ~azure.mgmt.media.models.LiveEventOutputTranscriptionTrack - """ - - _attribute_map = { - 'language': {'key': 'language', 'type': 'str'}, - 'input_track_selection': {'key': 'inputTrackSelection', 'type': '[LiveEventInputTrackSelection]'}, - 'output_transcription_track': {'key': 'outputTranscriptionTrack', 'type': 'LiveEventOutputTranscriptionTrack'}, - } - - def __init__( - self, - **kwargs - ): - super(LiveEventTranscription, self).__init__(**kwargs) - self.language = kwargs.get('language', None) - self.input_track_selection = kwargs.get('input_track_selection', None) - self.output_transcription_track = kwargs.get('output_transcription_track', None) - - -class LiveOutput(ProxyResource): - """The Live Output. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: The system metadata relating to this resource. - :vartype system_data: ~azure.mgmt.media.models.SystemData - :param description: The description of the live output. - :type description: str - :param asset_name: The asset that the live output will write to. - :type asset_name: str - :param archive_window_length: ISO 8601 time between 1 minute to 25 hours to indicate the - maximum content length that can be archived in the asset for this live output. This also sets - the maximum content length for the rewind window. For example, use PT1H30M to indicate 1 hour - and 30 minutes of archive window. - :type archive_window_length: ~datetime.timedelta - :param manifest_name: The manifest file name. If not provided, the service will generate one - automatically. - :type manifest_name: str - :param hls: HTTP Live Streaming (HLS) packing setting for the live output. - :type hls: ~azure.mgmt.media.models.Hls - :param output_snap_time: The initial timestamp that the live output will start at, any content - before this value will not be archived. - :type output_snap_time: long - :ivar created: The creation time the live output. - :vartype created: ~datetime.datetime - :ivar last_modified: The time the live output was last modified. - :vartype last_modified: ~datetime.datetime - :ivar provisioning_state: The provisioning state of the live output. - :vartype provisioning_state: str - :ivar resource_state: The resource state of the live output. Possible values include: - "Creating", "Running", "Deleting". - :vartype resource_state: str or ~azure.mgmt.media.models.LiveOutputResourceState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'created': {'readonly': True}, - 'last_modified': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'resource_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'asset_name': {'key': 'properties.assetName', 'type': 'str'}, - 'archive_window_length': {'key': 'properties.archiveWindowLength', 'type': 'duration'}, - 'manifest_name': {'key': 'properties.manifestName', 'type': 'str'}, - 'hls': {'key': 'properties.hls', 'type': 'Hls'}, - 'output_snap_time': {'key': 'properties.outputSnapTime', 'type': 'long'}, - 'created': {'key': 'properties.created', 'type': 'iso-8601'}, - 'last_modified': {'key': 'properties.lastModified', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LiveOutput, self).__init__(**kwargs) - self.system_data = None - self.description = kwargs.get('description', None) - self.asset_name = kwargs.get('asset_name', None) - self.archive_window_length = kwargs.get('archive_window_length', None) - self.manifest_name = kwargs.get('manifest_name', None) - self.hls = kwargs.get('hls', None) - self.output_snap_time = kwargs.get('output_snap_time', None) - self.created = None - self.last_modified = None - self.provisioning_state = None - self.resource_state = None - - -class LiveOutputListResult(msrest.serialization.Model): - """The LiveOutput list result. - - :param value: The result of the List LiveOutput operation. - :type value: list[~azure.mgmt.media.models.LiveOutput] - :param odata_count: The number of result. - :type odata_count: int - :param odata_next_link: The link to the next set of results. Not empty if value contains - incomplete list of live outputs. - :type odata_next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[LiveOutput]'}, - 'odata_count': {'key': '@odata\\.count', 'type': 'int'}, - 'odata_next_link': {'key': '@odata\\.nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LiveOutputListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.odata_count = kwargs.get('odata_count', None) - self.odata_next_link = kwargs.get('odata_next_link', None) - - -class LogSpecification(msrest.serialization.Model): - """A diagnostic log emitted by service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The diagnostic log category name. - :vartype name: str - :ivar display_name: The diagnostic log category display name. - :vartype display_name: str - :ivar blob_duration: The time range for requests in each blob. - :vartype blob_duration: str - """ - - _validation = { - 'name': {'readonly': True}, - 'display_name': {'readonly': True}, - 'blob_duration': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LogSpecification, self).__init__(**kwargs) - self.name = None - self.display_name = None - self.blob_duration = None - - -class MediaService(TrackedResource): - """A Media Services account. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :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 Managed Identity for the Media Services account. - :type identity: ~azure.mgmt.media.models.MediaServiceIdentity - :ivar system_data: The system metadata relating to this resource. - :vartype system_data: ~azure.mgmt.media.models.SystemData - :ivar media_service_id: The Media Services account ID. - :vartype media_service_id: str - :param storage_accounts: The storage accounts for this resource. - :type storage_accounts: list[~azure.mgmt.media.models.StorageAccount] - :param storage_authentication: Possible values include: "System", "ManagedIdentity". - :type storage_authentication: str or ~azure.mgmt.media.models.StorageAuthentication - :param encryption: The account encryption properties. - :type encryption: ~azure.mgmt.media.models.AccountEncryption - :param key_delivery: The Key Delivery properties for Media Services account. - :type key_delivery: ~azure.mgmt.media.models.KeyDelivery - :param public_network_access: Whether or not public network access is allowed for resources - under the Media Services account. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or ~azure.mgmt.media.models.PublicNetworkAccess - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - 'media_service_id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'MediaServiceIdentity'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'media_service_id': {'key': 'properties.mediaServiceId', 'type': 'str'}, - 'storage_accounts': {'key': 'properties.storageAccounts', 'type': '[StorageAccount]'}, - 'storage_authentication': {'key': 'properties.storageAuthentication', 'type': 'str'}, - 'encryption': {'key': 'properties.encryption', 'type': 'AccountEncryption'}, - 'key_delivery': {'key': 'properties.keyDelivery', 'type': 'KeyDelivery'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MediaService, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.system_data = None - self.media_service_id = None - self.storage_accounts = kwargs.get('storage_accounts', None) - self.storage_authentication = kwargs.get('storage_authentication', None) - self.encryption = kwargs.get('encryption', None) - self.key_delivery = kwargs.get('key_delivery', None) - self.public_network_access = kwargs.get('public_network_access', None) - - -class MediaServiceCollection(msrest.serialization.Model): - """A collection of MediaService items. - - :param value: A collection of MediaService items. - :type value: list[~azure.mgmt.media.models.MediaService] - :param odata_next_link: A link to the next page of the collection (when the collection contains - too many results to return in one response). - :type odata_next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[MediaService]'}, - 'odata_next_link': {'key': '@odata\\.nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MediaServiceCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.odata_next_link = kwargs.get('odata_next_link', None) - - -class MediaServiceIdentity(msrest.serialization.Model): - """MediaServiceIdentity. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The identity type. - :type type: str - :ivar principal_id: The Principal ID of the identity. - :vartype principal_id: str - :ivar tenant_id: The Tenant ID of the identity. - :vartype tenant_id: str - :param user_assigned_identities: The user assigned managed identities. - :type user_assigned_identities: dict[str, ~azure.mgmt.media.models.UserAssignedManagedIdentity] - """ - - _validation = { - 'type': {'required': True}, - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedManagedIdentity}'}, - } - - def __init__( - self, - **kwargs - ): - super(MediaServiceIdentity, self).__init__(**kwargs) - self.type = kwargs['type'] - self.principal_id = None - self.tenant_id = None - self.user_assigned_identities = kwargs.get('user_assigned_identities', None) - - -class MediaServiceUpdate(msrest.serialization.Model): - """A Media Services account update. - - 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 Managed Identity for the Media Services account. - :type identity: ~azure.mgmt.media.models.MediaServiceIdentity - :ivar media_service_id: The Media Services account ID. - :vartype media_service_id: str - :param storage_accounts: The storage accounts for this resource. - :type storage_accounts: list[~azure.mgmt.media.models.StorageAccount] - :param storage_authentication: Possible values include: "System", "ManagedIdentity". - :type storage_authentication: str or ~azure.mgmt.media.models.StorageAuthentication - :param encryption: The account encryption properties. - :type encryption: ~azure.mgmt.media.models.AccountEncryption - :param key_delivery: The Key Delivery properties for Media Services account. - :type key_delivery: ~azure.mgmt.media.models.KeyDelivery - :param public_network_access: Whether or not public network access is allowed for resources - under the Media Services account. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or ~azure.mgmt.media.models.PublicNetworkAccess - """ - - _validation = { - 'media_service_id': {'readonly': True}, - } - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'MediaServiceIdentity'}, - 'media_service_id': {'key': 'properties.mediaServiceId', 'type': 'str'}, - 'storage_accounts': {'key': 'properties.storageAccounts', 'type': '[StorageAccount]'}, - 'storage_authentication': {'key': 'properties.storageAuthentication', 'type': 'str'}, - 'encryption': {'key': 'properties.encryption', 'type': 'AccountEncryption'}, - 'key_delivery': {'key': 'properties.keyDelivery', 'type': 'KeyDelivery'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MediaServiceUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.media_service_id = None - self.storage_accounts = kwargs.get('storage_accounts', None) - self.storage_authentication = kwargs.get('storage_authentication', None) - self.encryption = kwargs.get('encryption', None) - self.key_delivery = kwargs.get('key_delivery', None) - self.public_network_access = kwargs.get('public_network_access', None) - - -class MetricDimension(msrest.serialization.Model): - """A metric dimension. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The metric dimension name. - :vartype name: str - :ivar display_name: The display name for the dimension. - :vartype display_name: str - :ivar to_be_exported_for_shoebox: Whether to export metric to shoebox. - :vartype to_be_exported_for_shoebox: bool - """ - - _validation = { - 'name': {'readonly': True}, - 'display_name': {'readonly': True}, - 'to_be_exported_for_shoebox': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricDimension, self).__init__(**kwargs) - self.name = None - self.display_name = None - self.to_be_exported_for_shoebox = None - - -class MetricSpecification(msrest.serialization.Model): - """A metric emitted by service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The metric name. - :vartype name: str - :ivar display_name: The metric display name. - :vartype display_name: str - :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 ~azure.mgmt.media.models.MetricUnit - :ivar aggregation_type: The metric aggregation type. Possible values include: "Average", - "Count", "Total". - :vartype aggregation_type: str or ~azure.mgmt.media.models.MetricAggregationType - :ivar lock_aggregation_type: The metric lock aggregation type. Possible values include: - "Average", "Count", "Total". - :vartype lock_aggregation_type: str or ~azure.mgmt.media.models.MetricAggregationType - :param supported_aggregation_types: Supported aggregation types. - :type supported_aggregation_types: list[str] - :ivar dimensions: The metric dimensions. - :vartype dimensions: list[~azure.mgmt.media.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. - :vartype source_mdm_account: str - :ivar source_mdm_namespace: The source MDM namespace. - :vartype source_mdm_namespace: str - :ivar supported_time_grain_types: The supported time grain types. - :vartype supported_time_grain_types: list[str] - """ - - _validation = { - 'name': {'readonly': True}, - 'display_name': {'readonly': True}, - 'display_description': {'readonly': True}, - 'unit': {'readonly': True}, - 'aggregation_type': {'readonly': True}, - 'lock_aggregation_type': {'readonly': True}, - 'dimensions': {'readonly': True}, - 'enable_regional_mdm_account': {'readonly': True}, - 'source_mdm_account': {'readonly': True}, - 'source_mdm_namespace': {'readonly': True}, - 'supported_time_grain_types': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'lock_aggregation_type': {'key': 'lockAggregationType', 'type': 'str'}, - 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, - 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, - 'enable_regional_mdm_account': {'key': 'enableRegionalMdmAccount', 'type': 'bool'}, - 'source_mdm_account': {'key': 'sourceMdmAccount', 'type': 'str'}, - 'source_mdm_namespace': {'key': 'sourceMdmNamespace', 'type': 'str'}, - 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricSpecification, self).__init__(**kwargs) - self.name = None - self.display_name = None - self.display_description = None - self.unit = None - self.aggregation_type = None - self.lock_aggregation_type = None - self.supported_aggregation_types = kwargs.get('supported_aggregation_types', None) - self.dimensions = None - self.enable_regional_mdm_account = None - self.source_mdm_account = None - self.source_mdm_namespace = None - self.supported_time_grain_types = None - - -class MultiBitrateFormat(Format): - """Describes the properties for producing a collection of GOP aligned multi-bitrate files. The default behavior is to produce one output file for each video layer which is muxed together with all the audios. The exact output files produced can be controlled by specifying the outputFiles collection. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: Mp4Format, TransportStreamFormat. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param filename_pattern: Required. The pattern of the file names for the generated output - files. The following macros are supported in the file name: {Basename} - An expansion macro - that will use the name of the input video file. If the base name(the file suffix is not - included) of the input video file is less than 32 characters long, the base name of input video - files will be used. If the length of base name of the input video file exceeds 32 characters, - the base name is truncated to the first 32 characters in total length. {Extension} - The - appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - - A unique index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video - bitrate. Not applicable to thumbnails. {Codec} - The type of the audio/video codec. - {Resolution} - The video resolution. Any unsubstituted macros will be collapsed and removed - from the filename. - :type filename_pattern: str - :param output_files: The list of output files to produce. Each entry in the list is a set of - audio and video layer labels to be muxed together . - :type output_files: list[~azure.mgmt.media.models.OutputFile] - """ - - _validation = { - 'odata_type': {'required': True}, - 'filename_pattern': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'filename_pattern': {'key': 'filenamePattern', 'type': 'str'}, - 'output_files': {'key': 'outputFiles', 'type': '[OutputFile]'}, - } - - _subtype_map = { - 'odata_type': {'#Microsoft.Media.Mp4Format': 'Mp4Format', '#Microsoft.Media.TransportStreamFormat': 'TransportStreamFormat'} - } - - def __init__( - self, - **kwargs - ): - super(MultiBitrateFormat, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.MultiBitrateFormat' # type: str - self.output_files = kwargs.get('output_files', None) - - -class Mp4Format(MultiBitrateFormat): - """Describes the properties for an output ISO MP4 file. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param filename_pattern: Required. The pattern of the file names for the generated output - files. The following macros are supported in the file name: {Basename} - An expansion macro - that will use the name of the input video file. If the base name(the file suffix is not - included) of the input video file is less than 32 characters long, the base name of input video - files will be used. If the length of base name of the input video file exceeds 32 characters, - the base name is truncated to the first 32 characters in total length. {Extension} - The - appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - - A unique index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video - bitrate. Not applicable to thumbnails. {Codec} - The type of the audio/video codec. - {Resolution} - The video resolution. Any unsubstituted macros will be collapsed and removed - from the filename. - :type filename_pattern: str - :param output_files: The list of output files to produce. Each entry in the list is a set of - audio and video layer labels to be muxed together . - :type output_files: list[~azure.mgmt.media.models.OutputFile] - """ - - _validation = { - 'odata_type': {'required': True}, - 'filename_pattern': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'filename_pattern': {'key': 'filenamePattern', 'type': 'str'}, - 'output_files': {'key': 'outputFiles', 'type': '[OutputFile]'}, - } - - def __init__( - self, - **kwargs - ): - super(Mp4Format, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.Mp4Format' # type: str - - -class NoEncryption(msrest.serialization.Model): - """Class for NoEncryption scheme. - - :param enabled_protocols: Representing supported protocols. - :type enabled_protocols: ~azure.mgmt.media.models.EnabledProtocols - """ - - _attribute_map = { - 'enabled_protocols': {'key': 'enabledProtocols', 'type': 'EnabledProtocols'}, - } - - def __init__( - self, - **kwargs - ): - super(NoEncryption, self).__init__(**kwargs) - self.enabled_protocols = kwargs.get('enabled_protocols', None) - - -class Operation(msrest.serialization.Model): - """An operation. - - 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: ~azure.mgmt.media.models.OperationDisplay - :param origin: Origin of the operation. - :type origin: str - :param properties: Operation properties format. - :type properties: ~azure.mgmt.media.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 ~azure.mgmt.media.models.ActionType - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'Properties'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'action_type': {'key': 'actionType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs['name'] - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.properties = kwargs.get('properties', None) - self.is_data_action = kwargs.get('is_data_action', None) - self.action_type = kwargs.get('action_type', None) - - -class OperationCollection(msrest.serialization.Model): - """A collection of Operation items. - - :param value: A collection of Operation items. - :type value: list[~azure.mgmt.media.models.Operation] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -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 - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OutputFile(msrest.serialization.Model): - """Represents an output file produced. - - All required parameters must be populated in order to send to Azure. - - :param labels: Required. The list of labels that describe how the encoder should multiplex - video and audio into an output file. For example, if the encoder is producing two video layers - with labels v1 and v2, and one audio layer with label a1, then an array like '[v1, a1]' tells - the encoder to produce an output file with the video track represented by v1 and the audio - track represented by a1. - :type labels: list[str] - """ - - _validation = { - 'labels': {'required': True}, - } - - _attribute_map = { - 'labels': {'key': 'labels', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(OutputFile, self).__init__(**kwargs) - self.labels = kwargs['labels'] - - -class PngFormat(ImageFormat): - """Describes the settings for producing PNG thumbnails. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param filename_pattern: Required. The pattern of the file names for the generated output - files. The following macros are supported in the file name: {Basename} - An expansion macro - that will use the name of the input video file. If the base name(the file suffix is not - included) of the input video file is less than 32 characters long, the base name of input video - files will be used. If the length of base name of the input video file exceeds 32 characters, - the base name is truncated to the first 32 characters in total length. {Extension} - The - appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - - A unique index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video - bitrate. Not applicable to thumbnails. {Codec} - The type of the audio/video codec. - {Resolution} - The video resolution. Any unsubstituted macros will be collapsed and removed - from the filename. - :type filename_pattern: str - """ - - _validation = { - 'odata_type': {'required': True}, - 'filename_pattern': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'filename_pattern': {'key': 'filenamePattern', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PngFormat, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.PngFormat' # type: str - - -class PngImage(Image): - """Describes the properties for producing a series of PNG images from the input video. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param label: An optional label for the codec. The label can be used to control muxing - behavior. - :type label: str - :param key_frame_interval: The distance between two key frames. The value should be non-zero in - the range [0.5, 20] seconds, specified in ISO 8601 format. The default is 2 seconds(PT2S). Note - that this setting is ignored if VideoSyncMode.Passthrough is set, where the KeyFrameInterval - value will follow the input source setting. - :type key_frame_interval: ~datetime.timedelta - :param stretch_mode: The resizing mode - how the input video will be resized to fit the desired - output resolution(s). Default is AutoSize. Possible values include: "None", "AutoSize", - "AutoFit". - :type stretch_mode: str or ~azure.mgmt.media.models.StretchMode - :param sync_mode: The Video Sync Mode. Possible values include: "Auto", "Passthrough", "Cfr", - "Vfr". - :type sync_mode: str or ~azure.mgmt.media.models.VideoSyncMode - :param start: Required. The position in the input video from where to start generating - thumbnails. The value can be in ISO 8601 format (For example, PT05S to start at 5 seconds), or - a frame count (For example, 10 to start at the 10th frame), or a relative value to stream - duration (For example, 10% to start at 10% of stream duration). Also supports a macro {Best}, - which tells the encoder to select the best thumbnail from the first few seconds of the video - and will only produce one thumbnail, no matter what other settings are for Step and Range. The - default value is macro {Best}. - :type start: str - :param step: The intervals at which thumbnails are generated. The value can be in ISO 8601 - format (For example, PT05S for one image every 5 seconds), or a frame count (For example, 30 - for one image every 30 frames), or a relative value to stream duration (For example, 10% for - one image every 10% of stream duration). Note: Step value will affect the first generated - thumbnail, which may not be exactly the one specified at transform preset start time. This is - due to the encoder, which tries to select the best thumbnail between start time and Step - position from start time as the first output. As the default value is 10%, it means if stream - has long duration, the first generated thumbnail might be far away from the one specified at - start time. Try to select reasonable value for Step if the first thumbnail is expected close to - start time, or set Range value at 1 if only one thumbnail is needed at start time. - :type step: str - :param range: The position relative to transform preset start time in the input video at which - to stop generating thumbnails. The value can be in ISO 8601 format (For example, PT5M30S to - stop at 5 minutes and 30 seconds from start time), or a frame count (For example, 300 to stop - at the 300th frame from the frame at start time. If this value is 1, it means only producing - one thumbnail at start time), or a relative value to the stream duration (For example, 50% to - stop at half of stream duration from start time). The default value is 100%, which means to - stop at the end of the stream. - :type range: str - :param layers: A collection of output PNG image layers to be produced by the encoder. - :type layers: list[~azure.mgmt.media.models.PngLayer] - """ - - _validation = { - 'odata_type': {'required': True}, - 'start': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'key_frame_interval': {'key': 'keyFrameInterval', 'type': 'duration'}, - 'stretch_mode': {'key': 'stretchMode', 'type': 'str'}, - 'sync_mode': {'key': 'syncMode', 'type': 'str'}, - 'start': {'key': 'start', 'type': 'str'}, - 'step': {'key': 'step', 'type': 'str'}, - 'range': {'key': 'range', 'type': 'str'}, - 'layers': {'key': 'layers', 'type': '[PngLayer]'}, - } - - def __init__( - self, - **kwargs - ): - super(PngImage, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.PngImage' # type: str - self.layers = kwargs.get('layers', None) - - -class PngLayer(Layer): - """Describes the settings to produce a PNG image from the input video. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param width: The width of the output video for this layer. The value can be absolute (in - pixels) or relative (in percentage). For example 50% means the output video has half as many - pixels in width as the input. - :type width: str - :param height: The height of the output video for this layer. The value can be absolute (in - pixels) or relative (in percentage). For example 50% means the output video has half as many - pixels in height as the input. - :type height: str - :param label: The alphanumeric label for this layer, which can be used in multiplexing - different video and audio layers, or in naming the output file. - :type label: str - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'width': {'key': 'width', 'type': 'str'}, - 'height': {'key': 'height', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PngLayer, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.PngLayer' # type: str - - -class PresentationTimeRange(msrest.serialization.Model): - """The presentation time range, this is asset related and not recommended for Account Filter. - - :param start_timestamp: The absolute start time boundary. - :type start_timestamp: long - :param end_timestamp: The absolute end time boundary. - :type end_timestamp: long - :param presentation_window_duration: The relative to end sliding window. - :type presentation_window_duration: long - :param live_backoff_duration: The relative to end right edge. - :type live_backoff_duration: long - :param timescale: The time scale of time stamps. - :type timescale: long - :param force_end_timestamp: The indicator of forcing existing of end time stamp. - :type force_end_timestamp: bool - """ - - _attribute_map = { - 'start_timestamp': {'key': 'startTimestamp', 'type': 'long'}, - 'end_timestamp': {'key': 'endTimestamp', 'type': 'long'}, - 'presentation_window_duration': {'key': 'presentationWindowDuration', 'type': 'long'}, - 'live_backoff_duration': {'key': 'liveBackoffDuration', 'type': 'long'}, - 'timescale': {'key': 'timescale', 'type': 'long'}, - 'force_end_timestamp': {'key': 'forceEndTimestamp', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(PresentationTimeRange, self).__init__(**kwargs) - self.start_timestamp = kwargs.get('start_timestamp', None) - self.end_timestamp = kwargs.get('end_timestamp', None) - self.presentation_window_duration = kwargs.get('presentation_window_duration', None) - self.live_backoff_duration = kwargs.get('live_backoff_duration', None) - self.timescale = kwargs.get('timescale', None) - self.force_end_timestamp = kwargs.get('force_end_timestamp', None) - - -class PresetConfigurations(msrest.serialization.Model): - """An object of optional configuration settings for encoder. - - :param complexity: Allows you to configure the encoder settings to control the balance between - speed and quality. Example: set Complexity as Speed for faster encoding but less compression - efficiency. Possible values include: "Speed", "Balanced", "Quality". - :type complexity: str or ~azure.mgmt.media.models.Complexity - :param interleave_output: Sets the interleave mode of the output to control how audio and video - are stored in the container format. Example: set InterleavedOutput as NonInterleavedOutput to - produce audio-only and video-only outputs in separate MP4 files. Possible values include: - "NonInterleavedOutput", "InterleavedOutput". - :type interleave_output: str or ~azure.mgmt.media.models.InterleaveOutput - :param key_frame_interval_in_seconds: The key frame interval in seconds. Example: set - KeyFrameIntervalInSeconds as 2 to reduce the playback buffering for some players. - :type key_frame_interval_in_seconds: float - :param max_bitrate_bps: The maximum bitrate in bits per second (threshold for the top video - layer). Example: set MaxBitrateBps as 6000000 to avoid producing very high bitrate outputs for - contents with high complexity. - :type max_bitrate_bps: int - :param max_height: The maximum height of output video layers. Example: set MaxHeight as 720 to - produce output layers up to 720P even if the input is 4K. - :type max_height: int - :param max_layers: The maximum number of output video layers. Example: set MaxLayers as 4 to - make sure at most 4 output layers are produced to control the overall cost of the encoding job. - :type max_layers: int - :param min_bitrate_bps: The minimum bitrate in bits per second (threshold for the bottom video - layer). Example: set MinBitrateBps as 200000 to have a bottom layer that covers users with low - network bandwidth. - :type min_bitrate_bps: int - :param min_height: The minimum height of output video layers. Example: set MinHeight as 360 to - avoid output layers of smaller resolutions like 180P. - :type min_height: int - """ - - _attribute_map = { - 'complexity': {'key': 'complexity', 'type': 'str'}, - 'interleave_output': {'key': 'interleaveOutput', 'type': 'str'}, - 'key_frame_interval_in_seconds': {'key': 'keyFrameIntervalInSeconds', 'type': 'float'}, - 'max_bitrate_bps': {'key': 'maxBitrateBps', 'type': 'int'}, - 'max_height': {'key': 'maxHeight', 'type': 'int'}, - 'max_layers': {'key': 'maxLayers', 'type': 'int'}, - 'min_bitrate_bps': {'key': 'minBitrateBps', 'type': 'int'}, - 'min_height': {'key': 'minHeight', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(PresetConfigurations, self).__init__(**kwargs) - self.complexity = kwargs.get('complexity', None) - self.interleave_output = kwargs.get('interleave_output', None) - self.key_frame_interval_in_seconds = kwargs.get('key_frame_interval_in_seconds', None) - self.max_bitrate_bps = kwargs.get('max_bitrate_bps', None) - self.max_height = kwargs.get('max_height', None) - self.max_layers = kwargs.get('max_layers', None) - self.min_bitrate_bps = kwargs.get('min_bitrate_bps', None) - self.min_height = kwargs.get('min_height', None) - - -class PrivateEndpoint(msrest.serialization.Model): - """The Private Endpoint resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ARM identifier for Private Endpoint. - :vartype id: str - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpoint, self).__init__(**kwargs) - self.id = None - - -class PrivateEndpointConnection(Resource): - """The Private Endpoint Connection resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~azure.mgmt.media.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: - ~azure.mgmt.media.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 - ~azure.mgmt.media.models.PrivateEndpointConnectionProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = None - - -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[~azure.mgmt.media.models.PrivateEndpointConnection] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateLinkResource(Resource): - """A private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :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] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResource, self).__init__(**kwargs) - self.group_id = None - self.required_members = None - self.required_zone_names = kwargs.get('required_zone_names', None) - - -class PrivateLinkResourceListResult(msrest.serialization.Model): - """A list of private link resources. - - :param value: Array of private link resources. - :type value: list[~azure.mgmt.media.models.PrivateLinkResource] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -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 - of the service. Possible values include: "Pending", "Approved", "Rejected". - :type status: str or ~azure.mgmt.media.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 - updates on the consumer. - :type actions_required: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.description = kwargs.get('description', None) - self.actions_required = kwargs.get('actions_required', None) - - -class Properties(msrest.serialization.Model): - """The service specification property. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar service_specification: The service specifications. - :vartype service_specification: ~azure.mgmt.media.models.ServiceSpecification - """ - - _validation = { - 'service_specification': {'readonly': True}, - } - - _attribute_map = { - 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(Properties, self).__init__(**kwargs) - self.service_specification = None - - -class Rectangle(msrest.serialization.Model): - """Describes the properties of a rectangular window applied to the input media before processing it. - - :param left: The number of pixels from the left-margin. This can be absolute pixel value (e.g - 100), or relative to the size of the video (For example, 50%). - :type left: str - :param top: The number of pixels from the top-margin. This can be absolute pixel value (e.g - 100), or relative to the size of the video (For example, 50%). - :type top: str - :param width: The width of the rectangular region in pixels. This can be absolute pixel value - (e.g 100), or relative to the size of the video (For example, 50%). - :type width: str - :param height: The height of the rectangular region in pixels. This can be absolute pixel value - (e.g 100), or relative to the size of the video (For example, 50%). - :type height: str - """ - - _attribute_map = { - 'left': {'key': 'left', 'type': 'str'}, - 'top': {'key': 'top', 'type': 'str'}, - 'width': {'key': 'width', 'type': 'str'}, - 'height': {'key': 'height', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Rectangle, self).__init__(**kwargs) - self.left = kwargs.get('left', None) - self.top = kwargs.get('top', None) - self.width = kwargs.get('width', None) - self.height = kwargs.get('height', None) - - -class ResourceIdentity(msrest.serialization.Model): - """ResourceIdentity. - - All required parameters must be populated in order to send to Azure. - - :param user_assigned_identity: The user assigned managed identity's ARM ID to use when - accessing a resource. - :type user_assigned_identity: str - :param use_system_assigned_identity: Required. Indicates whether to use System Assigned Managed - Identity. Mutual exclusive with User Assigned Managed Identity. - :type use_system_assigned_identity: bool - """ - - _validation = { - 'use_system_assigned_identity': {'required': True}, - } - - _attribute_map = { - 'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, - 'use_system_assigned_identity': {'key': 'useSystemAssignedIdentity', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceIdentity, self).__init__(**kwargs) - self.user_assigned_identity = kwargs.get('user_assigned_identity', None) - self.use_system_assigned_identity = kwargs['use_system_assigned_identity'] - - -class SelectAudioTrackByAttribute(AudioTrackDescriptor): - """Select audio tracks from the input by specifying an attribute and an attribute filter. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param channel_mapping: Optional designation for single channel audio tracks. Can be used to - combine the tracks into stereo or multi-channel audio tracks. Possible values include: - "FrontLeft", "FrontRight", "Center", "LowFrequencyEffects", "BackLeft", "BackRight", - "StereoLeft", "StereoRight". - :type channel_mapping: str or ~azure.mgmt.media.models.ChannelMapping - :param attribute: Required. The TrackAttribute to filter the tracks by. Possible values - include: "Bitrate", "Language". - :type attribute: str or ~azure.mgmt.media.models.TrackAttribute - :param filter: Required. The type of AttributeFilter to apply to the TrackAttribute in order to - select the tracks. Possible values include: "All", "Top", "Bottom", "ValueEquals". - :type filter: str or ~azure.mgmt.media.models.AttributeFilter - :param filter_value: The value to filter the tracks by. Only used when - AttributeFilter.ValueEquals is specified for the Filter property. - :type filter_value: str - """ - - _validation = { - 'odata_type': {'required': True}, - 'attribute': {'required': True}, - 'filter': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'channel_mapping': {'key': 'channelMapping', 'type': 'str'}, - 'attribute': {'key': 'attribute', 'type': 'str'}, - 'filter': {'key': 'filter', 'type': 'str'}, - 'filter_value': {'key': 'filterValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SelectAudioTrackByAttribute, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.SelectAudioTrackByAttribute' # type: str - self.attribute = kwargs['attribute'] - self.filter = kwargs['filter'] - self.filter_value = kwargs.get('filter_value', None) - - -class SelectAudioTrackById(AudioTrackDescriptor): - """Select audio tracks from the input by specifying a track identifier. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param channel_mapping: Optional designation for single channel audio tracks. Can be used to - combine the tracks into stereo or multi-channel audio tracks. Possible values include: - "FrontLeft", "FrontRight", "Center", "LowFrequencyEffects", "BackLeft", "BackRight", - "StereoLeft", "StereoRight". - :type channel_mapping: str or ~azure.mgmt.media.models.ChannelMapping - :param track_id: Required. Track identifier to select. - :type track_id: long - """ - - _validation = { - 'odata_type': {'required': True}, - 'track_id': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'channel_mapping': {'key': 'channelMapping', 'type': 'str'}, - 'track_id': {'key': 'trackId', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(SelectAudioTrackById, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.SelectAudioTrackById' # type: str - self.track_id = kwargs['track_id'] - - -class VideoTrackDescriptor(TrackDescriptor): - """A TrackSelection to select video tracks. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: SelectVideoTrackByAttribute, SelectVideoTrackById. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - } - - _subtype_map = { - 'odata_type': {'#Microsoft.Media.SelectVideoTrackByAttribute': 'SelectVideoTrackByAttribute', '#Microsoft.Media.SelectVideoTrackById': 'SelectVideoTrackById'} - } - - def __init__( - self, - **kwargs - ): - super(VideoTrackDescriptor, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.VideoTrackDescriptor' # type: str - - -class SelectVideoTrackByAttribute(VideoTrackDescriptor): - """Select video tracks from the input by specifying an attribute and an attribute filter. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param attribute: Required. The TrackAttribute to filter the tracks by. Possible values - include: "Bitrate", "Language". - :type attribute: str or ~azure.mgmt.media.models.TrackAttribute - :param filter: Required. The type of AttributeFilter to apply to the TrackAttribute in order to - select the tracks. Possible values include: "All", "Top", "Bottom", "ValueEquals". - :type filter: str or ~azure.mgmt.media.models.AttributeFilter - :param filter_value: The value to filter the tracks by. Only used when - AttributeFilter.ValueEquals is specified for the Filter property. For TrackAttribute.Bitrate, - this should be an integer value in bits per second (e.g: '1500000'). The - TrackAttribute.Language is not supported for video tracks. - :type filter_value: str - """ - - _validation = { - 'odata_type': {'required': True}, - 'attribute': {'required': True}, - 'filter': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'attribute': {'key': 'attribute', 'type': 'str'}, - 'filter': {'key': 'filter', 'type': 'str'}, - 'filter_value': {'key': 'filterValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SelectVideoTrackByAttribute, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.SelectVideoTrackByAttribute' # type: str - self.attribute = kwargs['attribute'] - self.filter = kwargs['filter'] - self.filter_value = kwargs.get('filter_value', None) - - -class SelectVideoTrackById(VideoTrackDescriptor): - """Select video tracks from the input by specifying a track identifier. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param track_id: Required. Track identifier to select. - :type track_id: long - """ - - _validation = { - 'odata_type': {'required': True}, - 'track_id': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'track_id': {'key': 'trackId', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(SelectVideoTrackById, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.SelectVideoTrackById' # type: str - self.track_id = kwargs['track_id'] - - -class ServiceSpecification(msrest.serialization.Model): - """The service metric specifications. - - 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[~azure.mgmt.media.models.LogSpecification] - :ivar metric_specifications: List of metric specifications. - :vartype metric_specifications: list[~azure.mgmt.media.models.MetricSpecification] - """ - - _validation = { - 'log_specifications': {'readonly': True}, - 'metric_specifications': {'readonly': True}, - } - - _attribute_map = { - 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.log_specifications = None - self.metric_specifications = None - - -class StandardEncoderPreset(Preset): - """Describes all the settings to be used when encoding the input video with the Standard Encoder. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param filters: One or more filtering operations that are applied to the input media before - encoding. - :type filters: ~azure.mgmt.media.models.Filters - :param codecs: Required. The list of codecs to be used when encoding the input video. - :type codecs: list[~azure.mgmt.media.models.Codec] - :param formats: Required. The list of outputs to be produced by the encoder. - :type formats: list[~azure.mgmt.media.models.Format] - """ - - _validation = { - 'odata_type': {'required': True}, - 'codecs': {'required': True}, - 'formats': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'filters': {'key': 'filters', 'type': 'Filters'}, - 'codecs': {'key': 'codecs', 'type': '[Codec]'}, - 'formats': {'key': 'formats', 'type': '[Format]'}, - } - - def __init__( - self, - **kwargs - ): - super(StandardEncoderPreset, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.StandardEncoderPreset' # type: str - self.filters = kwargs.get('filters', None) - self.codecs = kwargs['codecs'] - self.formats = kwargs['formats'] - - -class StorageAccount(msrest.serialization.Model): - """The storage account details. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param id: The ID of the storage account resource. Media Services relies on tables and queues - as well as blobs, so the primary storage account must be a Standard Storage account (either - Microsoft.ClassicStorage or Microsoft.Storage). Blob only storage accounts can be added as - secondary storage accounts. - :type id: str - :param type: Required. The type of the storage account. Possible values include: "Primary", - "Secondary". - :type type: str or ~azure.mgmt.media.models.StorageAccountType - :param identity: The storage account identity. - :type identity: ~azure.mgmt.media.models.ResourceIdentity - :ivar status: The current status of the storage account mapping. - :vartype status: str - """ - - _validation = { - 'type': {'required': True}, - 'status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'ResourceIdentity'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccount, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.type = kwargs['type'] - self.identity = kwargs.get('identity', None) - self.status = None - - -class StorageEncryptedAssetDecryptionData(msrest.serialization.Model): - """Data needed to decrypt asset files encrypted with legacy storage encryption. - - :param key: The Asset File storage encryption key. - :type key: bytearray - :param asset_file_encryption_metadata: Asset File encryption metadata. - :type asset_file_encryption_metadata: - list[~azure.mgmt.media.models.AssetFileEncryptionMetadata] - """ - - _attribute_map = { - 'key': {'key': 'key', 'type': 'bytearray'}, - 'asset_file_encryption_metadata': {'key': 'assetFileEncryptionMetadata', 'type': '[AssetFileEncryptionMetadata]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageEncryptedAssetDecryptionData, self).__init__(**kwargs) - self.key = kwargs.get('key', None) - self.asset_file_encryption_metadata = kwargs.get('asset_file_encryption_metadata', None) - - -class StreamingEndpoint(TrackedResource): - """The streaming endpoint. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :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 - :ivar system_data: The system metadata relating to this resource. - :vartype system_data: ~azure.mgmt.media.models.SystemData - :param description: The streaming endpoint description. - :type description: str - :param scale_units: The number of scale units. Use the Scale operation to adjust this value. - :type scale_units: int - :param availability_set_name: This feature is deprecated, do not set a value for this property. - :type availability_set_name: str - :param access_control: The access control definition of the streaming endpoint. - :type access_control: ~azure.mgmt.media.models.StreamingEndpointAccessControl - :param max_cache_age: Max cache age. - :type max_cache_age: long - :param custom_host_names: The custom host names of the streaming endpoint. - :type custom_host_names: list[str] - :ivar host_name: The streaming endpoint host name. - :vartype host_name: str - :param cdn_enabled: The CDN enabled flag. - :type cdn_enabled: bool - :param cdn_provider: The CDN provider name. - :type cdn_provider: str - :param cdn_profile: The CDN profile name. - :type cdn_profile: str - :ivar provisioning_state: The provisioning state of the streaming endpoint. - :vartype provisioning_state: str - :ivar resource_state: The resource state of the streaming endpoint. Possible values include: - "Stopped", "Starting", "Running", "Stopping", "Deleting", "Scaling". - :vartype resource_state: str or ~azure.mgmt.media.models.StreamingEndpointResourceState - :param cross_site_access_policies: The streaming endpoint access policies. - :type cross_site_access_policies: ~azure.mgmt.media.models.CrossSiteAccessPolicies - :ivar free_trial_end_time: The free trial expiration time. - :vartype free_trial_end_time: ~datetime.datetime - :ivar created: The exact time the streaming endpoint was created. - :vartype created: ~datetime.datetime - :ivar last_modified: The exact time the streaming endpoint was last modified. - :vartype last_modified: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - 'host_name': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'resource_state': {'readonly': True}, - 'free_trial_end_time': {'readonly': True}, - 'created': {'readonly': True}, - 'last_modified': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'scale_units': {'key': 'properties.scaleUnits', 'type': 'int'}, - 'availability_set_name': {'key': 'properties.availabilitySetName', 'type': 'str'}, - 'access_control': {'key': 'properties.accessControl', 'type': 'StreamingEndpointAccessControl'}, - 'max_cache_age': {'key': 'properties.maxCacheAge', 'type': 'long'}, - 'custom_host_names': {'key': 'properties.customHostNames', 'type': '[str]'}, - 'host_name': {'key': 'properties.hostName', 'type': 'str'}, - 'cdn_enabled': {'key': 'properties.cdnEnabled', 'type': 'bool'}, - 'cdn_provider': {'key': 'properties.cdnProvider', 'type': 'str'}, - 'cdn_profile': {'key': 'properties.cdnProfile', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, - 'cross_site_access_policies': {'key': 'properties.crossSiteAccessPolicies', 'type': 'CrossSiteAccessPolicies'}, - 'free_trial_end_time': {'key': 'properties.freeTrialEndTime', 'type': 'iso-8601'}, - 'created': {'key': 'properties.created', 'type': 'iso-8601'}, - 'last_modified': {'key': 'properties.lastModified', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(StreamingEndpoint, self).__init__(**kwargs) - self.system_data = None - self.description = kwargs.get('description', None) - self.scale_units = kwargs.get('scale_units', None) - self.availability_set_name = kwargs.get('availability_set_name', None) - self.access_control = kwargs.get('access_control', None) - self.max_cache_age = kwargs.get('max_cache_age', None) - self.custom_host_names = kwargs.get('custom_host_names', None) - self.host_name = None - self.cdn_enabled = kwargs.get('cdn_enabled', None) - self.cdn_provider = kwargs.get('cdn_provider', None) - self.cdn_profile = kwargs.get('cdn_profile', None) - self.provisioning_state = None - self.resource_state = None - self.cross_site_access_policies = kwargs.get('cross_site_access_policies', None) - self.free_trial_end_time = None - self.created = None - self.last_modified = None - - -class StreamingEndpointAccessControl(msrest.serialization.Model): - """Streaming endpoint access control definition. - - :param akamai: The access control of Akamai. - :type akamai: ~azure.mgmt.media.models.AkamaiAccessControl - :param ip: The IP access control of the streaming endpoint. - :type ip: ~azure.mgmt.media.models.IPAccessControl - """ - - _attribute_map = { - 'akamai': {'key': 'akamai', 'type': 'AkamaiAccessControl'}, - 'ip': {'key': 'ip', 'type': 'IPAccessControl'}, - } - - def __init__( - self, - **kwargs - ): - super(StreamingEndpointAccessControl, self).__init__(**kwargs) - self.akamai = kwargs.get('akamai', None) - self.ip = kwargs.get('ip', None) - - -class StreamingEndpointListResult(msrest.serialization.Model): - """The streaming endpoint list result. - - :param value: The result of the List StreamingEndpoint operation. - :type value: list[~azure.mgmt.media.models.StreamingEndpoint] - :param odata_count: The number of result. - :type odata_count: int - :param odata_next_link: The link to the next set of results. Not empty if value contains - incomplete list of streaming endpoints. - :type odata_next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StreamingEndpoint]'}, - 'odata_count': {'key': '@odata\\.count', 'type': 'int'}, - 'odata_next_link': {'key': '@odata\\.nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StreamingEndpointListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.odata_count = kwargs.get('odata_count', None) - self.odata_next_link = kwargs.get('odata_next_link', None) - - -class StreamingEntityScaleUnit(msrest.serialization.Model): - """scale units definition. - - :param scale_unit: The scale unit number of the streaming endpoint. - :type scale_unit: int - """ - - _attribute_map = { - 'scale_unit': {'key': 'scaleUnit', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(StreamingEntityScaleUnit, self).__init__(**kwargs) - self.scale_unit = kwargs.get('scale_unit', None) - - -class StreamingLocator(ProxyResource): - """A Streaming Locator resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: The system metadata relating to this resource. - :vartype system_data: ~azure.mgmt.media.models.SystemData - :param asset_name: Asset Name. - :type asset_name: str - :ivar created: The creation time of the Streaming Locator. - :vartype created: ~datetime.datetime - :param start_time: The start time of the Streaming Locator. - :type start_time: ~datetime.datetime - :param end_time: The end time of the Streaming Locator. - :type end_time: ~datetime.datetime - :param streaming_locator_id: The StreamingLocatorId of the Streaming Locator. - :type streaming_locator_id: str - :param streaming_policy_name: Name of the Streaming Policy used by this Streaming Locator. - Either specify the name of Streaming Policy you created or use one of the predefined Streaming - Policies. The predefined Streaming Policies available are: 'Predefined_DownloadOnly', - 'Predefined_ClearStreamingOnly', 'Predefined_DownloadAndClearStreaming', 'Predefined_ClearKey', - 'Predefined_MultiDrmCencStreaming' and 'Predefined_MultiDrmStreaming'. - :type streaming_policy_name: str - :param default_content_key_policy_name: Name of the default ContentKeyPolicy used by this - Streaming Locator. - :type default_content_key_policy_name: str - :param content_keys: The ContentKeys used by this Streaming Locator. - :type content_keys: list[~azure.mgmt.media.models.StreamingLocatorContentKey] - :param alternative_media_id: Alternative Media ID of this Streaming Locator. - :type alternative_media_id: str - :param filters: A list of asset or account filters which apply to this streaming locator. - :type filters: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'created': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'asset_name': {'key': 'properties.assetName', 'type': 'str'}, - 'created': {'key': 'properties.created', 'type': 'iso-8601'}, - 'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'properties.endTime', 'type': 'iso-8601'}, - 'streaming_locator_id': {'key': 'properties.streamingLocatorId', 'type': 'str'}, - 'streaming_policy_name': {'key': 'properties.streamingPolicyName', 'type': 'str'}, - 'default_content_key_policy_name': {'key': 'properties.defaultContentKeyPolicyName', 'type': 'str'}, - 'content_keys': {'key': 'properties.contentKeys', 'type': '[StreamingLocatorContentKey]'}, - 'alternative_media_id': {'key': 'properties.alternativeMediaId', 'type': 'str'}, - 'filters': {'key': 'properties.filters', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(StreamingLocator, self).__init__(**kwargs) - self.system_data = None - self.asset_name = kwargs.get('asset_name', None) - self.created = None - self.start_time = kwargs.get('start_time', None) - self.end_time = kwargs.get('end_time', None) - self.streaming_locator_id = kwargs.get('streaming_locator_id', None) - self.streaming_policy_name = kwargs.get('streaming_policy_name', None) - self.default_content_key_policy_name = kwargs.get('default_content_key_policy_name', None) - self.content_keys = kwargs.get('content_keys', None) - self.alternative_media_id = kwargs.get('alternative_media_id', None) - self.filters = kwargs.get('filters', None) - - -class StreamingLocatorCollection(msrest.serialization.Model): - """A collection of StreamingLocator items. - - :param value: A collection of StreamingLocator items. - :type value: list[~azure.mgmt.media.models.StreamingLocator] - :param odata_next_link: A link to the next page of the collection (when the collection contains - too many results to return in one response). - :type odata_next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StreamingLocator]'}, - 'odata_next_link': {'key': '@odata\\.nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StreamingLocatorCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.odata_next_link = kwargs.get('odata_next_link', None) - - -class StreamingLocatorContentKey(msrest.serialization.Model): - """Class for content key in Streaming Locator. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. ID of Content Key. - :type id: str - :ivar type: Encryption type of Content Key. Possible values include: "CommonEncryptionCenc", - "CommonEncryptionCbcs", "EnvelopeEncryption". - :vartype type: str or ~azure.mgmt.media.models.StreamingLocatorContentKeyType - :param label_reference_in_streaming_policy: Label of Content Key as specified in the Streaming - Policy. - :type label_reference_in_streaming_policy: str - :param value: Value of Content Key. - :type value: str - :ivar policy_name: ContentKeyPolicy used by Content Key. - :vartype policy_name: str - :ivar tracks: Tracks which use this Content Key. - :vartype tracks: list[~azure.mgmt.media.models.TrackSelection] - """ - - _validation = { - 'id': {'required': True}, - 'type': {'readonly': True}, - 'policy_name': {'readonly': True}, - 'tracks': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'label_reference_in_streaming_policy': {'key': 'labelReferenceInStreamingPolicy', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - 'policy_name': {'key': 'policyName', 'type': 'str'}, - 'tracks': {'key': 'tracks', 'type': '[TrackSelection]'}, - } - - def __init__( - self, - **kwargs - ): - super(StreamingLocatorContentKey, self).__init__(**kwargs) - self.id = kwargs['id'] - self.type = None - self.label_reference_in_streaming_policy = kwargs.get('label_reference_in_streaming_policy', None) - self.value = kwargs.get('value', None) - self.policy_name = None - self.tracks = None - - -class StreamingPath(msrest.serialization.Model): - """Class of paths for streaming. - - All required parameters must be populated in order to send to Azure. - - :param streaming_protocol: Required. Streaming protocol. Possible values include: "Hls", - "Dash", "SmoothStreaming", "Download". - :type streaming_protocol: str or ~azure.mgmt.media.models.StreamingPolicyStreamingProtocol - :param encryption_scheme: Required. Encryption scheme. Possible values include: "NoEncryption", - "EnvelopeEncryption", "CommonEncryptionCenc", "CommonEncryptionCbcs". - :type encryption_scheme: str or ~azure.mgmt.media.models.EncryptionScheme - :param paths: Streaming paths for each protocol and encryptionScheme pair. - :type paths: list[str] - """ - - _validation = { - 'streaming_protocol': {'required': True}, - 'encryption_scheme': {'required': True}, - } - - _attribute_map = { - 'streaming_protocol': {'key': 'streamingProtocol', 'type': 'str'}, - 'encryption_scheme': {'key': 'encryptionScheme', 'type': 'str'}, - 'paths': {'key': 'paths', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(StreamingPath, self).__init__(**kwargs) - self.streaming_protocol = kwargs['streaming_protocol'] - self.encryption_scheme = kwargs['encryption_scheme'] - self.paths = kwargs.get('paths', None) - - -class StreamingPolicy(ProxyResource): - """A Streaming Policy resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: The system metadata relating to this resource. - :vartype system_data: ~azure.mgmt.media.models.SystemData - :ivar created: Creation time of Streaming Policy. - :vartype created: ~datetime.datetime - :param default_content_key_policy_name: Default ContentKey used by current Streaming Policy. - :type default_content_key_policy_name: str - :param envelope_encryption: Configuration of EnvelopeEncryption. - :type envelope_encryption: ~azure.mgmt.media.models.EnvelopeEncryption - :param common_encryption_cenc: Configuration of CommonEncryptionCenc. - :type common_encryption_cenc: ~azure.mgmt.media.models.CommonEncryptionCenc - :param common_encryption_cbcs: Configuration of CommonEncryptionCbcs. - :type common_encryption_cbcs: ~azure.mgmt.media.models.CommonEncryptionCbcs - :param no_encryption: Configurations of NoEncryption. - :type no_encryption: ~azure.mgmt.media.models.NoEncryption - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'created': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'created': {'key': 'properties.created', 'type': 'iso-8601'}, - 'default_content_key_policy_name': {'key': 'properties.defaultContentKeyPolicyName', 'type': 'str'}, - 'envelope_encryption': {'key': 'properties.envelopeEncryption', 'type': 'EnvelopeEncryption'}, - 'common_encryption_cenc': {'key': 'properties.commonEncryptionCenc', 'type': 'CommonEncryptionCenc'}, - 'common_encryption_cbcs': {'key': 'properties.commonEncryptionCbcs', 'type': 'CommonEncryptionCbcs'}, - 'no_encryption': {'key': 'properties.noEncryption', 'type': 'NoEncryption'}, - } - - def __init__( - self, - **kwargs - ): - super(StreamingPolicy, self).__init__(**kwargs) - self.system_data = None - self.created = None - self.default_content_key_policy_name = kwargs.get('default_content_key_policy_name', None) - self.envelope_encryption = kwargs.get('envelope_encryption', None) - self.common_encryption_cenc = kwargs.get('common_encryption_cenc', None) - self.common_encryption_cbcs = kwargs.get('common_encryption_cbcs', None) - self.no_encryption = kwargs.get('no_encryption', None) - - -class StreamingPolicyCollection(msrest.serialization.Model): - """A collection of StreamingPolicy items. - - :param value: A collection of StreamingPolicy items. - :type value: list[~azure.mgmt.media.models.StreamingPolicy] - :param odata_next_link: A link to the next page of the collection (when the collection contains - too many results to return in one response). - :type odata_next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StreamingPolicy]'}, - 'odata_next_link': {'key': '@odata\\.nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StreamingPolicyCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.odata_next_link = kwargs.get('odata_next_link', None) - - -class StreamingPolicyContentKey(msrest.serialization.Model): - """Class to specify properties of content key. - - :param label: Label can be used to specify Content Key when creating a Streaming Locator. - :type label: str - :param policy_name: Policy used by Content Key. - :type policy_name: str - :param tracks: Tracks which use this content key. - :type tracks: list[~azure.mgmt.media.models.TrackSelection] - """ - - _attribute_map = { - 'label': {'key': 'label', 'type': 'str'}, - 'policy_name': {'key': 'policyName', 'type': 'str'}, - 'tracks': {'key': 'tracks', 'type': '[TrackSelection]'}, - } - - def __init__( - self, - **kwargs - ): - super(StreamingPolicyContentKey, self).__init__(**kwargs) - self.label = kwargs.get('label', None) - self.policy_name = kwargs.get('policy_name', None) - self.tracks = kwargs.get('tracks', None) - - -class StreamingPolicyContentKeys(msrest.serialization.Model): - """Class to specify properties of all content keys in Streaming Policy. - - :param default_key: Default content key for an encryption scheme. - :type default_key: ~azure.mgmt.media.models.DefaultKey - :param key_to_track_mappings: Representing tracks needs separate content key. - :type key_to_track_mappings: list[~azure.mgmt.media.models.StreamingPolicyContentKey] - """ - - _attribute_map = { - 'default_key': {'key': 'defaultKey', 'type': 'DefaultKey'}, - 'key_to_track_mappings': {'key': 'keyToTrackMappings', 'type': '[StreamingPolicyContentKey]'}, - } - - def __init__( - self, - **kwargs - ): - super(StreamingPolicyContentKeys, self).__init__(**kwargs) - self.default_key = kwargs.get('default_key', None) - self.key_to_track_mappings = kwargs.get('key_to_track_mappings', None) - - -class StreamingPolicyFairPlayConfiguration(msrest.serialization.Model): - """Class to specify configurations of FairPlay in Streaming Policy. - - All required parameters must be populated in order to send to Azure. - - :param custom_license_acquisition_url_template: Template for the URL of the custom service - delivering licenses to end user players. Not required when using Azure Media Services for - issuing licenses. The template supports replaceable tokens that the service will update at - runtime with the value specific to the request. The currently supported token values are - {AlternativeMediaId}, which is replaced with the value of - StreamingLocatorId.AlternativeMediaId, and {ContentKeyId}, which is replaced with the value of - identifier of the key being requested. - :type custom_license_acquisition_url_template: str - :param allow_persistent_license: Required. All license to be persistent or not. - :type allow_persistent_license: bool - """ - - _validation = { - 'allow_persistent_license': {'required': True}, - } - - _attribute_map = { - 'custom_license_acquisition_url_template': {'key': 'customLicenseAcquisitionUrlTemplate', 'type': 'str'}, - 'allow_persistent_license': {'key': 'allowPersistentLicense', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(StreamingPolicyFairPlayConfiguration, self).__init__(**kwargs) - self.custom_license_acquisition_url_template = kwargs.get('custom_license_acquisition_url_template', None) - self.allow_persistent_license = kwargs['allow_persistent_license'] - - -class StreamingPolicyPlayReadyConfiguration(msrest.serialization.Model): - """Class to specify configurations of PlayReady in Streaming Policy. - - :param custom_license_acquisition_url_template: Template for the URL of the custom service - delivering licenses to end user players. Not required when using Azure Media Services for - issuing licenses. The template supports replaceable tokens that the service will update at - runtime with the value specific to the request. The currently supported token values are - {AlternativeMediaId}, which is replaced with the value of - StreamingLocatorId.AlternativeMediaId, and {ContentKeyId}, which is replaced with the value of - identifier of the key being requested. - :type custom_license_acquisition_url_template: str - :param play_ready_custom_attributes: Custom attributes for PlayReady. - :type play_ready_custom_attributes: str - """ - - _attribute_map = { - 'custom_license_acquisition_url_template': {'key': 'customLicenseAcquisitionUrlTemplate', 'type': 'str'}, - 'play_ready_custom_attributes': {'key': 'playReadyCustomAttributes', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StreamingPolicyPlayReadyConfiguration, self).__init__(**kwargs) - self.custom_license_acquisition_url_template = kwargs.get('custom_license_acquisition_url_template', None) - self.play_ready_custom_attributes = kwargs.get('play_ready_custom_attributes', None) - - -class StreamingPolicyWidevineConfiguration(msrest.serialization.Model): - """Class to specify configurations of Widevine in Streaming Policy. - - :param custom_license_acquisition_url_template: Template for the URL of the custom service - delivering licenses to end user players. Not required when using Azure Media Services for - issuing licenses. The template supports replaceable tokens that the service will update at - runtime with the value specific to the request. The currently supported token values are - {AlternativeMediaId}, which is replaced with the value of - StreamingLocatorId.AlternativeMediaId, and {ContentKeyId}, which is replaced with the value of - identifier of the key being requested. - :type custom_license_acquisition_url_template: str - """ - - _attribute_map = { - 'custom_license_acquisition_url_template': {'key': 'customLicenseAcquisitionUrlTemplate', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StreamingPolicyWidevineConfiguration, self).__init__(**kwargs) - self.custom_license_acquisition_url_template = kwargs.get('custom_license_acquisition_url_template', None) - - -class SyncStorageKeysInput(msrest.serialization.Model): - """The input to the sync storage keys request. - - :param id: The ID of the storage account resource. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SyncStorageKeysInput, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -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 ~azure.mgmt.media.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 - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure.mgmt.media.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class TrackPropertyCondition(msrest.serialization.Model): - """Class to specify one track property condition. - - All required parameters must be populated in order to send to Azure. - - :param property: Required. Track property type. Possible values include: "Unknown", "FourCC". - :type property: str or ~azure.mgmt.media.models.TrackPropertyType - :param operation: Required. Track property condition operation. Possible values include: - "Unknown", "Equal". - :type operation: str or ~azure.mgmt.media.models.TrackPropertyCompareOperation - :param value: Track property value. - :type value: str - """ - - _validation = { - 'property': {'required': True}, - 'operation': {'required': True}, - } - - _attribute_map = { - 'property': {'key': 'property', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackPropertyCondition, self).__init__(**kwargs) - self.property = kwargs['property'] - self.operation = kwargs['operation'] - self.value = kwargs.get('value', None) - - -class TrackSelection(msrest.serialization.Model): - """Class to select a track. - - :param track_selections: TrackSelections is a track property condition list which can specify - track(s). - :type track_selections: list[~azure.mgmt.media.models.TrackPropertyCondition] - """ - - _attribute_map = { - 'track_selections': {'key': 'trackSelections', 'type': '[TrackPropertyCondition]'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackSelection, self).__init__(**kwargs) - self.track_selections = kwargs.get('track_selections', None) - - -class Transform(ProxyResource): - """A Transform encapsulates the rules or instructions for generating desired outputs from input media, such as by transcoding or by extracting insights. After the Transform is created, it can be applied to input media by creating Jobs. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: The system metadata relating to this resource. - :vartype system_data: ~azure.mgmt.media.models.SystemData - :ivar created: The UTC date and time when the Transform was created, in 'YYYY-MM-DDThh:mm:ssZ' - format. - :vartype created: ~datetime.datetime - :param description: An optional verbose description of the Transform. - :type description: str - :ivar last_modified: The UTC date and time when the Transform was last updated, in - 'YYYY-MM-DDThh:mm:ssZ' format. - :vartype last_modified: ~datetime.datetime - :param outputs: An array of one or more TransformOutputs that the Transform should generate. - :type outputs: list[~azure.mgmt.media.models.TransformOutput] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'created': {'readonly': True}, - 'last_modified': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'created': {'key': 'properties.created', 'type': 'iso-8601'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'last_modified': {'key': 'properties.lastModified', 'type': 'iso-8601'}, - 'outputs': {'key': 'properties.outputs', 'type': '[TransformOutput]'}, - } - - def __init__( - self, - **kwargs - ): - super(Transform, self).__init__(**kwargs) - self.system_data = None - self.created = None - self.description = kwargs.get('description', None) - self.last_modified = None - self.outputs = kwargs.get('outputs', None) - - -class TransformCollection(msrest.serialization.Model): - """A collection of Transform items. - - :param value: A collection of Transform items. - :type value: list[~azure.mgmt.media.models.Transform] - :param odata_next_link: A link to the next page of the collection (when the collection contains - too many results to return in one response). - :type odata_next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Transform]'}, - 'odata_next_link': {'key': '@odata\\.nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TransformCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.odata_next_link = kwargs.get('odata_next_link', None) - - -class TransformOutput(msrest.serialization.Model): - """Describes the properties of a TransformOutput, which are the rules to be applied while generating the desired output. - - All required parameters must be populated in order to send to Azure. - - :param on_error: A Transform can define more than one outputs. This property defines what the - service should do when one output fails - either continue to produce other outputs, or, stop - the other outputs. The overall Job state will not reflect failures of outputs that are - specified with 'ContinueJob'. The default is 'StopProcessingJob'. Possible values include: - "StopProcessingJob", "ContinueJob". - :type on_error: str or ~azure.mgmt.media.models.OnErrorType - :param relative_priority: Sets the relative priority of the TransformOutputs within a - Transform. This sets the priority that the service uses for processing TransformOutputs. The - default priority is Normal. Possible values include: "Low", "Normal", "High". - :type relative_priority: str or ~azure.mgmt.media.models.Priority - :param preset: Required. Preset that describes the operations that will be used to modify, - transcode, or extract insights from the source file to generate the output. - :type preset: ~azure.mgmt.media.models.Preset - """ - - _validation = { - 'preset': {'required': True}, - } - - _attribute_map = { - 'on_error': {'key': 'onError', 'type': 'str'}, - 'relative_priority': {'key': 'relativePriority', 'type': 'str'}, - 'preset': {'key': 'preset', 'type': 'Preset'}, - } - - def __init__( - self, - **kwargs - ): - super(TransformOutput, self).__init__(**kwargs) - self.on_error = kwargs.get('on_error', None) - self.relative_priority = kwargs.get('relative_priority', None) - self.preset = kwargs['preset'] - - -class TransportStreamFormat(MultiBitrateFormat): - """Describes the properties for generating an MPEG-2 Transport Stream (ISO/IEC 13818-1) output video file(s). - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param filename_pattern: Required. The pattern of the file names for the generated output - files. The following macros are supported in the file name: {Basename} - An expansion macro - that will use the name of the input video file. If the base name(the file suffix is not - included) of the input video file is less than 32 characters long, the base name of input video - files will be used. If the length of base name of the input video file exceeds 32 characters, - the base name is truncated to the first 32 characters in total length. {Extension} - The - appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - - A unique index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video - bitrate. Not applicable to thumbnails. {Codec} - The type of the audio/video codec. - {Resolution} - The video resolution. Any unsubstituted macros will be collapsed and removed - from the filename. - :type filename_pattern: str - :param output_files: The list of output files to produce. Each entry in the list is a set of - audio and video layer labels to be muxed together . - :type output_files: list[~azure.mgmt.media.models.OutputFile] - """ - - _validation = { - 'odata_type': {'required': True}, - 'filename_pattern': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'filename_pattern': {'key': 'filenamePattern', 'type': 'str'}, - 'output_files': {'key': 'outputFiles', 'type': '[OutputFile]'}, - } - - def __init__( - self, - **kwargs - ): - super(TransportStreamFormat, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.TransportStreamFormat' # type: str - - -class UserAssignedManagedIdentity(msrest.serialization.Model): - """UserAssignedManagedIdentity. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar client_id: The client ID. - :vartype client_id: str - :ivar principal_id: The principal ID. - :vartype principal_id: str - """ - - _validation = { - 'client_id': {'readonly': True}, - 'principal_id': {'readonly': True}, - } - - _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserAssignedManagedIdentity, self).__init__(**kwargs) - self.client_id = None - self.principal_id = None - - -class UtcClipTime(ClipTime): - """Specifies the clip time as a Utc time position in the media file. The Utc time can point to a different position depending on whether the media file starts from a timestamp of zero or not. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param time: Required. The time position on the timeline of the input media based on Utc time. - :type time: ~datetime.datetime - """ - - _validation = { - 'odata_type': {'required': True}, - 'time': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'time': {'key': 'time', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(UtcClipTime, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.UtcClipTime' # type: str - self.time = kwargs['time'] - - -class VideoAnalyzerPreset(AudioAnalyzerPreset): - """A video analyzer preset that extracts insights (rich metadata) from both audio and video, and outputs a JSON format file. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param audio_language: The language for the audio payload in the input using the BCP-47 format - of 'language tag-region' (e.g: 'en-US'). If you know the language of your content, it is - recommended that you specify it. The language must be specified explicitly for - AudioAnalysisMode::Basic, since automatic language detection is not included in basic mode. If - the language isn't specified or set to null, automatic language detection will choose the first - language detected and process with the selected language for the duration of the file. It does - not currently support dynamically switching between languages after the first language is - detected. The automatic detection works best with audio recordings with clearly discernable - speech. If automatic detection fails to find the language, transcription would fallback to - 'en-US'." The list of supported languages is available here: - https://go.microsoft.com/fwlink/?linkid=2109463. - :type audio_language: str - :param mode: Determines the set of audio analysis operations to be performed. If unspecified, - the Standard AudioAnalysisMode would be chosen. Possible values include: "Standard", "Basic". - :type mode: str or ~azure.mgmt.media.models.AudioAnalysisMode - :param experimental_options: Dictionary containing key value pairs for parameters not exposed - in the preset itself. - :type experimental_options: dict[str, str] - :param insights_to_extract: Defines the type of insights that you want the service to generate. - The allowed values are 'AudioInsightsOnly', 'VideoInsightsOnly', and 'AllInsights'. The default - is AllInsights. If you set this to AllInsights and the input is audio only, then only audio - insights are generated. Similarly if the input is video only, then only video insights are - generated. It is recommended that you not use AudioInsightsOnly if you expect some of your - inputs to be video only; or use VideoInsightsOnly if you expect some of your inputs to be audio - only. Your Jobs in such conditions would error out. Possible values include: - "AudioInsightsOnly", "VideoInsightsOnly", "AllInsights". - :type insights_to_extract: str or ~azure.mgmt.media.models.InsightsType - """ - - _validation = { - 'odata_type': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'audio_language': {'key': 'audioLanguage', 'type': 'str'}, - 'mode': {'key': 'mode', 'type': 'str'}, - 'experimental_options': {'key': 'experimentalOptions', 'type': '{str}'}, - 'insights_to_extract': {'key': 'insightsToExtract', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VideoAnalyzerPreset, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.VideoAnalyzerPreset' # type: str - self.insights_to_extract = kwargs.get('insights_to_extract', None) - - -class VideoOverlay(Overlay): - """Describes the properties of a video overlay. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param input_label: Required. The label of the job input which is to be used as an overlay. The - Input must specify exactly one file. You can specify an image file in JPG, PNG, GIF or BMP - format, or an audio file (such as a WAV, MP3, WMA or M4A file), or a video file. See - https://aka.ms/mesformats for the complete list of supported audio and video file formats. - :type input_label: str - :param start: The start position, with reference to the input video, at which the overlay - starts. The value should be in ISO 8601 format. For example, PT05S to start the overlay at 5 - seconds into the input video. If not specified the overlay starts from the beginning of the - input video. - :type start: ~datetime.timedelta - :param end: The end position, with reference to the input video, at which the overlay ends. The - value should be in ISO 8601 format. For example, PT30S to end the overlay at 30 seconds into - the input video. If not specified or the value is greater than the input video duration, the - overlay will be applied until the end of the input video if the overlay media duration is - greater than the input video duration, else the overlay will last as long as the overlay media - duration. - :type end: ~datetime.timedelta - :param fade_in_duration: The duration over which the overlay fades in onto the input video. The - value should be in ISO 8601 duration format. If not specified the default behavior is to have - no fade in (same as PT0S). - :type fade_in_duration: ~datetime.timedelta - :param fade_out_duration: The duration over which the overlay fades out of the input video. The - value should be in ISO 8601 duration format. If not specified the default behavior is to have - no fade out (same as PT0S). - :type fade_out_duration: ~datetime.timedelta - :param audio_gain_level: The gain level of audio in the overlay. The value should be in the - range [0, 1.0]. The default is 1.0. - :type audio_gain_level: float - :param position: The location in the input video where the overlay is applied. - :type position: ~azure.mgmt.media.models.Rectangle - :param opacity: The opacity of the overlay. This is a value in the range [0 - 1.0]. Default is - 1.0 which mean the overlay is opaque. - :type opacity: float - :param crop_rectangle: An optional rectangular window used to crop the overlay image or video. - :type crop_rectangle: ~azure.mgmt.media.models.Rectangle - """ - - _validation = { - 'odata_type': {'required': True}, - 'input_label': {'required': True}, - } - - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, - 'input_label': {'key': 'inputLabel', 'type': 'str'}, - 'start': {'key': 'start', 'type': 'duration'}, - 'end': {'key': 'end', 'type': 'duration'}, - 'fade_in_duration': {'key': 'fadeInDuration', 'type': 'duration'}, - 'fade_out_duration': {'key': 'fadeOutDuration', 'type': 'duration'}, - 'audio_gain_level': {'key': 'audioGainLevel', 'type': 'float'}, - 'position': {'key': 'position', 'type': 'Rectangle'}, - 'opacity': {'key': 'opacity', 'type': 'float'}, - 'crop_rectangle': {'key': 'cropRectangle', 'type': 'Rectangle'}, - } - - def __init__( - self, - **kwargs - ): - super(VideoOverlay, self).__init__(**kwargs) - self.odata_type = '#Microsoft.Media.VideoOverlay' # type: str - self.position = kwargs.get('position', None) - self.opacity = kwargs.get('opacity', None) - self.crop_rectangle = kwargs.get('crop_rectangle', None) diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/models/_models_py3.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/models/_models_py3.py index 1dabc83d5c1e..e0124d4074bc 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/models/_models_py3.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/models/_models_py3.py @@ -23,11 +23,10 @@ class Codec(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param label: An optional label for the codec. The label can be used to control muxing - behavior. - :type label: str + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar label: An optional label for the codec. The label can be used to control muxing behavior. + :vartype label: str """ _validation = { @@ -49,6 +48,11 @@ def __init__( label: Optional[str] = None, **kwargs ): + """ + :keyword label: An optional label for the codec. The label can be used to control muxing + behavior. + :paramtype label: str + """ super(Codec, self).__init__(**kwargs) self.odata_type = None # type: Optional[str] self.label = label @@ -62,17 +66,16 @@ class Audio(Codec): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param label: An optional label for the codec. The label can be used to control muxing - behavior. - :type label: str - :param channels: The number of channels in the audio. - :type channels: int - :param sampling_rate: The sampling rate to use for encoding in hertz. - :type sampling_rate: int - :param bitrate: The bitrate, in bits per second, of the output encoded audio. - :type bitrate: int + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar label: An optional label for the codec. The label can be used to control muxing behavior. + :vartype label: str + :ivar channels: The number of channels in the audio. + :vartype channels: int + :ivar sampling_rate: The sampling rate to use for encoding in hertz. + :vartype sampling_rate: int + :ivar bitrate: The bitrate, in bits per second, of the output encoded audio. + :vartype bitrate: int """ _validation = { @@ -100,6 +103,17 @@ def __init__( bitrate: Optional[int] = None, **kwargs ): + """ + :keyword label: An optional label for the codec. The label can be used to control muxing + behavior. + :paramtype label: str + :keyword channels: The number of channels in the audio. + :paramtype channels: int + :keyword sampling_rate: The sampling rate to use for encoding in hertz. + :paramtype sampling_rate: int + :keyword bitrate: The bitrate, in bits per second, of the output encoded audio. + :paramtype bitrate: int + """ super(Audio, self).__init__(label=label, **kwargs) self.odata_type = '#Microsoft.Media.Audio' # type: str self.channels = channels @@ -112,20 +126,19 @@ class AacAudio(Audio): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param label: An optional label for the codec. The label can be used to control muxing - behavior. - :type label: str - :param channels: The number of channels in the audio. - :type channels: int - :param sampling_rate: The sampling rate to use for encoding in hertz. - :type sampling_rate: int - :param bitrate: The bitrate, in bits per second, of the output encoded audio. - :type bitrate: int - :param profile: The encoding profile to be used when encoding audio with AAC. Possible values + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar label: An optional label for the codec. The label can be used to control muxing behavior. + :vartype label: str + :ivar channels: The number of channels in the audio. + :vartype channels: int + :ivar sampling_rate: The sampling rate to use for encoding in hertz. + :vartype sampling_rate: int + :ivar bitrate: The bitrate, in bits per second, of the output encoded audio. + :vartype bitrate: int + :ivar profile: The encoding profile to be used when encoding audio with AAC. Possible values include: "AacLc", "HeAacV1", "HeAacV2". - :type profile: str or ~azure.mgmt.media.models.AacAudioProfile + :vartype profile: str or ~azure.mgmt.media.models.AacAudioProfile """ _validation = { @@ -151,6 +164,20 @@ def __init__( profile: Optional[Union[str, "AacAudioProfile"]] = None, **kwargs ): + """ + :keyword label: An optional label for the codec. The label can be used to control muxing + behavior. + :paramtype label: str + :keyword channels: The number of channels in the audio. + :paramtype channels: int + :keyword sampling_rate: The sampling rate to use for encoding in hertz. + :paramtype sampling_rate: int + :keyword bitrate: The bitrate, in bits per second, of the output encoded audio. + :paramtype bitrate: int + :keyword profile: The encoding profile to be used when encoding audio with AAC. Possible values + include: "AacLc", "HeAacV1", "HeAacV2". + :paramtype profile: str or ~azure.mgmt.media.models.AacAudioProfile + """ super(AacAudio, self).__init__(label=label, channels=channels, sampling_rate=sampling_rate, bitrate=bitrate, **kwargs) self.odata_type = '#Microsoft.Media.AacAudio' # type: str self.profile = profile @@ -164,8 +191,8 @@ class ClipTime(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str """ _validation = { @@ -184,6 +211,8 @@ def __init__( self, **kwargs ): + """ + """ super(ClipTime, self).__init__(**kwargs) self.odata_type = None # type: Optional[str] @@ -193,11 +222,11 @@ class AbsoluteClipTime(ClipTime): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param time: Required. The time position on the timeline of the input media. It is usually + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar time: Required. The time position on the timeline of the input media. It is usually specified as an ISO8601 period. e.g PT30S for 30 seconds. - :type time: ~datetime.timedelta + :vartype time: ~datetime.timedelta """ _validation = { @@ -216,6 +245,11 @@ def __init__( time: datetime.timedelta, **kwargs ): + """ + :keyword time: Required. The time position on the timeline of the input media. It is usually + specified as an ISO8601 period. e.g PT30S for 30 seconds. + :paramtype time: ~datetime.timedelta + """ super(AbsoluteClipTime, self).__init__(**kwargs) self.odata_type = '#Microsoft.Media.AbsoluteClipTime' # type: str self.time = time @@ -224,12 +258,12 @@ def __init__( class AccessControl(msrest.serialization.Model): """AccessControl. - :param default_action: The behavior for IP access control in Key Delivery. Possible values + :ivar default_action: The behavior for IP access control in Key Delivery. Possible values include: "Allow", "Deny". - :type default_action: str or ~azure.mgmt.media.models.DefaultAction - :param ip_allow_list: The IP allow list for access control in Key Delivery. If the default + :vartype default_action: str or ~azure.mgmt.media.models.DefaultAction + :ivar ip_allow_list: The IP allow list for access control in Key Delivery. If the default action is set to 'Allow', the IP allow list must be empty. - :type ip_allow_list: list[str] + :vartype ip_allow_list: list[str] """ _attribute_map = { @@ -244,6 +278,14 @@ def __init__( ip_allow_list: Optional[List[str]] = None, **kwargs ): + """ + :keyword default_action: The behavior for IP access control in Key Delivery. Possible values + include: "Allow", "Deny". + :paramtype default_action: str or ~azure.mgmt.media.models.DefaultAction + :keyword ip_allow_list: The IP allow list for access control in Key Delivery. If the default + action is set to 'Allow', the IP allow list must be empty. + :paramtype ip_allow_list: list[str] + """ super(AccessControl, self).__init__(**kwargs) self.default_action = default_action self.ip_allow_list = ip_allow_list @@ -256,13 +298,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 ~azure.mgmt.media.models.AccountEncryptionKeyType - :param key_vault_properties: The properties of the key used to encrypt the account. - :type key_vault_properties: ~azure.mgmt.media.models.KeyVaultProperties - :param identity: The Key Vault identity. - :type identity: ~azure.mgmt.media.models.ResourceIdentity + :ivar type: Required. The type of key used to encrypt the Account Key. Possible values include: + "SystemKey", "CustomerKey". + :vartype type: str or ~azure.mgmt.media.models.AccountEncryptionKeyType + :ivar key_vault_properties: The properties of the key used to encrypt the account. + :vartype key_vault_properties: ~azure.mgmt.media.models.KeyVaultProperties + :ivar identity: The Key Vault identity. + :vartype identity: ~azure.mgmt.media.models.ResourceIdentity :ivar status: The current status of the Key Vault mapping. :vartype status: str """ @@ -287,6 +329,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 ~azure.mgmt.media.models.AccountEncryptionKeyType + :keyword key_vault_properties: The properties of the key used to encrypt the account. + :paramtype key_vault_properties: ~azure.mgmt.media.models.KeyVaultProperties + :keyword identity: The Key Vault identity. + :paramtype identity: ~azure.mgmt.media.models.ResourceIdentity + """ super(AccountEncryption, self).__init__(**kwargs) self.type = type self.key_vault_properties = key_vault_properties @@ -325,6 +376,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -362,6 +415,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -380,12 +435,12 @@ class AccountFilter(ProxyResource): :vartype type: str :ivar system_data: The system metadata relating to this resource. :vartype system_data: ~azure.mgmt.media.models.SystemData - :param presentation_time_range: The presentation time range. - :type presentation_time_range: ~azure.mgmt.media.models.PresentationTimeRange - :param first_quality: The first quality. - :type first_quality: ~azure.mgmt.media.models.FirstQuality - :param tracks: The tracks selection conditions. - :type tracks: list[~azure.mgmt.media.models.FilterTrackSelection] + :ivar presentation_time_range: The presentation time range. + :vartype presentation_time_range: ~azure.mgmt.media.models.PresentationTimeRange + :ivar first_quality: The first quality. + :vartype first_quality: ~azure.mgmt.media.models.FirstQuality + :ivar tracks: The tracks selection conditions. + :vartype tracks: list[~azure.mgmt.media.models.FilterTrackSelection] """ _validation = { @@ -413,6 +468,14 @@ def __init__( tracks: Optional[List["FilterTrackSelection"]] = None, **kwargs ): + """ + :keyword presentation_time_range: The presentation time range. + :paramtype presentation_time_range: ~azure.mgmt.media.models.PresentationTimeRange + :keyword first_quality: The first quality. + :paramtype first_quality: ~azure.mgmt.media.models.FirstQuality + :keyword tracks: The tracks selection conditions. + :paramtype tracks: list[~azure.mgmt.media.models.FilterTrackSelection] + """ super(AccountFilter, self).__init__(**kwargs) self.system_data = None self.presentation_time_range = presentation_time_range @@ -423,11 +486,11 @@ def __init__( class AccountFilterCollection(msrest.serialization.Model): """A collection of AccountFilter items. - :param value: A collection of AccountFilter items. - :type value: list[~azure.mgmt.media.models.AccountFilter] - :param odata_next_link: A link to the next page of the collection (when the collection contains + :ivar value: A collection of AccountFilter items. + :vartype value: list[~azure.mgmt.media.models.AccountFilter] + :ivar odata_next_link: A link to the next page of the collection (when the collection contains too many results to return in one response). - :type odata_next_link: str + :vartype odata_next_link: str """ _attribute_map = { @@ -442,6 +505,13 @@ def __init__( odata_next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: A collection of AccountFilter items. + :paramtype value: list[~azure.mgmt.media.models.AccountFilter] + :keyword odata_next_link: A link to the next page of the collection (when the collection + contains too many results to return in one response). + :paramtype odata_next_link: str + """ super(AccountFilterCollection, self).__init__(**kwargs) self.value = value self.odata_next_link = odata_next_link @@ -450,8 +520,8 @@ def __init__( class AkamaiAccessControl(msrest.serialization.Model): """Akamai access control. - :param akamai_signature_header_authentication_key_list: authentication key list. - :type akamai_signature_header_authentication_key_list: + :ivar akamai_signature_header_authentication_key_list: authentication key list. + :vartype akamai_signature_header_authentication_key_list: list[~azure.mgmt.media.models.AkamaiSignatureHeaderAuthenticationKey] """ @@ -465,6 +535,11 @@ def __init__( akamai_signature_header_authentication_key_list: Optional[List["AkamaiSignatureHeaderAuthenticationKey"]] = None, **kwargs ): + """ + :keyword akamai_signature_header_authentication_key_list: authentication key list. + :paramtype akamai_signature_header_authentication_key_list: + list[~azure.mgmt.media.models.AkamaiSignatureHeaderAuthenticationKey] + """ super(AkamaiAccessControl, self).__init__(**kwargs) self.akamai_signature_header_authentication_key_list = akamai_signature_header_authentication_key_list @@ -472,12 +547,12 @@ def __init__( class AkamaiSignatureHeaderAuthenticationKey(msrest.serialization.Model): """Akamai Signature Header authentication key. - :param identifier: identifier of the key. - :type identifier: str - :param base64_key: authentication key. - :type base64_key: str - :param expiration: The expiration time of the authentication key. - :type expiration: ~datetime.datetime + :ivar identifier: identifier of the key. + :vartype identifier: str + :ivar base64_key: authentication key. + :vartype base64_key: str + :ivar expiration: The expiration time of the authentication key. + :vartype expiration: ~datetime.datetime """ _attribute_map = { @@ -494,12 +569,170 @@ def __init__( expiration: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword identifier: identifier of the key. + :paramtype identifier: str + :keyword base64_key: authentication key. + :paramtype base64_key: str + :keyword expiration: The expiration time of the authentication key. + :paramtype expiration: ~datetime.datetime + """ super(AkamaiSignatureHeaderAuthenticationKey, self).__init__(**kwargs) self.identifier = identifier self.base64_key = base64_key self.expiration = expiration +class ArmStreamingEndpointCapacity(msrest.serialization.Model): + """The streaming endpoint sku capacity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar scale_type: + :vartype scale_type: str + :ivar default: The streaming endpoint default capacity. + :vartype default: int + :ivar minimum: The streaming endpoint minimum capacity. + :vartype minimum: int + :ivar maximum: The streaming endpoint maximum capacity. + :vartype maximum: int + """ + + _validation = { + 'scale_type': {'readonly': True}, + } + + _attribute_map = { + 'scale_type': {'key': 'scaleType', 'type': 'str'}, + 'default': {'key': 'default', 'type': 'int'}, + 'minimum': {'key': 'minimum', 'type': 'int'}, + 'maximum': {'key': 'maximum', 'type': 'int'}, + } + + def __init__( + self, + *, + default: Optional[int] = None, + minimum: Optional[int] = None, + maximum: Optional[int] = None, + **kwargs + ): + """ + :keyword default: The streaming endpoint default capacity. + :paramtype default: int + :keyword minimum: The streaming endpoint minimum capacity. + :paramtype minimum: int + :keyword maximum: The streaming endpoint maximum capacity. + :paramtype maximum: int + """ + super(ArmStreamingEndpointCapacity, self).__init__(**kwargs) + self.scale_type = None + self.default = default + self.minimum = minimum + self.maximum = maximum + + +class ArmStreamingEndpointCurrentSku(msrest.serialization.Model): + """The streaming endpoint current sku. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The streaming endpoint sku name. + :vartype name: str + :ivar capacity: The streaming endpoint sku capacity. + :vartype capacity: int + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + *, + capacity: Optional[int] = None, + **kwargs + ): + """ + :keyword capacity: The streaming endpoint sku capacity. + :paramtype capacity: int + """ + super(ArmStreamingEndpointCurrentSku, self).__init__(**kwargs) + self.name = None + self.capacity = capacity + + +class ArmStreamingEndpointSku(msrest.serialization.Model): + """The streaming endpoint sku. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The streaming endpoint sku name. + :vartype name: str + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ArmStreamingEndpointSku, self).__init__(**kwargs) + self.name = None + + +class ArmStreamingEndpointSkuInfo(msrest.serialization.Model): + """ArmStreamingEndpointSkuInfo. + + :ivar resource_type: + :vartype resource_type: str + :ivar capacity: The streaming endpoint sku capacity. + :vartype capacity: ~azure.mgmt.media.models.ArmStreamingEndpointCapacity + :ivar sku: The streaming endpoint sku. + :vartype sku: ~azure.mgmt.media.models.ArmStreamingEndpointSku + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'ArmStreamingEndpointCapacity'}, + 'sku': {'key': 'sku', 'type': 'ArmStreamingEndpointSku'}, + } + + def __init__( + self, + *, + resource_type: Optional[str] = None, + capacity: Optional["ArmStreamingEndpointCapacity"] = None, + sku: Optional["ArmStreamingEndpointSku"] = None, + **kwargs + ): + """ + :keyword resource_type: + :paramtype resource_type: str + :keyword capacity: The streaming endpoint sku capacity. + :paramtype capacity: ~azure.mgmt.media.models.ArmStreamingEndpointCapacity + :keyword sku: The streaming endpoint sku. + :paramtype sku: ~azure.mgmt.media.models.ArmStreamingEndpointSku + """ + super(ArmStreamingEndpointSkuInfo, self).__init__(**kwargs) + self.resource_type = resource_type + self.capacity = capacity + self.sku = sku + + class Asset(ProxyResource): """An Asset. @@ -521,14 +754,14 @@ class Asset(ProxyResource): :vartype created: ~datetime.datetime :ivar last_modified: The last modified date of the Asset. :vartype last_modified: ~datetime.datetime - :param alternate_id: The alternate ID of the Asset. - :type alternate_id: str - :param description: The Asset description. - :type description: str - :param container: The name of the asset blob container. - :type container: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str + :ivar alternate_id: The alternate ID of the Asset. + :vartype alternate_id: str + :ivar description: The Asset description. + :vartype description: str + :ivar container: The name of the asset blob container. + :vartype container: str + :ivar storage_account_name: The name of the storage account. + :vartype storage_account_name: str :ivar storage_encryption_format: The Asset encryption format. One of None or MediaStorageEncryption. Possible values include: "None", "MediaStorageClientEncryption". :vartype storage_encryption_format: str or @@ -570,6 +803,16 @@ def __init__( storage_account_name: Optional[str] = None, **kwargs ): + """ + :keyword alternate_id: The alternate ID of the Asset. + :paramtype alternate_id: str + :keyword description: The Asset description. + :paramtype description: str + :keyword container: The name of the asset blob container. + :paramtype container: str + :keyword storage_account_name: The name of the storage account. + :paramtype storage_account_name: str + """ super(Asset, self).__init__(**kwargs) self.system_data = None self.asset_id = None @@ -585,11 +828,11 @@ def __init__( class AssetCollection(msrest.serialization.Model): """A collection of Asset items. - :param value: A collection of Asset items. - :type value: list[~azure.mgmt.media.models.Asset] - :param odata_next_link: A link to the next page of the collection (when the collection contains + :ivar value: A collection of Asset items. + :vartype value: list[~azure.mgmt.media.models.Asset] + :ivar odata_next_link: A link to the next page of the collection (when the collection contains too many results to return in one response). - :type odata_next_link: str + :vartype odata_next_link: str """ _attribute_map = { @@ -604,6 +847,13 @@ def __init__( odata_next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: A collection of Asset items. + :paramtype value: list[~azure.mgmt.media.models.Asset] + :keyword odata_next_link: A link to the next page of the collection (when the collection + contains too many results to return in one response). + :paramtype odata_next_link: str + """ super(AssetCollection, self).__init__(**kwargs) self.value = value self.odata_next_link = odata_next_link @@ -612,8 +862,8 @@ def __init__( class AssetContainerSas(msrest.serialization.Model): """The Asset Storage container SAS URLs. - :param asset_container_sas_urls: The list of Asset container SAS URLs. - :type asset_container_sas_urls: list[str] + :ivar asset_container_sas_urls: The list of Asset container SAS URLs. + :vartype asset_container_sas_urls: list[str] """ _attribute_map = { @@ -626,6 +876,10 @@ def __init__( asset_container_sas_urls: Optional[List[str]] = None, **kwargs ): + """ + :keyword asset_container_sas_urls: The list of Asset container SAS URLs. + :paramtype asset_container_sas_urls: list[str] + """ super(AssetContainerSas, self).__init__(**kwargs) self.asset_container_sas_urls = asset_container_sas_urls @@ -635,12 +889,12 @@ class AssetFileEncryptionMetadata(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param initialization_vector: The Asset File initialization vector. - :type initialization_vector: str - :param asset_file_name: The Asset File name. - :type asset_file_name: str - :param asset_file_id: Required. The Asset File Id. - :type asset_file_id: str + :ivar initialization_vector: The Asset File initialization vector. + :vartype initialization_vector: str + :ivar asset_file_name: The Asset File name. + :vartype asset_file_name: str + :ivar asset_file_id: Required. The Asset File Id. + :vartype asset_file_id: str """ _validation = { @@ -661,6 +915,14 @@ def __init__( asset_file_name: Optional[str] = None, **kwargs ): + """ + :keyword initialization_vector: The Asset File initialization vector. + :paramtype initialization_vector: str + :keyword asset_file_name: The Asset File name. + :paramtype asset_file_name: str + :keyword asset_file_id: Required. The Asset File Id. + :paramtype asset_file_id: str + """ super(AssetFileEncryptionMetadata, self).__init__(**kwargs) self.initialization_vector = initialization_vector self.asset_file_name = asset_file_name @@ -682,12 +944,12 @@ class AssetFilter(ProxyResource): :vartype type: str :ivar system_data: The system metadata relating to this resource. :vartype system_data: ~azure.mgmt.media.models.SystemData - :param presentation_time_range: The presentation time range. - :type presentation_time_range: ~azure.mgmt.media.models.PresentationTimeRange - :param first_quality: The first quality. - :type first_quality: ~azure.mgmt.media.models.FirstQuality - :param tracks: The tracks selection conditions. - :type tracks: list[~azure.mgmt.media.models.FilterTrackSelection] + :ivar presentation_time_range: The presentation time range. + :vartype presentation_time_range: ~azure.mgmt.media.models.PresentationTimeRange + :ivar first_quality: The first quality. + :vartype first_quality: ~azure.mgmt.media.models.FirstQuality + :ivar tracks: The tracks selection conditions. + :vartype tracks: list[~azure.mgmt.media.models.FilterTrackSelection] """ _validation = { @@ -715,6 +977,14 @@ def __init__( tracks: Optional[List["FilterTrackSelection"]] = None, **kwargs ): + """ + :keyword presentation_time_range: The presentation time range. + :paramtype presentation_time_range: ~azure.mgmt.media.models.PresentationTimeRange + :keyword first_quality: The first quality. + :paramtype first_quality: ~azure.mgmt.media.models.FirstQuality + :keyword tracks: The tracks selection conditions. + :paramtype tracks: list[~azure.mgmt.media.models.FilterTrackSelection] + """ super(AssetFilter, self).__init__(**kwargs) self.system_data = None self.presentation_time_range = presentation_time_range @@ -725,11 +995,11 @@ def __init__( class AssetFilterCollection(msrest.serialization.Model): """A collection of AssetFilter items. - :param value: A collection of AssetFilter items. - :type value: list[~azure.mgmt.media.models.AssetFilter] - :param odata_next_link: A link to the next page of the collection (when the collection contains + :ivar value: A collection of AssetFilter items. + :vartype value: list[~azure.mgmt.media.models.AssetFilter] + :ivar odata_next_link: A link to the next page of the collection (when the collection contains too many results to return in one response). - :type odata_next_link: str + :vartype odata_next_link: str """ _attribute_map = { @@ -744,6 +1014,13 @@ def __init__( odata_next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: A collection of AssetFilter items. + :paramtype value: list[~azure.mgmt.media.models.AssetFilter] + :keyword odata_next_link: A link to the next page of the collection (when the collection + contains too many results to return in one response). + :paramtype odata_next_link: str + """ super(AssetFilterCollection, self).__init__(**kwargs) self.value = value self.odata_next_link = odata_next_link @@ -799,6 +1076,8 @@ def __init__( self, **kwargs ): + """ + """ super(AssetStreamingLocator, self).__init__(**kwargs) self.name = None self.asset_name = None @@ -810,6 +1089,148 @@ def __init__( self.default_content_key_policy_name = None +class AssetTrack(ProxyResource): + """An Asset Track resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar track: Detailed information about a track in the asset. + :vartype track: ~azure.mgmt.media.models.TrackBase + :ivar provisioning_state: Provisioning state of the asset track. Possible values include: + "Failed", "InProgress", "Succeeded". + :vartype provisioning_state: str or ~azure.mgmt.media.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'track': {'key': 'properties.track', 'type': 'TrackBase'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + track: Optional["TrackBase"] = None, + **kwargs + ): + """ + :keyword track: Detailed information about a track in the asset. + :paramtype track: ~azure.mgmt.media.models.TrackBase + """ + super(AssetTrack, self).__init__(**kwargs) + self.track = track + self.provisioning_state = None + + +class AssetTrackCollection(msrest.serialization.Model): + """A collection of AssetTrack items. + + :ivar value: A collection of AssetTrack items. + :vartype value: list[~azure.mgmt.media.models.AssetTrack] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AssetTrack]'}, + } + + def __init__( + self, + *, + value: Optional[List["AssetTrack"]] = None, + **kwargs + ): + """ + :keyword value: A collection of AssetTrack items. + :paramtype value: list[~azure.mgmt.media.models.AssetTrack] + """ + super(AssetTrackCollection, self).__init__(**kwargs) + self.value = value + + +class AssetTrackOperationStatus(msrest.serialization.Model): + """Status of asset track operation. + + All required parameters must be populated in order to send to Azure. + + :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: ~datetime.datetime + :ivar end_time: Operation end time. + :vartype end_time: ~datetime.datetime + :ivar status: Required. Operation status. + :vartype status: str + :ivar error: The error detail. + :vartype error: ~azure.mgmt.media.models.ErrorDetail + """ + + _validation = { + 'name': {'required': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'status': {'key': 'status', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + name: str, + status: str, + id: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + 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: ~datetime.datetime + :keyword end_time: Operation end time. + :paramtype end_time: ~datetime.datetime + :keyword status: Required. Operation status. + :paramtype status: str + :keyword error: The error detail. + :paramtype error: ~azure.mgmt.media.models.ErrorDetail + """ + super(AssetTrackOperationStatus, self).__init__(**kwargs) + self.name = name + self.id = id + self.start_time = start_time + self.end_time = end_time + self.status = status + self.error = error + + class Preset(msrest.serialization.Model): """Base type for all Presets, which define the recipe or instructions on how the input media files should be processed. @@ -818,8 +1239,8 @@ class Preset(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str """ _validation = { @@ -838,6 +1259,8 @@ def __init__( self, **kwargs ): + """ + """ super(Preset, self).__init__(**kwargs) self.odata_type = None # type: Optional[str] @@ -850,9 +1273,9 @@ class AudioAnalyzerPreset(Preset): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param audio_language: The language for the audio payload in the input using the BCP-47 format + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar audio_language: The language for the audio payload in the input using the BCP-47 format of 'language tag-region' (e.g: 'en-US'). If you know the language of your content, it is recommended that you specify it. The language must be specified explicitly for AudioAnalysisMode::Basic, since automatic language detection is not included in basic mode. If @@ -863,13 +1286,13 @@ class AudioAnalyzerPreset(Preset): speech. If automatic detection fails to find the language, transcription would fallback to 'en-US'." The list of supported languages is available here: https://go.microsoft.com/fwlink/?linkid=2109463. - :type audio_language: str - :param mode: Determines the set of audio analysis operations to be performed. If unspecified, + :vartype audio_language: str + :ivar mode: Determines the set of audio analysis operations to be performed. If unspecified, the Standard AudioAnalysisMode would be chosen. Possible values include: "Standard", "Basic". - :type mode: str or ~azure.mgmt.media.models.AudioAnalysisMode - :param experimental_options: Dictionary containing key value pairs for parameters not exposed - in the preset itself. - :type experimental_options: dict[str, str] + :vartype mode: str or ~azure.mgmt.media.models.AudioAnalysisMode + :ivar experimental_options: Dictionary containing key value pairs for parameters not exposed in + the preset itself. + :vartype experimental_options: dict[str, str] """ _validation = { @@ -895,6 +1318,26 @@ def __init__( experimental_options: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword audio_language: The language for the audio payload in the input using the BCP-47 + format of 'language tag-region' (e.g: 'en-US'). If you know the language of your content, it + is recommended that you specify it. The language must be specified explicitly for + AudioAnalysisMode::Basic, since automatic language detection is not included in basic mode. If + the language isn't specified or set to null, automatic language detection will choose the first + language detected and process with the selected language for the duration of the file. It does + not currently support dynamically switching between languages after the first language is + detected. The automatic detection works best with audio recordings with clearly discernable + speech. If automatic detection fails to find the language, transcription would fallback to + 'en-US'." The list of supported languages is available here: + https://go.microsoft.com/fwlink/?linkid=2109463. + :paramtype audio_language: str + :keyword mode: Determines the set of audio analysis operations to be performed. If unspecified, + the Standard AudioAnalysisMode would be chosen. Possible values include: "Standard", "Basic". + :paramtype mode: str or ~azure.mgmt.media.models.AudioAnalysisMode + :keyword experimental_options: Dictionary containing key value pairs for parameters not exposed + in the preset itself. + :paramtype experimental_options: dict[str, str] + """ super(AudioAnalyzerPreset, self).__init__(**kwargs) self.odata_type = '#Microsoft.Media.AudioAnalyzerPreset' # type: str self.audio_language = audio_language @@ -910,36 +1353,36 @@ class Overlay(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param input_label: Required. The label of the job input which is to be used as an overlay. The + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar input_label: Required. The label of the job input which is to be used as an overlay. The Input must specify exactly one file. You can specify an image file in JPG, PNG, GIF or BMP format, or an audio file (such as a WAV, MP3, WMA or M4A file), or a video file. See https://aka.ms/mesformats for the complete list of supported audio and video file formats. - :type input_label: str - :param start: The start position, with reference to the input video, at which the overlay + :vartype input_label: str + :ivar start: The start position, with reference to the input video, at which the overlay starts. The value should be in ISO 8601 format. For example, PT05S to start the overlay at 5 seconds into the input video. If not specified the overlay starts from the beginning of the input video. - :type start: ~datetime.timedelta - :param end: The end position, with reference to the input video, at which the overlay ends. The + :vartype start: ~datetime.timedelta + :ivar end: The end position, with reference to the input video, at which the overlay ends. The value should be in ISO 8601 format. For example, PT30S to end the overlay at 30 seconds into the input video. If not specified or the value is greater than the input video duration, the overlay will be applied until the end of the input video if the overlay media duration is greater than the input video duration, else the overlay will last as long as the overlay media duration. - :type end: ~datetime.timedelta - :param fade_in_duration: The duration over which the overlay fades in onto the input video. The + :vartype end: ~datetime.timedelta + :ivar fade_in_duration: The duration over which the overlay fades in onto the input video. The value should be in ISO 8601 duration format. If not specified the default behavior is to have no fade in (same as PT0S). - :type fade_in_duration: ~datetime.timedelta - :param fade_out_duration: The duration over which the overlay fades out of the input video. The + :vartype fade_in_duration: ~datetime.timedelta + :ivar fade_out_duration: The duration over which the overlay fades out of the input video. The value should be in ISO 8601 duration format. If not specified the default behavior is to have no fade out (same as PT0S). - :type fade_out_duration: ~datetime.timedelta - :param audio_gain_level: The gain level of audio in the overlay. The value should be in the + :vartype fade_out_duration: ~datetime.timedelta + :ivar audio_gain_level: The gain level of audio in the overlay. The value should be in the range [0, 1.0]. The default is 1.0. - :type audio_gain_level: float + :vartype audio_gain_level: float """ _validation = { @@ -972,6 +1415,36 @@ def __init__( audio_gain_level: Optional[float] = None, **kwargs ): + """ + :keyword input_label: Required. The label of the job input which is to be used as an overlay. + The Input must specify exactly one file. You can specify an image file in JPG, PNG, GIF or BMP + format, or an audio file (such as a WAV, MP3, WMA or M4A file), or a video file. See + https://aka.ms/mesformats for the complete list of supported audio and video file formats. + :paramtype input_label: str + :keyword start: The start position, with reference to the input video, at which the overlay + starts. The value should be in ISO 8601 format. For example, PT05S to start the overlay at 5 + seconds into the input video. If not specified the overlay starts from the beginning of the + input video. + :paramtype start: ~datetime.timedelta + :keyword end: The end position, with reference to the input video, at which the overlay ends. + The value should be in ISO 8601 format. For example, PT30S to end the overlay at 30 seconds + into the input video. If not specified or the value is greater than the input video duration, + the overlay will be applied until the end of the input video if the overlay media duration is + greater than the input video duration, else the overlay will last as long as the overlay media + duration. + :paramtype end: ~datetime.timedelta + :keyword fade_in_duration: The duration over which the overlay fades in onto the input video. + The value should be in ISO 8601 duration format. If not specified the default behavior is to + have no fade in (same as PT0S). + :paramtype fade_in_duration: ~datetime.timedelta + :keyword fade_out_duration: The duration over which the overlay fades out of the input video. + The value should be in ISO 8601 duration format. If not specified the default behavior is to + have no fade out (same as PT0S). + :paramtype fade_out_duration: ~datetime.timedelta + :keyword audio_gain_level: The gain level of audio in the overlay. The value should be in the + range [0, 1.0]. The default is 1.0. + :paramtype audio_gain_level: float + """ super(Overlay, self).__init__(**kwargs) self.odata_type = None # type: Optional[str] self.input_label = input_label @@ -987,36 +1460,36 @@ class AudioOverlay(Overlay): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param input_label: Required. The label of the job input which is to be used as an overlay. The + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar input_label: Required. The label of the job input which is to be used as an overlay. The Input must specify exactly one file. You can specify an image file in JPG, PNG, GIF or BMP format, or an audio file (such as a WAV, MP3, WMA or M4A file), or a video file. See https://aka.ms/mesformats for the complete list of supported audio and video file formats. - :type input_label: str - :param start: The start position, with reference to the input video, at which the overlay + :vartype input_label: str + :ivar start: The start position, with reference to the input video, at which the overlay starts. The value should be in ISO 8601 format. For example, PT05S to start the overlay at 5 seconds into the input video. If not specified the overlay starts from the beginning of the input video. - :type start: ~datetime.timedelta - :param end: The end position, with reference to the input video, at which the overlay ends. The + :vartype start: ~datetime.timedelta + :ivar end: The end position, with reference to the input video, at which the overlay ends. The value should be in ISO 8601 format. For example, PT30S to end the overlay at 30 seconds into the input video. If not specified or the value is greater than the input video duration, the overlay will be applied until the end of the input video if the overlay media duration is greater than the input video duration, else the overlay will last as long as the overlay media duration. - :type end: ~datetime.timedelta - :param fade_in_duration: The duration over which the overlay fades in onto the input video. The + :vartype end: ~datetime.timedelta + :ivar fade_in_duration: The duration over which the overlay fades in onto the input video. The value should be in ISO 8601 duration format. If not specified the default behavior is to have no fade in (same as PT0S). - :type fade_in_duration: ~datetime.timedelta - :param fade_out_duration: The duration over which the overlay fades out of the input video. The + :vartype fade_in_duration: ~datetime.timedelta + :ivar fade_out_duration: The duration over which the overlay fades out of the input video. The value should be in ISO 8601 duration format. If not specified the default behavior is to have no fade out (same as PT0S). - :type fade_out_duration: ~datetime.timedelta - :param audio_gain_level: The gain level of audio in the overlay. The value should be in the + :vartype fade_out_duration: ~datetime.timedelta + :ivar audio_gain_level: The gain level of audio in the overlay. The value should be in the range [0, 1.0]. The default is 1.0. - :type audio_gain_level: float + :vartype audio_gain_level: float """ _validation = { @@ -1045,10 +1518,101 @@ def __init__( audio_gain_level: Optional[float] = None, **kwargs ): + """ + :keyword input_label: Required. The label of the job input which is to be used as an overlay. + The Input must specify exactly one file. You can specify an image file in JPG, PNG, GIF or BMP + format, or an audio file (such as a WAV, MP3, WMA or M4A file), or a video file. See + https://aka.ms/mesformats for the complete list of supported audio and video file formats. + :paramtype input_label: str + :keyword start: The start position, with reference to the input video, at which the overlay + starts. The value should be in ISO 8601 format. For example, PT05S to start the overlay at 5 + seconds into the input video. If not specified the overlay starts from the beginning of the + input video. + :paramtype start: ~datetime.timedelta + :keyword end: The end position, with reference to the input video, at which the overlay ends. + The value should be in ISO 8601 format. For example, PT30S to end the overlay at 30 seconds + into the input video. If not specified or the value is greater than the input video duration, + the overlay will be applied until the end of the input video if the overlay media duration is + greater than the input video duration, else the overlay will last as long as the overlay media + duration. + :paramtype end: ~datetime.timedelta + :keyword fade_in_duration: The duration over which the overlay fades in onto the input video. + The value should be in ISO 8601 duration format. If not specified the default behavior is to + have no fade in (same as PT0S). + :paramtype fade_in_duration: ~datetime.timedelta + :keyword fade_out_duration: The duration over which the overlay fades out of the input video. + The value should be in ISO 8601 duration format. If not specified the default behavior is to + have no fade out (same as PT0S). + :paramtype fade_out_duration: ~datetime.timedelta + :keyword audio_gain_level: The gain level of audio in the overlay. The value should be in the + range [0, 1.0]. The default is 1.0. + :paramtype audio_gain_level: float + """ super(AudioOverlay, self).__init__(input_label=input_label, start=start, end=end, fade_in_duration=fade_in_duration, fade_out_duration=fade_out_duration, audio_gain_level=audio_gain_level, **kwargs) self.odata_type = '#Microsoft.Media.AudioOverlay' # type: str +class TrackBase(msrest.serialization.Model): + """Base type for concrete track types. A derived type must be used to represent the Track. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AudioTrack, TextTrack, VideoTrack. + + All required parameters must be populated in order to send to Azure. + + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, + } + + _subtype_map = { + 'odata_type': {'#Microsoft.Media.AudioTrack': 'AudioTrack', '#Microsoft.Media.TextTrack': 'TextTrack', '#Microsoft.Media.VideoTrack': 'VideoTrack'} + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(TrackBase, self).__init__(**kwargs) + self.odata_type = None # type: Optional[str] + + +class AudioTrack(TrackBase): + """Represents an audio track in the asset. + + All required parameters must be populated in order to send to Azure. + + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(AudioTrack, self).__init__(**kwargs) + self.odata_type = '#Microsoft.Media.AudioTrack' # type: str + + class TrackDescriptor(msrest.serialization.Model): """Base type for all TrackDescriptor types, which define the metadata and selection for tracks that should be processed by a Job. @@ -1057,8 +1621,8 @@ class TrackDescriptor(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str """ _validation = { @@ -1077,6 +1641,8 @@ def __init__( self, **kwargs ): + """ + """ super(TrackDescriptor, self).__init__(**kwargs) self.odata_type = None # type: Optional[str] @@ -1089,13 +1655,13 @@ class AudioTrackDescriptor(TrackDescriptor): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param channel_mapping: Optional designation for single channel audio tracks. Can be used to + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar channel_mapping: Optional designation for single channel audio tracks. Can be used to combine the tracks into stereo or multi-channel audio tracks. Possible values include: "FrontLeft", "FrontRight", "Center", "LowFrequencyEffects", "BackLeft", "BackRight", "StereoLeft", "StereoRight". - :type channel_mapping: str or ~azure.mgmt.media.models.ChannelMapping + :vartype channel_mapping: str or ~azure.mgmt.media.models.ChannelMapping """ _validation = { @@ -1117,6 +1683,13 @@ def __init__( channel_mapping: Optional[Union[str, "ChannelMapping"]] = None, **kwargs ): + """ + :keyword channel_mapping: Optional designation for single channel audio tracks. Can be used to + combine the tracks into stereo or multi-channel audio tracks. Possible values include: + "FrontLeft", "FrontRight", "Center", "LowFrequencyEffects", "BackLeft", "BackRight", + "StereoLeft", "StereoRight". + :paramtype channel_mapping: str or ~azure.mgmt.media.models.ChannelMapping + """ super(AudioTrackDescriptor, self).__init__(**kwargs) self.odata_type = '#Microsoft.Media.AudioTrackDescriptor' # type: str self.channel_mapping = channel_mapping @@ -1127,20 +1700,19 @@ class BuiltInStandardEncoderPreset(Preset): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param configurations: PresetConfigurations are only supported for the ContentAwareEncoding and - H265ContentAwareEncoding built-in presets. These settings will not affect other built-in or - custom defined presets. - :type configurations: ~azure.mgmt.media.models.PresetConfigurations - :param preset_name: Required. The built-in preset to be used for encoding videos. Possible + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar configurations: Optional configuration settings for encoder. Configurations is only + supported for ContentAwareEncoding and H265ContentAwareEncoding BuiltInStandardEncoderPreset. + :vartype configurations: ~azure.mgmt.media.models.PresetConfigurations + :ivar preset_name: Required. The built-in preset to be used for encoding videos. Possible values include: "H264SingleBitrateSD", "H264SingleBitrate720p", "H264SingleBitrate1080p", "AdaptiveStreaming", "AACGoodQualityAudio", "ContentAwareEncodingExperimental", "ContentAwareEncoding", "CopyAllBitrateNonInterleaved", "H264MultipleBitrate1080p", "H264MultipleBitrate720p", "H264MultipleBitrateSD", "H265ContentAwareEncoding", "H265AdaptiveStreaming", "H265SingleBitrate720p", "H265SingleBitrate1080p", "H265SingleBitrate4K". - :type preset_name: str or ~azure.mgmt.media.models.EncoderNamedPreset + :vartype preset_name: str or ~azure.mgmt.media.models.EncoderNamedPreset """ _validation = { @@ -1161,6 +1733,19 @@ def __init__( configurations: Optional["PresetConfigurations"] = None, **kwargs ): + """ + :keyword configurations: Optional configuration settings for encoder. Configurations is only + supported for ContentAwareEncoding and H265ContentAwareEncoding BuiltInStandardEncoderPreset. + :paramtype configurations: ~azure.mgmt.media.models.PresetConfigurations + :keyword preset_name: Required. The built-in preset to be used for encoding videos. Possible + values include: "H264SingleBitrateSD", "H264SingleBitrate720p", "H264SingleBitrate1080p", + "AdaptiveStreaming", "AACGoodQualityAudio", "ContentAwareEncodingExperimental", + "ContentAwareEncoding", "CopyAllBitrateNonInterleaved", "H264MultipleBitrate1080p", + "H264MultipleBitrate720p", "H264MultipleBitrateSD", "H265ContentAwareEncoding", + "H265AdaptiveStreaming", "H265SingleBitrate720p", "H265SingleBitrate1080p", + "H265SingleBitrate4K". + :paramtype preset_name: str or ~azure.mgmt.media.models.EncoderNamedPreset + """ super(BuiltInStandardEncoderPreset, self).__init__(**kwargs) self.odata_type = '#Microsoft.Media.BuiltInStandardEncoderPreset' # type: str self.configurations = configurations @@ -1170,12 +1755,12 @@ def __init__( class CbcsDrmConfiguration(msrest.serialization.Model): """Class to specify DRM configurations of CommonEncryptionCbcs scheme in Streaming Policy. - :param fair_play: FairPlay configurations. - :type fair_play: ~azure.mgmt.media.models.StreamingPolicyFairPlayConfiguration - :param play_ready: PlayReady configurations. - :type play_ready: ~azure.mgmt.media.models.StreamingPolicyPlayReadyConfiguration - :param widevine: Widevine configurations. - :type widevine: ~azure.mgmt.media.models.StreamingPolicyWidevineConfiguration + :ivar fair_play: FairPlay configurations. + :vartype fair_play: ~azure.mgmt.media.models.StreamingPolicyFairPlayConfiguration + :ivar play_ready: PlayReady configurations. + :vartype play_ready: ~azure.mgmt.media.models.StreamingPolicyPlayReadyConfiguration + :ivar widevine: Widevine configurations. + :vartype widevine: ~azure.mgmt.media.models.StreamingPolicyWidevineConfiguration """ _attribute_map = { @@ -1192,6 +1777,14 @@ def __init__( widevine: Optional["StreamingPolicyWidevineConfiguration"] = None, **kwargs ): + """ + :keyword fair_play: FairPlay configurations. + :paramtype fair_play: ~azure.mgmt.media.models.StreamingPolicyFairPlayConfiguration + :keyword play_ready: PlayReady configurations. + :paramtype play_ready: ~azure.mgmt.media.models.StreamingPolicyPlayReadyConfiguration + :keyword widevine: Widevine configurations. + :paramtype widevine: ~azure.mgmt.media.models.StreamingPolicyWidevineConfiguration + """ super(CbcsDrmConfiguration, self).__init__(**kwargs) self.fair_play = fair_play self.play_ready = play_ready @@ -1201,10 +1794,10 @@ def __init__( class CencDrmConfiguration(msrest.serialization.Model): """Class to specify DRM configurations of CommonEncryptionCenc scheme in Streaming Policy. - :param play_ready: PlayReady configurations. - :type play_ready: ~azure.mgmt.media.models.StreamingPolicyPlayReadyConfiguration - :param widevine: Widevine configurations. - :type widevine: ~azure.mgmt.media.models.StreamingPolicyWidevineConfiguration + :ivar play_ready: PlayReady configurations. + :vartype play_ready: ~azure.mgmt.media.models.StreamingPolicyPlayReadyConfiguration + :ivar widevine: Widevine configurations. + :vartype widevine: ~azure.mgmt.media.models.StreamingPolicyWidevineConfiguration """ _attribute_map = { @@ -1219,6 +1812,12 @@ def __init__( widevine: Optional["StreamingPolicyWidevineConfiguration"] = None, **kwargs ): + """ + :keyword play_ready: PlayReady configurations. + :paramtype play_ready: ~azure.mgmt.media.models.StreamingPolicyPlayReadyConfiguration + :keyword widevine: Widevine configurations. + :paramtype widevine: ~azure.mgmt.media.models.StreamingPolicyWidevineConfiguration + """ super(CencDrmConfiguration, self).__init__(**kwargs) self.play_ready = play_ready self.widevine = widevine @@ -1227,10 +1826,10 @@ def __init__( class CheckNameAvailabilityInput(msrest.serialization.Model): """The input to the check name availability request. - :param name: The account name. - :type name: str - :param type: The account type. For a Media Services account, this should be 'MediaServices'. - :type type: str + :ivar name: The account name. + :vartype name: str + :ivar type: The account type. For a Media Services account, this should be 'MediaServices'. + :vartype type: str """ _attribute_map = { @@ -1245,6 +1844,12 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword name: The account name. + :paramtype name: str + :keyword type: The account type. For a Media Services account, this should be 'MediaServices'. + :paramtype type: str + """ super(CheckNameAvailabilityInput, self).__init__(**kwargs) self.name = name self.type = type @@ -1253,15 +1858,15 @@ def __init__( class CommonEncryptionCbcs(msrest.serialization.Model): """Class for CommonEncryptionCbcs encryption scheme. - :param enabled_protocols: Representing supported protocols. - :type enabled_protocols: ~azure.mgmt.media.models.EnabledProtocols - :param clear_tracks: Representing which tracks should not be encrypted. - :type clear_tracks: list[~azure.mgmt.media.models.TrackSelection] - :param content_keys: Representing default content key for each encryption scheme and separate + :ivar enabled_protocols: Representing supported protocols. + :vartype enabled_protocols: ~azure.mgmt.media.models.EnabledProtocols + :ivar clear_tracks: Representing which tracks should not be encrypted. + :vartype clear_tracks: list[~azure.mgmt.media.models.TrackSelection] + :ivar content_keys: Representing default content key for each encryption scheme and separate content keys for specific tracks. - :type content_keys: ~azure.mgmt.media.models.StreamingPolicyContentKeys - :param drm: Configuration of DRMs for current encryption scheme. - :type drm: ~azure.mgmt.media.models.CbcsDrmConfiguration + :vartype content_keys: ~azure.mgmt.media.models.StreamingPolicyContentKeys + :ivar drm: Configuration of DRMs for current encryption scheme. + :vartype drm: ~azure.mgmt.media.models.CbcsDrmConfiguration """ _attribute_map = { @@ -1280,6 +1885,17 @@ def __init__( drm: Optional["CbcsDrmConfiguration"] = None, **kwargs ): + """ + :keyword enabled_protocols: Representing supported protocols. + :paramtype enabled_protocols: ~azure.mgmt.media.models.EnabledProtocols + :keyword clear_tracks: Representing which tracks should not be encrypted. + :paramtype clear_tracks: list[~azure.mgmt.media.models.TrackSelection] + :keyword content_keys: Representing default content key for each encryption scheme and separate + content keys for specific tracks. + :paramtype content_keys: ~azure.mgmt.media.models.StreamingPolicyContentKeys + :keyword drm: Configuration of DRMs for current encryption scheme. + :paramtype drm: ~azure.mgmt.media.models.CbcsDrmConfiguration + """ super(CommonEncryptionCbcs, self).__init__(**kwargs) self.enabled_protocols = enabled_protocols self.clear_tracks = clear_tracks @@ -1290,15 +1906,15 @@ def __init__( class CommonEncryptionCenc(msrest.serialization.Model): """Class for envelope encryption scheme. - :param enabled_protocols: Representing supported protocols. - :type enabled_protocols: ~azure.mgmt.media.models.EnabledProtocols - :param clear_tracks: Representing which tracks should not be encrypted. - :type clear_tracks: list[~azure.mgmt.media.models.TrackSelection] - :param content_keys: Representing default content key for each encryption scheme and separate + :ivar enabled_protocols: Representing supported protocols. + :vartype enabled_protocols: ~azure.mgmt.media.models.EnabledProtocols + :ivar clear_tracks: Representing which tracks should not be encrypted. + :vartype clear_tracks: list[~azure.mgmt.media.models.TrackSelection] + :ivar content_keys: Representing default content key for each encryption scheme and separate content keys for specific tracks. - :type content_keys: ~azure.mgmt.media.models.StreamingPolicyContentKeys - :param drm: Configuration of DRMs for CommonEncryptionCenc encryption scheme. - :type drm: ~azure.mgmt.media.models.CencDrmConfiguration + :vartype content_keys: ~azure.mgmt.media.models.StreamingPolicyContentKeys + :ivar drm: Configuration of DRMs for CommonEncryptionCenc encryption scheme. + :vartype drm: ~azure.mgmt.media.models.CencDrmConfiguration """ _attribute_map = { @@ -1317,6 +1933,17 @@ def __init__( drm: Optional["CencDrmConfiguration"] = None, **kwargs ): + """ + :keyword enabled_protocols: Representing supported protocols. + :paramtype enabled_protocols: ~azure.mgmt.media.models.EnabledProtocols + :keyword clear_tracks: Representing which tracks should not be encrypted. + :paramtype clear_tracks: list[~azure.mgmt.media.models.TrackSelection] + :keyword content_keys: Representing default content key for each encryption scheme and separate + content keys for specific tracks. + :paramtype content_keys: ~azure.mgmt.media.models.StreamingPolicyContentKeys + :keyword drm: Configuration of DRMs for CommonEncryptionCenc encryption scheme. + :paramtype drm: ~azure.mgmt.media.models.CencDrmConfiguration + """ super(CommonEncryptionCenc, self).__init__(**kwargs) self.enabled_protocols = enabled_protocols self.clear_tracks = clear_tracks @@ -1345,10 +1972,10 @@ class ContentKeyPolicy(ProxyResource): :vartype created: ~datetime.datetime :ivar last_modified: The last modified date of the Policy. :vartype last_modified: ~datetime.datetime - :param description: A description for the Policy. - :type description: str - :param options: The Key Policy options. - :type options: list[~azure.mgmt.media.models.ContentKeyPolicyOption] + :ivar description: A description for the Policy. + :vartype description: str + :ivar options: The Key Policy options. + :vartype options: list[~azure.mgmt.media.models.ContentKeyPolicyOption] """ _validation = { @@ -1380,6 +2007,12 @@ def __init__( options: Optional[List["ContentKeyPolicyOption"]] = None, **kwargs ): + """ + :keyword description: A description for the Policy. + :paramtype description: str + :keyword options: The Key Policy options. + :paramtype options: list[~azure.mgmt.media.models.ContentKeyPolicyOption] + """ super(ContentKeyPolicy, self).__init__(**kwargs) self.system_data = None self.policy_id = None @@ -1397,8 +2030,8 @@ class ContentKeyPolicyConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str """ _validation = { @@ -1417,6 +2050,8 @@ def __init__( self, **kwargs ): + """ + """ super(ContentKeyPolicyConfiguration, self).__init__(**kwargs) self.odata_type = None # type: Optional[str] @@ -1426,8 +2061,8 @@ class ContentKeyPolicyClearKeyConfiguration(ContentKeyPolicyConfiguration): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str """ _validation = { @@ -1442,6 +2077,8 @@ def __init__( self, **kwargs ): + """ + """ super(ContentKeyPolicyClearKeyConfiguration, self).__init__(**kwargs) self.odata_type = '#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration' # type: str @@ -1449,11 +2086,11 @@ def __init__( class ContentKeyPolicyCollection(msrest.serialization.Model): """A collection of ContentKeyPolicy items. - :param value: A collection of ContentKeyPolicy items. - :type value: list[~azure.mgmt.media.models.ContentKeyPolicy] - :param odata_next_link: A link to the next page of the collection (when the collection contains + :ivar value: A collection of ContentKeyPolicy items. + :vartype value: list[~azure.mgmt.media.models.ContentKeyPolicy] + :ivar odata_next_link: A link to the next page of the collection (when the collection contains too many results to return in one response). - :type odata_next_link: str + :vartype odata_next_link: str """ _attribute_map = { @@ -1468,6 +2105,13 @@ def __init__( odata_next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: A collection of ContentKeyPolicy items. + :paramtype value: list[~azure.mgmt.media.models.ContentKeyPolicy] + :keyword odata_next_link: A link to the next page of the collection (when the collection + contains too many results to return in one response). + :paramtype odata_next_link: str + """ super(ContentKeyPolicyCollection, self).__init__(**kwargs) self.value = value self.odata_next_link = odata_next_link @@ -1478,24 +2122,24 @@ class ContentKeyPolicyFairPlayConfiguration(ContentKeyPolicyConfiguration): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param ask: Required. The key that must be used as FairPlay Application Secret key. - :type ask: bytearray - :param fair_play_pfx_password: Required. The password encrypting FairPlay certificate in PKCS - 12 (pfx) format. - :type fair_play_pfx_password: str - :param fair_play_pfx: Required. The Base64 representation of FairPlay certificate in PKCS 12 + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar ask: Required. The key that must be used as FairPlay Application Secret key. + :vartype ask: bytearray + :ivar fair_play_pfx_password: Required. The password encrypting FairPlay certificate in PKCS 12 + (pfx) format. + :vartype fair_play_pfx_password: str + :ivar fair_play_pfx: Required. The Base64 representation of FairPlay certificate in PKCS 12 (pfx) format (including private key). - :type fair_play_pfx: str - :param rental_and_lease_key_type: Required. The rental and lease key type. Possible values + :vartype fair_play_pfx: str + :ivar rental_and_lease_key_type: Required. The rental and lease key type. Possible values include: "Unknown", "Undefined", "DualExpiry", "PersistentUnlimited", "PersistentLimited". - :type rental_and_lease_key_type: str or + :vartype rental_and_lease_key_type: str or ~azure.mgmt.media.models.ContentKeyPolicyFairPlayRentalAndLeaseKeyType - :param rental_duration: Required. The rental duration. Must be greater than or equal to 0. - :type rental_duration: long - :param offline_rental_configuration: Offline rental policy. - :type offline_rental_configuration: + :ivar rental_duration: Required. The rental duration. Must be greater than or equal to 0. + :vartype rental_duration: long + :ivar offline_rental_configuration: Offline rental policy. + :vartype offline_rental_configuration: ~azure.mgmt.media.models.ContentKeyPolicyFairPlayOfflineRentalConfiguration """ @@ -1529,6 +2173,25 @@ def __init__( offline_rental_configuration: Optional["ContentKeyPolicyFairPlayOfflineRentalConfiguration"] = None, **kwargs ): + """ + :keyword ask: Required. The key that must be used as FairPlay Application Secret key. + :paramtype ask: bytearray + :keyword fair_play_pfx_password: Required. The password encrypting FairPlay certificate in PKCS + 12 (pfx) format. + :paramtype fair_play_pfx_password: str + :keyword fair_play_pfx: Required. The Base64 representation of FairPlay certificate in PKCS 12 + (pfx) format (including private key). + :paramtype fair_play_pfx: str + :keyword rental_and_lease_key_type: Required. The rental and lease key type. Possible values + include: "Unknown", "Undefined", "DualExpiry", "PersistentUnlimited", "PersistentLimited". + :paramtype rental_and_lease_key_type: str or + ~azure.mgmt.media.models.ContentKeyPolicyFairPlayRentalAndLeaseKeyType + :keyword rental_duration: Required. The rental duration. Must be greater than or equal to 0. + :paramtype rental_duration: long + :keyword offline_rental_configuration: Offline rental policy. + :paramtype offline_rental_configuration: + ~azure.mgmt.media.models.ContentKeyPolicyFairPlayOfflineRentalConfiguration + """ super(ContentKeyPolicyFairPlayConfiguration, self).__init__(**kwargs) self.odata_type = '#Microsoft.Media.ContentKeyPolicyFairPlayConfiguration' # type: str self.ask = ask @@ -1544,10 +2207,10 @@ class ContentKeyPolicyFairPlayOfflineRentalConfiguration(msrest.serialization.Mo All required parameters must be populated in order to send to Azure. - :param playback_duration_seconds: Required. Playback duration. - :type playback_duration_seconds: long - :param storage_duration_seconds: Required. Storage duration. - :type storage_duration_seconds: long + :ivar playback_duration_seconds: Required. Playback duration. + :vartype playback_duration_seconds: long + :ivar storage_duration_seconds: Required. Storage duration. + :vartype storage_duration_seconds: long """ _validation = { @@ -1567,6 +2230,12 @@ def __init__( storage_duration_seconds: int, **kwargs ): + """ + :keyword playback_duration_seconds: Required. Playback duration. + :paramtype playback_duration_seconds: long + :keyword storage_duration_seconds: Required. Storage duration. + :paramtype storage_duration_seconds: long + """ super(ContentKeyPolicyFairPlayOfflineRentalConfiguration, self).__init__(**kwargs) self.playback_duration_seconds = playback_duration_seconds self.storage_duration_seconds = storage_duration_seconds @@ -1580,8 +2249,8 @@ class ContentKeyPolicyRestriction(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str """ _validation = { @@ -1600,6 +2269,8 @@ def __init__( self, **kwargs ): + """ + """ super(ContentKeyPolicyRestriction, self).__init__(**kwargs) self.odata_type = None # type: Optional[str] @@ -1609,8 +2280,8 @@ class ContentKeyPolicyOpenRestriction(ContentKeyPolicyRestriction): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str """ _validation = { @@ -1625,6 +2296,8 @@ def __init__( self, **kwargs ): + """ + """ super(ContentKeyPolicyOpenRestriction, self).__init__(**kwargs) self.odata_type = '#Microsoft.Media.ContentKeyPolicyOpenRestriction' # type: str @@ -1638,13 +2311,13 @@ class ContentKeyPolicyOption(msrest.serialization.Model): :ivar policy_option_id: The legacy Policy Option ID. :vartype policy_option_id: str - :param name: The Policy Option description. - :type name: str - :param configuration: Required. The key delivery configuration. - :type configuration: ~azure.mgmt.media.models.ContentKeyPolicyConfiguration - :param restriction: Required. The requirements that must be met to deliver keys with this + :ivar name: The Policy Option description. + :vartype name: str + :ivar configuration: Required. The key delivery configuration. + :vartype configuration: ~azure.mgmt.media.models.ContentKeyPolicyConfiguration + :ivar restriction: Required. The requirements that must be met to deliver keys with this configuration. - :type restriction: ~azure.mgmt.media.models.ContentKeyPolicyRestriction + :vartype restriction: ~azure.mgmt.media.models.ContentKeyPolicyRestriction """ _validation = { @@ -1668,6 +2341,15 @@ def __init__( name: Optional[str] = None, **kwargs ): + """ + :keyword name: The Policy Option description. + :paramtype name: str + :keyword configuration: Required. The key delivery configuration. + :paramtype configuration: ~azure.mgmt.media.models.ContentKeyPolicyConfiguration + :keyword restriction: Required. The requirements that must be met to deliver keys with this + configuration. + :paramtype restriction: ~azure.mgmt.media.models.ContentKeyPolicyRestriction + """ super(ContentKeyPolicyOption, self).__init__(**kwargs) self.policy_option_id = None self.name = name @@ -1680,12 +2362,12 @@ class ContentKeyPolicyPlayReadyConfiguration(ContentKeyPolicyConfiguration): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param licenses: Required. The PlayReady licenses. - :type licenses: list[~azure.mgmt.media.models.ContentKeyPolicyPlayReadyLicense] - :param response_custom_data: The custom response data. - :type response_custom_data: str + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar licenses: Required. The PlayReady licenses. + :vartype licenses: list[~azure.mgmt.media.models.ContentKeyPolicyPlayReadyLicense] + :ivar response_custom_data: The custom response data. + :vartype response_custom_data: str """ _validation = { @@ -1706,6 +2388,12 @@ def __init__( response_custom_data: Optional[str] = None, **kwargs ): + """ + :keyword licenses: Required. The PlayReady licenses. + :paramtype licenses: list[~azure.mgmt.media.models.ContentKeyPolicyPlayReadyLicense] + :keyword response_custom_data: The custom response data. + :paramtype response_custom_data: str + """ super(ContentKeyPolicyPlayReadyConfiguration, self).__init__(**kwargs) self.odata_type = '#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration' # type: str self.licenses = licenses @@ -1720,8 +2408,8 @@ class ContentKeyPolicyPlayReadyContentKeyLocation(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str """ _validation = { @@ -1740,6 +2428,8 @@ def __init__( self, **kwargs ): + """ + """ super(ContentKeyPolicyPlayReadyContentKeyLocation, self).__init__(**kwargs) self.odata_type = None # type: Optional[str] @@ -1749,8 +2439,8 @@ class ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader(ContentKeyPolicyPl All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str """ _validation = { @@ -1765,6 +2455,8 @@ def __init__( self, **kwargs ): + """ + """ super(ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader, self).__init__(**kwargs) self.odata_type = '#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader' # type: str @@ -1774,10 +2466,10 @@ class ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier(ContentKeyP All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param key_id: Required. The content key ID. - :type key_id: str + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar key_id: Required. The content key ID. + :vartype key_id: str """ _validation = { @@ -1796,6 +2488,10 @@ def __init__( key_id: str, **kwargs ): + """ + :keyword key_id: Required. The content key ID. + :paramtype key_id: str + """ super(ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier, self).__init__(**kwargs) self.odata_type = '#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier' # type: str self.key_id = key_id @@ -1806,12 +2502,12 @@ class ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction(msrest.serial All required parameters must be populated in order to send to Azure. - :param best_effort: Required. Indicates whether this restriction is enforced on a Best Effort + :ivar best_effort: Required. Indicates whether this restriction is enforced on a Best Effort basis. - :type best_effort: bool - :param configuration_data: Required. Configures the restriction control bits. Must be between 0 + :vartype best_effort: bool + :ivar configuration_data: Required. Configures the restriction control bits. Must be between 0 and 3 inclusive. - :type configuration_data: int + :vartype configuration_data: int """ _validation = { @@ -1831,6 +2527,14 @@ def __init__( configuration_data: int, **kwargs ): + """ + :keyword best_effort: Required. Indicates whether this restriction is enforced on a Best Effort + basis. + :paramtype best_effort: bool + :keyword configuration_data: Required. Configures the restriction control bits. Must be between + 0 and 3 inclusive. + :paramtype configuration_data: int + """ super(ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction, self).__init__(**kwargs) self.best_effort = best_effort self.configuration_data = configuration_data @@ -1841,30 +2545,29 @@ class ContentKeyPolicyPlayReadyLicense(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param allow_test_devices: Required. A flag indicating whether test devices can use the - license. - :type allow_test_devices: bool - :param begin_date: The begin date of license. - :type begin_date: ~datetime.datetime - :param expiration_date: The expiration date of license. - :type expiration_date: ~datetime.datetime - :param relative_begin_date: The relative begin date of license. - :type relative_begin_date: ~datetime.timedelta - :param relative_expiration_date: The relative expiration date of license. - :type relative_expiration_date: ~datetime.timedelta - :param grace_period: The grace period of license. - :type grace_period: ~datetime.timedelta - :param play_right: The license PlayRight. - :type play_right: ~azure.mgmt.media.models.ContentKeyPolicyPlayReadyPlayRight - :param license_type: Required. The license type. Possible values include: "Unknown", + :ivar allow_test_devices: Required. A flag indicating whether test devices can use the license. + :vartype allow_test_devices: bool + :ivar begin_date: The begin date of license. + :vartype begin_date: ~datetime.datetime + :ivar expiration_date: The expiration date of license. + :vartype expiration_date: ~datetime.datetime + :ivar relative_begin_date: The relative begin date of license. + :vartype relative_begin_date: ~datetime.timedelta + :ivar relative_expiration_date: The relative expiration date of license. + :vartype relative_expiration_date: ~datetime.timedelta + :ivar grace_period: The grace period of license. + :vartype grace_period: ~datetime.timedelta + :ivar play_right: The license PlayRight. + :vartype play_right: ~azure.mgmt.media.models.ContentKeyPolicyPlayReadyPlayRight + :ivar license_type: Required. The license type. Possible values include: "Unknown", "NonPersistent", "Persistent". - :type license_type: str or ~azure.mgmt.media.models.ContentKeyPolicyPlayReadyLicenseType - :param content_key_location: Required. The content key location. - :type content_key_location: + :vartype license_type: str or ~azure.mgmt.media.models.ContentKeyPolicyPlayReadyLicenseType + :ivar content_key_location: Required. The content key location. + :vartype content_key_location: ~azure.mgmt.media.models.ContentKeyPolicyPlayReadyContentKeyLocation - :param content_type: Required. The PlayReady content type. Possible values include: "Unknown", + :ivar content_type: Required. The PlayReady content type. Possible values include: "Unknown", "Unspecified", "UltraVioletDownload", "UltraVioletStreaming". - :type content_type: str or ~azure.mgmt.media.models.ContentKeyPolicyPlayReadyContentType + :vartype content_type: str or ~azure.mgmt.media.models.ContentKeyPolicyPlayReadyContentType """ _validation = { @@ -1902,6 +2605,32 @@ def __init__( play_right: Optional["ContentKeyPolicyPlayReadyPlayRight"] = None, **kwargs ): + """ + :keyword allow_test_devices: Required. A flag indicating whether test devices can use the + license. + :paramtype allow_test_devices: bool + :keyword begin_date: The begin date of license. + :paramtype begin_date: ~datetime.datetime + :keyword expiration_date: The expiration date of license. + :paramtype expiration_date: ~datetime.datetime + :keyword relative_begin_date: The relative begin date of license. + :paramtype relative_begin_date: ~datetime.timedelta + :keyword relative_expiration_date: The relative expiration date of license. + :paramtype relative_expiration_date: ~datetime.timedelta + :keyword grace_period: The grace period of license. + :paramtype grace_period: ~datetime.timedelta + :keyword play_right: The license PlayRight. + :paramtype play_right: ~azure.mgmt.media.models.ContentKeyPolicyPlayReadyPlayRight + :keyword license_type: Required. The license type. Possible values include: "Unknown", + "NonPersistent", "Persistent". + :paramtype license_type: str or ~azure.mgmt.media.models.ContentKeyPolicyPlayReadyLicenseType + :keyword content_key_location: Required. The content key location. + :paramtype content_key_location: + ~azure.mgmt.media.models.ContentKeyPolicyPlayReadyContentKeyLocation + :keyword content_type: Required. The PlayReady content type. Possible values include: + "Unknown", "Unspecified", "UltraVioletDownload", "UltraVioletStreaming". + :paramtype content_type: str or ~azure.mgmt.media.models.ContentKeyPolicyPlayReadyContentType + """ super(ContentKeyPolicyPlayReadyLicense, self).__init__(**kwargs) self.allow_test_devices = allow_test_devices self.begin_date = begin_date @@ -1920,47 +2649,47 @@ class ContentKeyPolicyPlayReadyPlayRight(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param first_play_expiration: The amount of time that the license is valid after the license is + :ivar first_play_expiration: The amount of time that the license is valid after the license is first used to play content. - :type first_play_expiration: ~datetime.timedelta - :param scms_restriction: Configures the Serial Copy Management System (SCMS) in the license. + :vartype first_play_expiration: ~datetime.timedelta + :ivar scms_restriction: Configures the Serial Copy Management System (SCMS) in the license. Must be between 0 and 3 inclusive. - :type scms_restriction: int - :param agc_and_color_stripe_restriction: Configures Automatic Gain Control (AGC) and Color + :vartype scms_restriction: int + :ivar agc_and_color_stripe_restriction: Configures Automatic Gain Control (AGC) and Color Stripe in the license. Must be between 0 and 3 inclusive. - :type agc_and_color_stripe_restriction: int - :param explicit_analog_television_output_restriction: Configures the Explicit Analog Television + :vartype agc_and_color_stripe_restriction: int + :ivar explicit_analog_television_output_restriction: Configures the Explicit Analog Television Output Restriction in the license. Configuration data must be between 0 and 3 inclusive. - :type explicit_analog_television_output_restriction: + :vartype explicit_analog_television_output_restriction: ~azure.mgmt.media.models.ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction - :param digital_video_only_content_restriction: Required. Enables the Image Constraint For - Analog Component Video Restriction in the license. - :type digital_video_only_content_restriction: bool - :param image_constraint_for_analog_component_video_restriction: Required. Enables the Image + :ivar digital_video_only_content_restriction: Required. Enables the Image Constraint For Analog + Component Video Restriction in the license. + :vartype digital_video_only_content_restriction: bool + :ivar image_constraint_for_analog_component_video_restriction: Required. Enables the Image Constraint For Analog Component Video Restriction in the license. - :type image_constraint_for_analog_component_video_restriction: bool - :param image_constraint_for_analog_computer_monitor_restriction: Required. Enables the Image + :vartype image_constraint_for_analog_component_video_restriction: bool + :ivar image_constraint_for_analog_computer_monitor_restriction: Required. Enables the Image Constraint For Analog Component Video Restriction in the license. - :type image_constraint_for_analog_computer_monitor_restriction: bool - :param allow_passing_video_content_to_unknown_output: Required. Configures Unknown output + :vartype image_constraint_for_analog_computer_monitor_restriction: bool + :ivar allow_passing_video_content_to_unknown_output: Required. Configures Unknown output handling settings of the license. Possible values include: "Unknown", "NotAllowed", "Allowed", "AllowedWithVideoConstriction". - :type allow_passing_video_content_to_unknown_output: str or + :vartype allow_passing_video_content_to_unknown_output: str or ~azure.mgmt.media.models.ContentKeyPolicyPlayReadyUnknownOutputPassingOption - :param uncompressed_digital_video_opl: Specifies the output protection level for uncompressed + :ivar uncompressed_digital_video_opl: Specifies the output protection level for uncompressed digital video. - :type uncompressed_digital_video_opl: int - :param compressed_digital_video_opl: Specifies the output protection level for compressed + :vartype uncompressed_digital_video_opl: int + :ivar compressed_digital_video_opl: Specifies the output protection level for compressed digital video. - :type compressed_digital_video_opl: int - :param analog_video_opl: Specifies the output protection level for compressed digital audio. - :type analog_video_opl: int - :param compressed_digital_audio_opl: Specifies the output protection level for compressed + :vartype compressed_digital_video_opl: int + :ivar analog_video_opl: Specifies the output protection level for compressed digital audio. + :vartype analog_video_opl: int + :ivar compressed_digital_audio_opl: Specifies the output protection level for compressed digital audio. - :type compressed_digital_audio_opl: int - :param uncompressed_digital_audio_opl: Specifies the output protection level for uncompressed + :vartype compressed_digital_audio_opl: int + :ivar uncompressed_digital_audio_opl: Specifies the output protection level for uncompressed digital audio. - :type uncompressed_digital_audio_opl: int + :vartype uncompressed_digital_audio_opl: int """ _validation = { @@ -2004,6 +2733,50 @@ def __init__( uncompressed_digital_audio_opl: Optional[int] = None, **kwargs ): + """ + :keyword first_play_expiration: The amount of time that the license is valid after the license + is first used to play content. + :paramtype first_play_expiration: ~datetime.timedelta + :keyword scms_restriction: Configures the Serial Copy Management System (SCMS) in the license. + Must be between 0 and 3 inclusive. + :paramtype scms_restriction: int + :keyword agc_and_color_stripe_restriction: Configures Automatic Gain Control (AGC) and Color + Stripe in the license. Must be between 0 and 3 inclusive. + :paramtype agc_and_color_stripe_restriction: int + :keyword explicit_analog_television_output_restriction: Configures the Explicit Analog + Television Output Restriction in the license. Configuration data must be between 0 and 3 + inclusive. + :paramtype explicit_analog_television_output_restriction: + ~azure.mgmt.media.models.ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction + :keyword digital_video_only_content_restriction: Required. Enables the Image Constraint For + Analog Component Video Restriction in the license. + :paramtype digital_video_only_content_restriction: bool + :keyword image_constraint_for_analog_component_video_restriction: Required. Enables the Image + Constraint For Analog Component Video Restriction in the license. + :paramtype image_constraint_for_analog_component_video_restriction: bool + :keyword image_constraint_for_analog_computer_monitor_restriction: Required. Enables the Image + Constraint For Analog Component Video Restriction in the license. + :paramtype image_constraint_for_analog_computer_monitor_restriction: bool + :keyword allow_passing_video_content_to_unknown_output: Required. Configures Unknown output + handling settings of the license. Possible values include: "Unknown", "NotAllowed", "Allowed", + "AllowedWithVideoConstriction". + :paramtype allow_passing_video_content_to_unknown_output: str or + ~azure.mgmt.media.models.ContentKeyPolicyPlayReadyUnknownOutputPassingOption + :keyword uncompressed_digital_video_opl: Specifies the output protection level for uncompressed + digital video. + :paramtype uncompressed_digital_video_opl: int + :keyword compressed_digital_video_opl: Specifies the output protection level for compressed + digital video. + :paramtype compressed_digital_video_opl: int + :keyword analog_video_opl: Specifies the output protection level for compressed digital audio. + :paramtype analog_video_opl: int + :keyword compressed_digital_audio_opl: Specifies the output protection level for compressed + digital audio. + :paramtype compressed_digital_audio_opl: int + :keyword uncompressed_digital_audio_opl: Specifies the output protection level for uncompressed + digital audio. + :paramtype uncompressed_digital_audio_opl: int + """ super(ContentKeyPolicyPlayReadyPlayRight, self).__init__(**kwargs) self.first_play_expiration = first_play_expiration self.scms_restriction = scms_restriction @@ -2033,10 +2806,10 @@ class ContentKeyPolicyProperties(msrest.serialization.Model): :vartype created: ~datetime.datetime :ivar last_modified: The last modified date of the Policy. :vartype last_modified: ~datetime.datetime - :param description: A description for the Policy. - :type description: str - :param options: Required. The Key Policy options. - :type options: list[~azure.mgmt.media.models.ContentKeyPolicyOption] + :ivar description: A description for the Policy. + :vartype description: str + :ivar options: Required. The Key Policy options. + :vartype options: list[~azure.mgmt.media.models.ContentKeyPolicyOption] """ _validation = { @@ -2061,6 +2834,12 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword description: A description for the Policy. + :paramtype description: str + :keyword options: Required. The Key Policy options. + :paramtype options: list[~azure.mgmt.media.models.ContentKeyPolicyOption] + """ super(ContentKeyPolicyProperties, self).__init__(**kwargs) self.policy_id = None self.created = None @@ -2077,8 +2856,8 @@ class ContentKeyPolicyRestrictionTokenKey(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str """ _validation = { @@ -2097,6 +2876,8 @@ def __init__( self, **kwargs ): + """ + """ super(ContentKeyPolicyRestrictionTokenKey, self).__init__(**kwargs) self.odata_type = None # type: Optional[str] @@ -2106,12 +2887,12 @@ class ContentKeyPolicyRsaTokenKey(ContentKeyPolicyRestrictionTokenKey): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param exponent: Required. The RSA Parameter exponent. - :type exponent: bytearray - :param modulus: Required. The RSA Parameter modulus. - :type modulus: bytearray + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar exponent: Required. The RSA Parameter exponent. + :vartype exponent: bytearray + :ivar modulus: Required. The RSA Parameter modulus. + :vartype modulus: bytearray """ _validation = { @@ -2133,6 +2914,12 @@ def __init__( modulus: bytearray, **kwargs ): + """ + :keyword exponent: Required. The RSA Parameter exponent. + :paramtype exponent: bytearray + :keyword modulus: Required. The RSA Parameter modulus. + :paramtype modulus: bytearray + """ super(ContentKeyPolicyRsaTokenKey, self).__init__(**kwargs) self.odata_type = '#Microsoft.Media.ContentKeyPolicyRsaTokenKey' # type: str self.exponent = exponent @@ -2144,10 +2931,10 @@ class ContentKeyPolicySymmetricTokenKey(ContentKeyPolicyRestrictionTokenKey): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param key_value: Required. The key value of the key. - :type key_value: bytearray + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar key_value: Required. The key value of the key. + :vartype key_value: bytearray """ _validation = { @@ -2166,6 +2953,10 @@ def __init__( key_value: bytearray, **kwargs ): + """ + :keyword key_value: Required. The key value of the key. + :paramtype key_value: bytearray + """ super(ContentKeyPolicySymmetricTokenKey, self).__init__(**kwargs) self.odata_type = '#Microsoft.Media.ContentKeyPolicySymmetricTokenKey' # type: str self.key_value = key_value @@ -2174,10 +2965,10 @@ def __init__( class ContentKeyPolicyTokenClaim(msrest.serialization.Model): """Represents a token claim. - :param claim_type: Token claim type. - :type claim_type: str - :param claim_value: Token claim value. - :type claim_value: str + :ivar claim_type: Token claim type. + :vartype claim_type: str + :ivar claim_value: Token claim value. + :vartype claim_value: str """ _attribute_map = { @@ -2192,6 +2983,12 @@ def __init__( claim_value: Optional[str] = None, **kwargs ): + """ + :keyword claim_type: Token claim type. + :paramtype claim_type: str + :keyword claim_value: Token claim value. + :paramtype claim_value: str + """ super(ContentKeyPolicyTokenClaim, self).__init__(**kwargs) self.claim_type = claim_type self.claim_value = claim_value @@ -2202,25 +2999,25 @@ class ContentKeyPolicyTokenRestriction(ContentKeyPolicyRestriction): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param issuer: Required. The token issuer. - :type issuer: str - :param audience: Required. The audience for the token. - :type audience: str - :param primary_verification_key: Required. The primary verification key. - :type primary_verification_key: ~azure.mgmt.media.models.ContentKeyPolicyRestrictionTokenKey - :param alternate_verification_keys: A list of alternative verification keys. - :type alternate_verification_keys: + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar issuer: Required. The token issuer. + :vartype issuer: str + :ivar audience: Required. The audience for the token. + :vartype audience: str + :ivar primary_verification_key: Required. The primary verification key. + :vartype primary_verification_key: ~azure.mgmt.media.models.ContentKeyPolicyRestrictionTokenKey + :ivar alternate_verification_keys: A list of alternative verification keys. + :vartype alternate_verification_keys: list[~azure.mgmt.media.models.ContentKeyPolicyRestrictionTokenKey] - :param required_claims: A list of required token claims. - :type required_claims: list[~azure.mgmt.media.models.ContentKeyPolicyTokenClaim] - :param restriction_token_type: Required. The type of token. Possible values include: "Unknown", + :ivar required_claims: A list of required token claims. + :vartype required_claims: list[~azure.mgmt.media.models.ContentKeyPolicyTokenClaim] + :ivar restriction_token_type: Required. The type of token. Possible values include: "Unknown", "Swt", "Jwt". - :type restriction_token_type: str or + :vartype restriction_token_type: str or ~azure.mgmt.media.models.ContentKeyPolicyRestrictionTokenType - :param open_id_connect_discovery_document: The OpenID connect discovery document. - :type open_id_connect_discovery_document: str + :ivar open_id_connect_discovery_document: The OpenID connect discovery document. + :vartype open_id_connect_discovery_document: str """ _validation = { @@ -2254,6 +3051,26 @@ def __init__( open_id_connect_discovery_document: Optional[str] = None, **kwargs ): + """ + :keyword issuer: Required. The token issuer. + :paramtype issuer: str + :keyword audience: Required. The audience for the token. + :paramtype audience: str + :keyword primary_verification_key: Required. The primary verification key. + :paramtype primary_verification_key: + ~azure.mgmt.media.models.ContentKeyPolicyRestrictionTokenKey + :keyword alternate_verification_keys: A list of alternative verification keys. + :paramtype alternate_verification_keys: + list[~azure.mgmt.media.models.ContentKeyPolicyRestrictionTokenKey] + :keyword required_claims: A list of required token claims. + :paramtype required_claims: list[~azure.mgmt.media.models.ContentKeyPolicyTokenClaim] + :keyword restriction_token_type: Required. The type of token. Possible values include: + "Unknown", "Swt", "Jwt". + :paramtype restriction_token_type: str or + ~azure.mgmt.media.models.ContentKeyPolicyRestrictionTokenType + :keyword open_id_connect_discovery_document: The OpenID connect discovery document. + :paramtype open_id_connect_discovery_document: str + """ super(ContentKeyPolicyTokenRestriction, self).__init__(**kwargs) self.odata_type = '#Microsoft.Media.ContentKeyPolicyTokenRestriction' # type: str self.issuer = issuer @@ -2270,8 +3087,8 @@ class ContentKeyPolicyUnknownConfiguration(ContentKeyPolicyConfiguration): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str """ _validation = { @@ -2286,6 +3103,8 @@ def __init__( self, **kwargs ): + """ + """ super(ContentKeyPolicyUnknownConfiguration, self).__init__(**kwargs) self.odata_type = '#Microsoft.Media.ContentKeyPolicyUnknownConfiguration' # type: str @@ -2295,8 +3114,8 @@ class ContentKeyPolicyUnknownRestriction(ContentKeyPolicyRestriction): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str """ _validation = { @@ -2311,6 +3130,8 @@ def __init__( self, **kwargs ): + """ + """ super(ContentKeyPolicyUnknownRestriction, self).__init__(**kwargs) self.odata_type = '#Microsoft.Media.ContentKeyPolicyUnknownRestriction' # type: str @@ -2320,10 +3141,10 @@ class ContentKeyPolicyWidevineConfiguration(ContentKeyPolicyConfiguration): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param widevine_template: Required. The Widevine template. - :type widevine_template: str + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar widevine_template: Required. The Widevine template. + :vartype widevine_template: str """ _validation = { @@ -2342,6 +3163,10 @@ def __init__( widevine_template: str, **kwargs ): + """ + :keyword widevine_template: Required. The Widevine template. + :paramtype widevine_template: str + """ super(ContentKeyPolicyWidevineConfiguration, self).__init__(**kwargs) self.odata_type = '#Microsoft.Media.ContentKeyPolicyWidevineConfiguration' # type: str self.widevine_template = widevine_template @@ -2352,11 +3177,11 @@ class ContentKeyPolicyX509CertificateTokenKey(ContentKeyPolicyRestrictionTokenKe All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param raw_body: Required. The raw data field of a certificate in PKCS 12 format + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar raw_body: Required. The raw data field of a certificate in PKCS 12 format (X509Certificate2 in .NET). - :type raw_body: bytearray + :vartype raw_body: bytearray """ _validation = { @@ -2375,6 +3200,11 @@ def __init__( raw_body: bytearray, **kwargs ): + """ + :keyword raw_body: Required. The raw data field of a certificate in PKCS 12 format + (X509Certificate2 in .NET). + :paramtype raw_body: bytearray + """ super(ContentKeyPolicyX509CertificateTokenKey, self).__init__(**kwargs) self.odata_type = '#Microsoft.Media.ContentKeyPolicyX509CertificateTokenKey' # type: str self.raw_body = raw_body @@ -2385,11 +3215,10 @@ class CopyAudio(Codec): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param label: An optional label for the codec. The label can be used to control muxing - behavior. - :type label: str + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar label: An optional label for the codec. The label can be used to control muxing behavior. + :vartype label: str """ _validation = { @@ -2407,6 +3236,11 @@ def __init__( label: Optional[str] = None, **kwargs ): + """ + :keyword label: An optional label for the codec. The label can be used to control muxing + behavior. + :paramtype label: str + """ super(CopyAudio, self).__init__(label=label, **kwargs) self.odata_type = '#Microsoft.Media.CopyAudio' # type: str @@ -2416,11 +3250,10 @@ class CopyVideo(Codec): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param label: An optional label for the codec. The label can be used to control muxing - behavior. - :type label: str + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar label: An optional label for the codec. The label can be used to control muxing behavior. + :vartype label: str """ _validation = { @@ -2438,6 +3271,11 @@ def __init__( label: Optional[str] = None, **kwargs ): + """ + :keyword label: An optional label for the codec. The label can be used to control muxing + behavior. + :paramtype label: str + """ super(CopyVideo, self).__init__(label=label, **kwargs) self.odata_type = '#Microsoft.Media.CopyVideo' # type: str @@ -2445,10 +3283,10 @@ def __init__( class CrossSiteAccessPolicies(msrest.serialization.Model): """The client access policy. - :param client_access_policy: The content of clientaccesspolicy.xml used by Silverlight. - :type client_access_policy: str - :param cross_domain_policy: The content of crossdomain.xml used by Silverlight. - :type cross_domain_policy: str + :ivar client_access_policy: The content of clientaccesspolicy.xml used by Silverlight. + :vartype client_access_policy: str + :ivar cross_domain_policy: The content of crossdomain.xml used by Silverlight. + :vartype cross_domain_policy: str """ _attribute_map = { @@ -2463,6 +3301,12 @@ def __init__( cross_domain_policy: Optional[str] = None, **kwargs ): + """ + :keyword client_access_policy: The content of clientaccesspolicy.xml used by Silverlight. + :paramtype client_access_policy: str + :keyword cross_domain_policy: The content of crossdomain.xml used by Silverlight. + :paramtype cross_domain_policy: str + """ super(CrossSiteAccessPolicies, self).__init__(**kwargs) self.client_access_policy = client_access_policy self.cross_domain_policy = cross_domain_policy @@ -2471,10 +3315,10 @@ def __init__( class DefaultKey(msrest.serialization.Model): """Class to specify properties of default content key for each encryption scheme. - :param label: Label can be used to specify Content Key when creating a Streaming Locator. - :type label: str - :param policy_name: Policy used by Default Key. - :type policy_name: str + :ivar label: Label can be used to specify Content Key when creating a Streaming Locator. + :vartype label: str + :ivar policy_name: Policy used by Default Key. + :vartype policy_name: str """ _attribute_map = { @@ -2489,6 +3333,12 @@ def __init__( policy_name: Optional[str] = None, **kwargs ): + """ + :keyword label: Label can be used to specify Content Key when creating a Streaming Locator. + :paramtype label: str + :keyword policy_name: Policy used by Default Key. + :paramtype policy_name: str + """ super(DefaultKey, self).__init__(**kwargs) self.label = label self.policy_name = policy_name @@ -2497,12 +3347,12 @@ def __init__( class Deinterlace(msrest.serialization.Model): """Describes the de-interlacing settings. - :param parity: The field parity for de-interlacing, defaults to Auto. Possible values include: + :ivar parity: The field parity for de-interlacing, defaults to Auto. Possible values include: "Auto", "TopFieldFirst", "BottomFieldFirst". - :type parity: str or ~azure.mgmt.media.models.DeinterlaceParity - :param mode: The deinterlacing mode. Defaults to AutoPixelAdaptive. Possible values include: + :vartype parity: str or ~azure.mgmt.media.models.DeinterlaceParity + :ivar mode: The deinterlacing mode. Defaults to AutoPixelAdaptive. Possible values include: "Off", "AutoPixelAdaptive". - :type mode: str or ~azure.mgmt.media.models.DeinterlaceMode + :vartype mode: str or ~azure.mgmt.media.models.DeinterlaceMode """ _attribute_map = { @@ -2517,6 +3367,14 @@ def __init__( mode: Optional[Union[str, "DeinterlaceMode"]] = None, **kwargs ): + """ + :keyword parity: The field parity for de-interlacing, defaults to Auto. Possible values + include: "Auto", "TopFieldFirst", "BottomFieldFirst". + :paramtype parity: str or ~azure.mgmt.media.models.DeinterlaceParity + :keyword mode: The deinterlacing mode. Defaults to AutoPixelAdaptive. Possible values include: + "Off", "AutoPixelAdaptive". + :paramtype mode: str or ~azure.mgmt.media.models.DeinterlaceMode + """ super(Deinterlace, self).__init__(**kwargs) self.parity = parity self.mode = mode @@ -2525,8 +3383,8 @@ def __init__( class EdgePolicies(msrest.serialization.Model): """EdgePolicies. - :param usage_data_collection_policy: - :type usage_data_collection_policy: ~azure.mgmt.media.models.EdgeUsageDataCollectionPolicy + :ivar usage_data_collection_policy: + :vartype usage_data_collection_policy: ~azure.mgmt.media.models.EdgeUsageDataCollectionPolicy """ _attribute_map = { @@ -2539,6 +3397,10 @@ def __init__( usage_data_collection_policy: Optional["EdgeUsageDataCollectionPolicy"] = None, **kwargs ): + """ + :keyword usage_data_collection_policy: + :paramtype usage_data_collection_policy: ~azure.mgmt.media.models.EdgeUsageDataCollectionPolicy + """ super(EdgePolicies, self).__init__(**kwargs) self.usage_data_collection_policy = usage_data_collection_policy @@ -2546,17 +3408,17 @@ def __init__( class EdgeUsageDataCollectionPolicy(msrest.serialization.Model): """EdgeUsageDataCollectionPolicy. - :param data_collection_frequency: Usage data collection frequency in ISO 8601 duration format - e.g. PT10M , PT5H. - :type data_collection_frequency: str - :param data_reporting_frequency: Usage data reporting frequency in ISO 8601 duration format + :ivar data_collection_frequency: Usage data collection frequency in ISO 8601 duration format e.g. PT10M , PT5H. - :type data_reporting_frequency: str - :param max_allowed_unreported_usage_duration: Maximum time for which the functionality of the + :vartype data_collection_frequency: str + :ivar data_reporting_frequency: Usage data reporting frequency in ISO 8601 duration format e.g. + PT10M , PT5H. + :vartype data_reporting_frequency: str + :ivar max_allowed_unreported_usage_duration: Maximum time for which the functionality of the device will not be hampered for not reporting the usage data. - :type max_allowed_unreported_usage_duration: str - :param event_hub_details: Details of Event Hub where the usage will be reported. - :type event_hub_details: ~azure.mgmt.media.models.EdgeUsageDataEventHub + :vartype max_allowed_unreported_usage_duration: str + :ivar event_hub_details: Details of Event Hub where the usage will be reported. + :vartype event_hub_details: ~azure.mgmt.media.models.EdgeUsageDataEventHub """ _attribute_map = { @@ -2575,6 +3437,19 @@ def __init__( event_hub_details: Optional["EdgeUsageDataEventHub"] = None, **kwargs ): + """ + :keyword data_collection_frequency: Usage data collection frequency in ISO 8601 duration format + e.g. PT10M , PT5H. + :paramtype data_collection_frequency: str + :keyword data_reporting_frequency: Usage data reporting frequency in ISO 8601 duration format + e.g. PT10M , PT5H. + :paramtype data_reporting_frequency: str + :keyword max_allowed_unreported_usage_duration: Maximum time for which the functionality of the + device will not be hampered for not reporting the usage data. + :paramtype max_allowed_unreported_usage_duration: str + :keyword event_hub_details: Details of Event Hub where the usage will be reported. + :paramtype event_hub_details: ~azure.mgmt.media.models.EdgeUsageDataEventHub + """ super(EdgeUsageDataCollectionPolicy, self).__init__(**kwargs) self.data_collection_frequency = data_collection_frequency self.data_reporting_frequency = data_reporting_frequency @@ -2585,12 +3460,12 @@ def __init__( class EdgeUsageDataEventHub(msrest.serialization.Model): """EdgeUsageDataEventHub. - :param name: Name of the Event Hub where usage will be reported. - :type name: str - :param namespace: Namespace of the Event Hub where usage will be reported. - :type namespace: str - :param token: SAS token needed to interact with Event Hub. - :type token: str + :ivar name: Name of the Event Hub where usage will be reported. + :vartype name: str + :ivar namespace: Namespace of the Event Hub where usage will be reported. + :vartype namespace: str + :ivar token: SAS token needed to interact with Event Hub. + :vartype token: str """ _attribute_map = { @@ -2607,6 +3482,14 @@ def __init__( token: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of the Event Hub where usage will be reported. + :paramtype name: str + :keyword namespace: Namespace of the Event Hub where usage will be reported. + :paramtype namespace: str + :keyword token: SAS token needed to interact with Event Hub. + :paramtype token: str + """ super(EdgeUsageDataEventHub, self).__init__(**kwargs) self.name = name self.namespace = namespace @@ -2618,14 +3501,14 @@ class EnabledProtocols(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param download: Required. Enable Download protocol or not. - :type download: bool - :param dash: Required. Enable DASH protocol or not. - :type dash: bool - :param hls: Required. Enable HLS protocol or not. - :type hls: bool - :param smooth_streaming: Required. Enable SmoothStreaming protocol or not. - :type smooth_streaming: bool + :ivar download: Required. Enable Download protocol or not. + :vartype download: bool + :ivar dash: Required. Enable DASH protocol or not. + :vartype dash: bool + :ivar hls: Required. Enable HLS protocol or not. + :vartype hls: bool + :ivar smooth_streaming: Required. Enable SmoothStreaming protocol or not. + :vartype smooth_streaming: bool """ _validation = { @@ -2651,6 +3534,16 @@ def __init__( smooth_streaming: bool, **kwargs ): + """ + :keyword download: Required. Enable Download protocol or not. + :paramtype download: bool + :keyword dash: Required. Enable DASH protocol or not. + :paramtype dash: bool + :keyword hls: Required. Enable HLS protocol or not. + :paramtype hls: bool + :keyword smooth_streaming: Required. Enable SmoothStreaming protocol or not. + :paramtype smooth_streaming: bool + """ super(EnabledProtocols, self).__init__(**kwargs) self.download = download self.dash = dash @@ -2663,12 +3556,12 @@ class EntityNameAvailabilityCheckOutput(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name_available: Required. Specifies if the name is available. - :type name_available: bool - :param reason: Specifies the reason if the name is not available. - :type reason: str - :param message: Specifies the detailed reason if the name is not available. - :type message: str + :ivar name_available: Required. Specifies if the name is available. + :vartype name_available: bool + :ivar reason: Specifies the reason if the name is not available. + :vartype reason: str + :ivar message: Specifies the detailed reason if the name is not available. + :vartype message: str """ _validation = { @@ -2689,6 +3582,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword name_available: Required. Specifies if the name is available. + :paramtype name_available: bool + :keyword reason: Specifies the reason if the name is not available. + :paramtype reason: str + :keyword message: Specifies the detailed reason if the name is not available. + :paramtype message: str + """ super(EntityNameAvailabilityCheckOutput, self).__init__(**kwargs) self.name_available = name_available self.reason = reason @@ -2698,21 +3599,21 @@ def __init__( class EnvelopeEncryption(msrest.serialization.Model): """Class for EnvelopeEncryption encryption scheme. - :param enabled_protocols: Representing supported protocols. - :type enabled_protocols: ~azure.mgmt.media.models.EnabledProtocols - :param clear_tracks: Representing which tracks should not be encrypted. - :type clear_tracks: list[~azure.mgmt.media.models.TrackSelection] - :param content_keys: Representing default content key for each encryption scheme and separate + :ivar enabled_protocols: Representing supported protocols. + :vartype enabled_protocols: ~azure.mgmt.media.models.EnabledProtocols + :ivar clear_tracks: Representing which tracks should not be encrypted. + :vartype clear_tracks: list[~azure.mgmt.media.models.TrackSelection] + :ivar content_keys: Representing default content key for each encryption scheme and separate content keys for specific tracks. - :type content_keys: ~azure.mgmt.media.models.StreamingPolicyContentKeys - :param custom_key_acquisition_url_template: Template for the URL of the custom service + :vartype content_keys: ~azure.mgmt.media.models.StreamingPolicyContentKeys + :ivar custom_key_acquisition_url_template: Template for the URL of the custom service delivering keys to end user players. Not required when using Azure Media Services for issuing keys. The template supports replaceable tokens that the service will update at runtime with the value specific to the request. The currently supported token values are {AlternativeMediaId}, which is replaced with the value of StreamingLocatorId.AlternativeMediaId, and {ContentKeyId}, which is replaced with the value of identifier of the key being requested. - :type custom_key_acquisition_url_template: str + :vartype custom_key_acquisition_url_template: str """ _attribute_map = { @@ -2731,6 +3632,23 @@ def __init__( custom_key_acquisition_url_template: Optional[str] = None, **kwargs ): + """ + :keyword enabled_protocols: Representing supported protocols. + :paramtype enabled_protocols: ~azure.mgmt.media.models.EnabledProtocols + :keyword clear_tracks: Representing which tracks should not be encrypted. + :paramtype clear_tracks: list[~azure.mgmt.media.models.TrackSelection] + :keyword content_keys: Representing default content key for each encryption scheme and separate + content keys for specific tracks. + :paramtype content_keys: ~azure.mgmt.media.models.StreamingPolicyContentKeys + :keyword custom_key_acquisition_url_template: Template for the URL of the custom service + delivering keys to end user players. Not required when using Azure Media Services for issuing + keys. The template supports replaceable tokens that the service will update at runtime with + the value specific to the request. The currently supported token values are + {AlternativeMediaId}, which is replaced with the value of + StreamingLocatorId.AlternativeMediaId, and {ContentKeyId}, which is replaced with the value of + identifier of the key being requested. + :paramtype custom_key_acquisition_url_template: str + """ super(EnvelopeEncryption, self).__init__(**kwargs) self.enabled_protocols = enabled_protocols self.clear_tracks = clear_tracks @@ -2763,6 +3681,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorAdditionalInfo, self).__init__(**kwargs) self.type = None self.info = None @@ -2805,6 +3725,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorDetail, self).__init__(**kwargs) self.code = None self.message = None @@ -2816,8 +3738,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: ~azure.mgmt.media.models.ErrorDetail + :ivar error: The error object. + :vartype error: ~azure.mgmt.media.models.ErrorDetail """ _attribute_map = { @@ -2830,6 +3752,10 @@ def __init__( error: Optional["ErrorDetail"] = None, **kwargs ): + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.media.models.ErrorDetail + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -2839,32 +3765,32 @@ class FaceDetectorPreset(Preset): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param resolution: Specifies the maximum resolution at which your video is analyzed. The - default behavior is "SourceResolution," which will keep the input video at its original - resolution when analyzed. Using "StandardDefinition" will resize input videos to standard - definition while preserving the appropriate aspect ratio. It will only resize if the video is - of higher resolution. For example, a 1920x1080 input would be scaled to 640x360 before - processing. Switching to "StandardDefinition" will reduce the time it takes to process high - resolution video. It may also reduce the cost of using this component (see + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar resolution: Specifies the maximum resolution at which your video is analyzed. The default + behavior is "SourceResolution," which will keep the input video at its original resolution when + analyzed. Using "StandardDefinition" will resize input videos to standard definition while + preserving the appropriate aspect ratio. It will only resize if the video is of higher + resolution. For example, a 1920x1080 input would be scaled to 640x360 before processing. + Switching to "StandardDefinition" will reduce the time it takes to process high resolution + video. It may also reduce the cost of using this component (see https://azure.microsoft.com/en-us/pricing/details/media-services/#analytics for details). However, faces that end up being too small in the resized video may not be detected. Possible values include: "SourceResolution", "StandardDefinition". - :type resolution: str or ~azure.mgmt.media.models.AnalysisResolution - :param mode: This mode provides the ability to choose between the following settings: 1) - Analyze - For detection only.This mode generates a metadata JSON file marking appearances of - faces throughout the video.Where possible, appearances of the same person are assigned the same - ID. 2) Combined - Additionally redacts(blurs) detected faces. 3) Redact - This enables a 2-pass + :vartype resolution: str or ~azure.mgmt.media.models.AnalysisResolution + :ivar mode: This mode provides the ability to choose between the following settings: 1) Analyze + - For detection only.This mode generates a metadata JSON file marking appearances of faces + throughout the video.Where possible, appearances of the same person are assigned the same ID. + 2) Combined - Additionally redacts(blurs) detected faces. 3) Redact - This enables a 2-pass process, allowing for selective redaction of a subset of detected faces.It takes in the metadata file from a prior analyze pass, along with the source video, and a user-selected subset of IDs that require redaction. Possible values include: "Analyze", "Redact", "Combined". - :type mode: str or ~azure.mgmt.media.models.FaceRedactorMode - :param blur_type: Blur type. Possible values include: "Box", "Low", "Med", "High", "Black". - :type blur_type: str or ~azure.mgmt.media.models.BlurType - :param experimental_options: Dictionary containing key value pairs for parameters not exposed - in the preset itself. - :type experimental_options: dict[str, str] + :vartype mode: str or ~azure.mgmt.media.models.FaceRedactorMode + :ivar blur_type: Blur type. Possible values include: "Box", "Low", "Med", "High", "Black". + :vartype blur_type: str or ~azure.mgmt.media.models.BlurType + :ivar experimental_options: Dictionary containing key value pairs for parameters not exposed in + the preset itself. + :vartype experimental_options: dict[str, str] """ _validation = { @@ -2888,6 +3814,32 @@ def __init__( experimental_options: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword resolution: Specifies the maximum resolution at which your video is analyzed. The + default behavior is "SourceResolution," which will keep the input video at its original + resolution when analyzed. Using "StandardDefinition" will resize input videos to standard + definition while preserving the appropriate aspect ratio. It will only resize if the video is + of higher resolution. For example, a 1920x1080 input would be scaled to 640x360 before + processing. Switching to "StandardDefinition" will reduce the time it takes to process high + resolution video. It may also reduce the cost of using this component (see + https://azure.microsoft.com/en-us/pricing/details/media-services/#analytics for details). + However, faces that end up being too small in the resized video may not be detected. Possible + values include: "SourceResolution", "StandardDefinition". + :paramtype resolution: str or ~azure.mgmt.media.models.AnalysisResolution + :keyword mode: This mode provides the ability to choose between the following settings: 1) + Analyze - For detection only.This mode generates a metadata JSON file marking appearances of + faces throughout the video.Where possible, appearances of the same person are assigned the same + ID. 2) Combined - Additionally redacts(blurs) detected faces. 3) Redact - This enables a 2-pass + process, allowing for selective redaction of a subset of detected faces.It takes in the + metadata file from a prior analyze pass, along with the source video, and a user-selected + subset of IDs that require redaction. Possible values include: "Analyze", "Redact", "Combined". + :paramtype mode: str or ~azure.mgmt.media.models.FaceRedactorMode + :keyword blur_type: Blur type. Possible values include: "Box", "Low", "Med", "High", "Black". + :paramtype blur_type: str or ~azure.mgmt.media.models.BlurType + :keyword experimental_options: Dictionary containing key value pairs for parameters not exposed + in the preset itself. + :paramtype experimental_options: dict[str, str] + """ super(FaceDetectorPreset, self).__init__(**kwargs) self.odata_type = '#Microsoft.Media.FaceDetectorPreset' # type: str self.resolution = resolution @@ -2899,17 +3851,17 @@ def __init__( class Filters(msrest.serialization.Model): """Describes all the filtering operations, such as de-interlacing, rotation etc. that are to be applied to the input media before encoding. - :param deinterlace: The de-interlacing settings. - :type deinterlace: ~azure.mgmt.media.models.Deinterlace - :param rotation: The rotation, if any, to be applied to the input video, before it is encoded. + :ivar deinterlace: The de-interlacing settings. + :vartype deinterlace: ~azure.mgmt.media.models.Deinterlace + :ivar rotation: The rotation, if any, to be applied to the input video, before it is encoded. Default is Auto. Possible values include: "Auto", "None", "Rotate0", "Rotate90", "Rotate180", "Rotate270". - :type rotation: str or ~azure.mgmt.media.models.Rotation - :param crop: The parameters for the rectangular window with which to crop the input video. - :type crop: ~azure.mgmt.media.models.Rectangle - :param overlays: The properties of overlays to be applied to the input video. These could be + :vartype rotation: str or ~azure.mgmt.media.models.Rotation + :ivar crop: The parameters for the rectangular window with which to crop the input video. + :vartype crop: ~azure.mgmt.media.models.Rectangle + :ivar overlays: The properties of overlays to be applied to the input video. These could be audio, image or video overlays. - :type overlays: list[~azure.mgmt.media.models.Overlay] + :vartype overlays: list[~azure.mgmt.media.models.Overlay] """ _attribute_map = { @@ -2928,6 +3880,19 @@ def __init__( overlays: Optional[List["Overlay"]] = None, **kwargs ): + """ + :keyword deinterlace: The de-interlacing settings. + :paramtype deinterlace: ~azure.mgmt.media.models.Deinterlace + :keyword rotation: The rotation, if any, to be applied to the input video, before it is + encoded. Default is Auto. Possible values include: "Auto", "None", "Rotate0", "Rotate90", + "Rotate180", "Rotate270". + :paramtype rotation: str or ~azure.mgmt.media.models.Rotation + :keyword crop: The parameters for the rectangular window with which to crop the input video. + :paramtype crop: ~azure.mgmt.media.models.Rectangle + :keyword overlays: The properties of overlays to be applied to the input video. These could be + audio, image or video overlays. + :paramtype overlays: list[~azure.mgmt.media.models.Overlay] + """ super(Filters, self).__init__(**kwargs) self.deinterlace = deinterlace self.rotation = rotation @@ -2940,14 +3905,14 @@ class FilterTrackPropertyCondition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param property: Required. The track property type. Possible values include: "Unknown", "Type", + :ivar property: Required. The track property type. Possible values include: "Unknown", "Type", "Name", "Language", "FourCC", "Bitrate". - :type property: str or ~azure.mgmt.media.models.FilterTrackPropertyType - :param value: Required. The track property value. - :type value: str - :param operation: Required. The track property condition operation. Possible values include: + :vartype property: str or ~azure.mgmt.media.models.FilterTrackPropertyType + :ivar value: Required. The track property value. + :vartype value: str + :ivar operation: Required. The track property condition operation. Possible values include: "Equal", "NotEqual". - :type operation: str or ~azure.mgmt.media.models.FilterTrackPropertyCompareOperation + :vartype operation: str or ~azure.mgmt.media.models.FilterTrackPropertyCompareOperation """ _validation = { @@ -2970,6 +3935,16 @@ def __init__( operation: Union[str, "FilterTrackPropertyCompareOperation"], **kwargs ): + """ + :keyword property: Required. The track property type. Possible values include: "Unknown", + "Type", "Name", "Language", "FourCC", "Bitrate". + :paramtype property: str or ~azure.mgmt.media.models.FilterTrackPropertyType + :keyword value: Required. The track property value. + :paramtype value: str + :keyword operation: Required. The track property condition operation. Possible values include: + "Equal", "NotEqual". + :paramtype operation: str or ~azure.mgmt.media.models.FilterTrackPropertyCompareOperation + """ super(FilterTrackPropertyCondition, self).__init__(**kwargs) self.property = property self.value = value @@ -2981,8 +3956,8 @@ class FilterTrackSelection(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param track_selections: Required. The track selections. - :type track_selections: list[~azure.mgmt.media.models.FilterTrackPropertyCondition] + :ivar track_selections: Required. The track selections. + :vartype track_selections: list[~azure.mgmt.media.models.FilterTrackPropertyCondition] """ _validation = { @@ -2999,6 +3974,10 @@ def __init__( track_selections: List["FilterTrackPropertyCondition"], **kwargs ): + """ + :keyword track_selections: Required. The track selections. + :paramtype track_selections: list[~azure.mgmt.media.models.FilterTrackPropertyCondition] + """ super(FilterTrackSelection, self).__init__(**kwargs) self.track_selections = track_selections @@ -3008,8 +3987,8 @@ class FirstQuality(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param bitrate: Required. The first quality bitrate. - :type bitrate: int + :ivar bitrate: Required. The first quality bitrate. + :vartype bitrate: int """ _validation = { @@ -3026,6 +4005,10 @@ def __init__( bitrate: int, **kwargs ): + """ + :keyword bitrate: Required. The first quality bitrate. + :paramtype bitrate: int + """ super(FirstQuality, self).__init__(**kwargs) self.bitrate = bitrate @@ -3038,20 +4021,19 @@ class Format(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param filename_pattern: Required. The pattern of the file names for the generated output - files. The following macros are supported in the file name: {Basename} - An expansion macro - that will use the name of the input video file. If the base name(the file suffix is not - included) of the input video file is less than 32 characters long, the base name of input video - files will be used. If the length of base name of the input video file exceeds 32 characters, - the base name is truncated to the first 32 characters in total length. {Extension} - The - appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - - A unique index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video - bitrate. Not applicable to thumbnails. {Codec} - The type of the audio/video codec. - {Resolution} - The video resolution. Any unsubstituted macros will be collapsed and removed - from the filename. - :type filename_pattern: str + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar filename_pattern: Required. The pattern of the file names for the generated output files. + The following macros are supported in the file name: {Basename} - An expansion macro that will + use the name of the input video file. If the base name(the file suffix is not included) of the + input video file is less than 32 characters long, the base name of input video files will be + used. If the length of base name of the input video file exceeds 32 characters, the base name + is truncated to the first 32 characters in total length. {Extension} - The appropriate + extension for this format. {Label} - The label assigned to the codec/layer. {Index} - A unique + index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video bitrate. Not + applicable to thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video + resolution. Any unsubstituted macros will be collapsed and removed from the filename. + :vartype filename_pattern: str """ _validation = { @@ -3074,6 +4056,20 @@ def __init__( filename_pattern: str, **kwargs ): + """ + :keyword filename_pattern: Required. The pattern of the file names for the generated output + files. The following macros are supported in the file name: {Basename} - An expansion macro + that will use the name of the input video file. If the base name(the file suffix is not + included) of the input video file is less than 32 characters long, the base name of input video + files will be used. If the length of base name of the input video file exceeds 32 characters, + the base name is truncated to the first 32 characters in total length. {Extension} - The + appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} + - A unique index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video + bitrate. Not applicable to thumbnails. {Codec} - The type of the audio/video codec. + {Resolution} - The video resolution. Any unsubstituted macros will be collapsed and removed + from the filename. + :paramtype filename_pattern: str + """ super(Format, self).__init__(**kwargs) self.odata_type = None # type: Optional[str] self.filename_pattern = filename_pattern @@ -3087,11 +4083,11 @@ class InputDefinition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param included_tracks: The list of TrackDescriptors which define the metadata and selection of + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar included_tracks: The list of TrackDescriptors which define the metadata and selection of tracks in the input. - :type included_tracks: list[~azure.mgmt.media.models.TrackDescriptor] + :vartype included_tracks: list[~azure.mgmt.media.models.TrackDescriptor] """ _validation = { @@ -3113,6 +4109,11 @@ def __init__( included_tracks: Optional[List["TrackDescriptor"]] = None, **kwargs ): + """ + :keyword included_tracks: The list of TrackDescriptors which define the metadata and selection + of tracks in the input. + :paramtype included_tracks: list[~azure.mgmt.media.models.TrackDescriptor] + """ super(InputDefinition, self).__init__(**kwargs) self.odata_type = None # type: Optional[str] self.included_tracks = included_tracks @@ -3123,11 +4124,11 @@ class FromAllInputFile(InputDefinition): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param included_tracks: The list of TrackDescriptors which define the metadata and selection of + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar included_tracks: The list of TrackDescriptors which define the metadata and selection of tracks in the input. - :type included_tracks: list[~azure.mgmt.media.models.TrackDescriptor] + :vartype included_tracks: list[~azure.mgmt.media.models.TrackDescriptor] """ _validation = { @@ -3145,6 +4146,11 @@ def __init__( included_tracks: Optional[List["TrackDescriptor"]] = None, **kwargs ): + """ + :keyword included_tracks: The list of TrackDescriptors which define the metadata and selection + of tracks in the input. + :paramtype included_tracks: list[~azure.mgmt.media.models.TrackDescriptor] + """ super(FromAllInputFile, self).__init__(included_tracks=included_tracks, **kwargs) self.odata_type = '#Microsoft.Media.FromAllInputFile' # type: str @@ -3154,11 +4160,11 @@ class FromEachInputFile(InputDefinition): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param included_tracks: The list of TrackDescriptors which define the metadata and selection of + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar included_tracks: The list of TrackDescriptors which define the metadata and selection of tracks in the input. - :type included_tracks: list[~azure.mgmt.media.models.TrackDescriptor] + :vartype included_tracks: list[~azure.mgmt.media.models.TrackDescriptor] """ _validation = { @@ -3176,6 +4182,11 @@ def __init__( included_tracks: Optional[List["TrackDescriptor"]] = None, **kwargs ): + """ + :keyword included_tracks: The list of TrackDescriptors which define the metadata and selection + of tracks in the input. + :paramtype included_tracks: list[~azure.mgmt.media.models.TrackDescriptor] + """ super(FromEachInputFile, self).__init__(included_tracks=included_tracks, **kwargs) self.odata_type = '#Microsoft.Media.FromEachInputFile' # type: str @@ -3183,41 +4194,25 @@ def __init__( class Layer(msrest.serialization.Model): """The encoder can be configured to produce video and/or images (thumbnails) at different resolutions, by specifying a layer for each desired resolution. A layer represents the properties for the video or image at a resolution. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: H265VideoLayer, JpgLayer, PngLayer, VideoLayer. - - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param width: The width of the output video for this layer. The value can be absolute (in + :ivar width: The width of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example 50% means the output video has half as many pixels in width as the input. - :type width: str - :param height: The height of the output video for this layer. The value can be absolute (in + :vartype width: str + :ivar height: The height of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example 50% means the output video has half as many pixels in height as the input. - :type height: str - :param label: The alphanumeric label for this layer, which can be used in multiplexing - different video and audio layers, or in naming the output file. - :type label: str + :vartype height: str + :ivar label: The alphanumeric label for this layer, which can be used in multiplexing different + video and audio layers, or in naming the output file. + :vartype label: str """ - _validation = { - 'odata_type': {'required': True}, - } - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'width': {'key': 'width', 'type': 'str'}, 'height': {'key': 'height', 'type': 'str'}, 'label': {'key': 'label', 'type': 'str'}, } - _subtype_map = { - 'odata_type': {'#Microsoft.Media.H265VideoLayer': 'H265VideoLayer', '#Microsoft.Media.JpgLayer': 'JpgLayer', '#Microsoft.Media.PngLayer': 'PngLayer', '#Microsoft.Media.VideoLayer': 'VideoLayer'} - } - def __init__( self, *, @@ -3226,8 +4221,20 @@ def __init__( label: Optional[str] = None, **kwargs ): + """ + :keyword width: The width of the output video for this layer. The value can be absolute (in + pixels) or relative (in percentage). For example 50% means the output video has half as many + pixels in width as the input. + :paramtype width: str + :keyword height: The height of the output video for this layer. The value can be absolute (in + pixels) or relative (in percentage). For example 50% means the output video has half as many + pixels in height as the input. + :paramtype height: str + :keyword label: The alphanumeric label for this layer, which can be used in multiplexing + different video and audio layers, or in naming the output file. + :paramtype label: str + """ super(Layer, self).__init__(**kwargs) - self.odata_type = None # type: Optional[str] self.width = width self.height = height self.label = label @@ -3236,55 +4243,48 @@ def __init__( class VideoLayer(Layer): """Describes the settings to be used when encoding the input video into a desired output bitrate layer. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: H264Layer. - All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param width: The width of the output video for this layer. The value can be absolute (in + :ivar width: The width of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example 50% means the output video has half as many pixels in width as the input. - :type width: str - :param height: The height of the output video for this layer. The value can be absolute (in + :vartype width: str + :ivar height: The height of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example 50% means the output video has half as many pixels in height as the input. - :type height: str - :param label: The alphanumeric label for this layer, which can be used in multiplexing - different video and audio layers, or in naming the output file. - :type label: str - :param bitrate: Required. The average bitrate in bits per second at which to encode the input + :vartype height: str + :ivar label: The alphanumeric label for this layer, which can be used in multiplexing different + video and audio layers, or in naming the output file. + :vartype label: str + :ivar bitrate: Required. The average bitrate in bits per second at which to encode the input video when generating this layer. This is a required field. - :type bitrate: int - :param max_bitrate: The maximum bitrate (in bits per second), at which the VBV buffer should be + :vartype bitrate: int + :ivar max_bitrate: The maximum bitrate (in bits per second), at which the VBV buffer should be assumed to refill. If not specified, defaults to the same value as bitrate. - :type max_bitrate: int - :param b_frames: The number of B-frames to be used when encoding this layer. If not specified, + :vartype max_bitrate: int + :ivar b_frames: The number of B-frames to be used when encoding this layer. If not specified, the encoder chooses an appropriate number based on the video profile and level. - :type b_frames: int - :param frame_rate: The frame rate (in frames per second) at which to encode this layer. The + :vartype b_frames: int + :ivar frame_rate: The frame rate (in frames per second) at which to encode this layer. The value can be in the form of M/N where M and N are integers (For example, 30000/1001), or in the form of a number (For example, 30, or 29.97). The encoder enforces constraints on allowed frame rates based on the profile and level. If it is not specified, the encoder will use the same frame rate as the input video. - :type frame_rate: str - :param slices: The number of slices to be used when encoding this layer. If not specified, + :vartype frame_rate: str + :ivar slices: The number of slices to be used when encoding this layer. If not specified, default is zero, which means that encoder will use a single slice for each frame. - :type slices: int - :param adaptive_b_frame: Whether or not adaptive B-frames are to be used when encoding this + :vartype slices: int + :ivar adaptive_b_frame: Whether or not adaptive B-frames are to be used when encoding this layer. If not specified, the encoder will turn it on whenever the video profile permits its use. - :type adaptive_b_frame: bool + :vartype adaptive_b_frame: bool """ _validation = { - 'odata_type': {'required': True}, 'bitrate': {'required': True}, } _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'width': {'key': 'width', 'type': 'str'}, 'height': {'key': 'height', 'type': 'str'}, 'label': {'key': 'label', 'type': 'str'}, @@ -3296,10 +4296,6 @@ class VideoLayer(Layer): 'adaptive_b_frame': {'key': 'adaptiveBFrame', 'type': 'bool'}, } - _subtype_map = { - 'odata_type': {'#Microsoft.Media.H264Layer': 'H264Layer'} - } - def __init__( self, *, @@ -3314,8 +4310,42 @@ def __init__( adaptive_b_frame: Optional[bool] = None, **kwargs ): + """ + :keyword width: The width of the output video for this layer. The value can be absolute (in + pixels) or relative (in percentage). For example 50% means the output video has half as many + pixels in width as the input. + :paramtype width: str + :keyword height: The height of the output video for this layer. The value can be absolute (in + pixels) or relative (in percentage). For example 50% means the output video has half as many + pixels in height as the input. + :paramtype height: str + :keyword label: The alphanumeric label for this layer, which can be used in multiplexing + different video and audio layers, or in naming the output file. + :paramtype label: str + :keyword bitrate: Required. The average bitrate in bits per second at which to encode the input + video when generating this layer. This is a required field. + :paramtype bitrate: int + :keyword max_bitrate: The maximum bitrate (in bits per second), at which the VBV buffer should + be assumed to refill. If not specified, defaults to the same value as bitrate. + :paramtype max_bitrate: int + :keyword b_frames: The number of B-frames to be used when encoding this layer. If not + specified, the encoder chooses an appropriate number based on the video profile and level. + :paramtype b_frames: int + :keyword frame_rate: The frame rate (in frames per second) at which to encode this layer. The + value can be in the form of M/N where M and N are integers (For example, 30000/1001), or in the + form of a number (For example, 30, or 29.97). The encoder enforces constraints on allowed frame + rates based on the profile and level. If it is not specified, the encoder will use the same + frame rate as the input video. + :paramtype frame_rate: str + :keyword slices: The number of slices to be used when encoding this layer. If not specified, + default is zero, which means that encoder will use a single slice for each frame. + :paramtype slices: int + :keyword adaptive_b_frame: Whether or not adaptive B-frames are to be used when encoding this + layer. If not specified, the encoder will turn it on whenever the video profile permits its + use. + :paramtype adaptive_b_frame: bool + """ super(VideoLayer, self).__init__(width=width, height=height, label=label, **kwargs) - self.odata_type = '#Microsoft.Media.VideoLayer' # type: str self.bitrate = bitrate self.max_bitrate = max_bitrate self.b_frames = b_frames @@ -3329,68 +4359,70 @@ class H264Layer(VideoLayer): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param width: The width of the output video for this layer. The value can be absolute (in + :ivar width: The width of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example 50% means the output video has half as many pixels in width as the input. - :type width: str - :param height: The height of the output video for this layer. The value can be absolute (in + :vartype width: str + :ivar height: The height of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example 50% means the output video has half as many pixels in height as the input. - :type height: str - :param label: The alphanumeric label for this layer, which can be used in multiplexing - different video and audio layers, or in naming the output file. - :type label: str - :param bitrate: Required. The average bitrate in bits per second at which to encode the input + :vartype height: str + :ivar label: The alphanumeric label for this layer, which can be used in multiplexing different + video and audio layers, or in naming the output file. + :vartype label: str + :ivar bitrate: Required. The average bitrate in bits per second at which to encode the input video when generating this layer. This is a required field. - :type bitrate: int - :param max_bitrate: The maximum bitrate (in bits per second), at which the VBV buffer should be + :vartype bitrate: int + :ivar max_bitrate: The maximum bitrate (in bits per second), at which the VBV buffer should be assumed to refill. If not specified, defaults to the same value as bitrate. - :type max_bitrate: int - :param b_frames: The number of B-frames to be used when encoding this layer. If not specified, + :vartype max_bitrate: int + :ivar b_frames: The number of B-frames to be used when encoding this layer. If not specified, the encoder chooses an appropriate number based on the video profile and level. - :type b_frames: int - :param frame_rate: The frame rate (in frames per second) at which to encode this layer. The + :vartype b_frames: int + :ivar frame_rate: The frame rate (in frames per second) at which to encode this layer. The value can be in the form of M/N where M and N are integers (For example, 30000/1001), or in the form of a number (For example, 30, or 29.97). The encoder enforces constraints on allowed frame rates based on the profile and level. If it is not specified, the encoder will use the same frame rate as the input video. - :type frame_rate: str - :param slices: The number of slices to be used when encoding this layer. If not specified, + :vartype frame_rate: str + :ivar slices: The number of slices to be used when encoding this layer. If not specified, default is zero, which means that encoder will use a single slice for each frame. - :type slices: int - :param adaptive_b_frame: Whether or not adaptive B-frames are to be used when encoding this + :vartype slices: int + :ivar adaptive_b_frame: Whether or not adaptive B-frames are to be used when encoding this layer. If not specified, the encoder will turn it on whenever the video profile permits its use. - :type adaptive_b_frame: bool - :param profile: We currently support Baseline, Main, High, High422, High444. Default is Auto. + :vartype adaptive_b_frame: bool + :ivar profile: We currently support Baseline, Main, High, High422, High444. Default is Auto. Possible values include: "Auto", "Baseline", "Main", "High", "High422", "High444". - :type profile: str or ~azure.mgmt.media.models.H264VideoProfile - :param level: We currently support Level up to 6.2. The value can be Auto, or a number that + :vartype profile: str or ~azure.mgmt.media.models.H264VideoProfile + :ivar level: We currently support Level up to 6.2. The value can be Auto, or a number that matches the H.264 profile. If not specified, the default is Auto, which lets the encoder choose the Level that is appropriate for this layer. - :type level: str - :param buffer_window: The VBV buffer window length. The value should be in ISO 8601 format. The + :vartype level: str + :ivar buffer_window: The VBV buffer window length. The value should be in ISO 8601 format. The value should be in the range [0.1-100] seconds. The default is 5 seconds (for example, PT5S). - :type buffer_window: ~datetime.timedelta - :param reference_frames: The number of reference frames to be used when encoding this layer. If + :vartype buffer_window: ~datetime.timedelta + :ivar crf: The value of CRF to be used when encoding this layer. This setting takes effect when + RateControlMode of video codec is set at CRF mode. The range of CRF value is between 0 and 51, + where lower values would result in better quality, at the expense of higher file sizes. Higher + values mean more compression, but at some point quality degradation will be noticed. Default + value is 23. + :vartype crf: float + :ivar reference_frames: The number of reference frames to be used when encoding this layer. If not specified, the encoder determines an appropriate number based on the encoder complexity setting. - :type reference_frames: int - :param entropy_mode: The entropy mode to be used for this layer. If not specified, the encoder + :vartype reference_frames: int + :ivar entropy_mode: The entropy mode to be used for this layer. If not specified, the encoder chooses the mode that is appropriate for the profile and level. Possible values include: "Cabac", "Cavlc". - :type entropy_mode: str or ~azure.mgmt.media.models.EntropyMode + :vartype entropy_mode: str or ~azure.mgmt.media.models.EntropyMode """ _validation = { - 'odata_type': {'required': True}, 'bitrate': {'required': True}, } _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'width': {'key': 'width', 'type': 'str'}, 'height': {'key': 'height', 'type': 'str'}, 'label': {'key': 'label', 'type': 'str'}, @@ -3403,6 +4435,7 @@ class H264Layer(VideoLayer): 'profile': {'key': 'profile', 'type': 'str'}, 'level': {'key': 'level', 'type': 'str'}, 'buffer_window': {'key': 'bufferWindow', 'type': 'duration'}, + 'crf': {'key': 'crf', 'type': 'float'}, 'reference_frames': {'key': 'referenceFrames', 'type': 'int'}, 'entropy_mode': {'key': 'entropyMode', 'type': 'str'}, } @@ -3422,15 +4455,76 @@ def __init__( profile: Optional[Union[str, "H264VideoProfile"]] = None, level: Optional[str] = None, buffer_window: Optional[datetime.timedelta] = None, + crf: Optional[float] = None, reference_frames: Optional[int] = None, entropy_mode: Optional[Union[str, "EntropyMode"]] = None, **kwargs ): + """ + :keyword width: The width of the output video for this layer. The value can be absolute (in + pixels) or relative (in percentage). For example 50% means the output video has half as many + pixels in width as the input. + :paramtype width: str + :keyword height: The height of the output video for this layer. The value can be absolute (in + pixels) or relative (in percentage). For example 50% means the output video has half as many + pixels in height as the input. + :paramtype height: str + :keyword label: The alphanumeric label for this layer, which can be used in multiplexing + different video and audio layers, or in naming the output file. + :paramtype label: str + :keyword bitrate: Required. The average bitrate in bits per second at which to encode the input + video when generating this layer. This is a required field. + :paramtype bitrate: int + :keyword max_bitrate: The maximum bitrate (in bits per second), at which the VBV buffer should + be assumed to refill. If not specified, defaults to the same value as bitrate. + :paramtype max_bitrate: int + :keyword b_frames: The number of B-frames to be used when encoding this layer. If not + specified, the encoder chooses an appropriate number based on the video profile and level. + :paramtype b_frames: int + :keyword frame_rate: The frame rate (in frames per second) at which to encode this layer. The + value can be in the form of M/N where M and N are integers (For example, 30000/1001), or in the + form of a number (For example, 30, or 29.97). The encoder enforces constraints on allowed frame + rates based on the profile and level. If it is not specified, the encoder will use the same + frame rate as the input video. + :paramtype frame_rate: str + :keyword slices: The number of slices to be used when encoding this layer. If not specified, + default is zero, which means that encoder will use a single slice for each frame. + :paramtype slices: int + :keyword adaptive_b_frame: Whether or not adaptive B-frames are to be used when encoding this + layer. If not specified, the encoder will turn it on whenever the video profile permits its + use. + :paramtype adaptive_b_frame: bool + :keyword profile: We currently support Baseline, Main, High, High422, High444. Default is Auto. + Possible values include: "Auto", "Baseline", "Main", "High", "High422", "High444". + :paramtype profile: str or ~azure.mgmt.media.models.H264VideoProfile + :keyword level: We currently support Level up to 6.2. The value can be Auto, or a number that + matches the H.264 profile. If not specified, the default is Auto, which lets the encoder choose + the Level that is appropriate for this layer. + :paramtype level: str + :keyword buffer_window: The VBV buffer window length. The value should be in ISO 8601 format. + The value should be in the range [0.1-100] seconds. The default is 5 seconds (for example, + PT5S). + :paramtype buffer_window: ~datetime.timedelta + :keyword crf: The value of CRF to be used when encoding this layer. This setting takes effect + when RateControlMode of video codec is set at CRF mode. The range of CRF value is between 0 and + 51, where lower values would result in better quality, at the expense of higher file sizes. + Higher values mean more compression, but at some point quality degradation will be noticed. + Default value is 23. + :paramtype crf: float + :keyword reference_frames: The number of reference frames to be used when encoding this layer. + If not specified, the encoder determines an appropriate number based on the encoder complexity + setting. + :paramtype reference_frames: int + :keyword entropy_mode: The entropy mode to be used for this layer. If not specified, the + encoder chooses the mode that is appropriate for the profile and level. Possible values + include: "Cabac", "Cavlc". + :paramtype entropy_mode: str or ~azure.mgmt.media.models.EntropyMode + """ super(H264Layer, self).__init__(width=width, height=height, label=label, bitrate=bitrate, max_bitrate=max_bitrate, b_frames=b_frames, frame_rate=frame_rate, slices=slices, adaptive_b_frame=adaptive_b_frame, **kwargs) - self.odata_type = '#Microsoft.Media.H264Layer' # type: str self.profile = profile self.level = level self.buffer_window = buffer_window + self.crf = crf self.reference_frames = reference_frames self.entropy_mode = entropy_mode @@ -3443,23 +4537,22 @@ class Video(Codec): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param label: An optional label for the codec. The label can be used to control muxing - behavior. - :type label: str - :param key_frame_interval: The distance between two key frames. The value should be non-zero in + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar label: An optional label for the codec. The label can be used to control muxing behavior. + :vartype label: str + :ivar key_frame_interval: The distance between two key frames. The value should be non-zero in the range [0.5, 20] seconds, specified in ISO 8601 format. The default is 2 seconds(PT2S). Note that this setting is ignored if VideoSyncMode.Passthrough is set, where the KeyFrameInterval value will follow the input source setting. - :type key_frame_interval: ~datetime.timedelta - :param stretch_mode: The resizing mode - how the input video will be resized to fit the desired + :vartype key_frame_interval: ~datetime.timedelta + :ivar stretch_mode: The resizing mode - how the input video will be resized to fit the desired output resolution(s). Default is AutoSize. Possible values include: "None", "AutoSize", "AutoFit". - :type stretch_mode: str or ~azure.mgmt.media.models.StretchMode - :param sync_mode: The Video Sync Mode. Possible values include: "Auto", "Passthrough", "Cfr", + :vartype stretch_mode: str or ~azure.mgmt.media.models.StretchMode + :ivar sync_mode: The Video Sync Mode. Possible values include: "Auto", "Passthrough", "Cfr", "Vfr". - :type sync_mode: str or ~azure.mgmt.media.models.VideoSyncMode + :vartype sync_mode: str or ~azure.mgmt.media.models.VideoSyncMode """ _validation = { @@ -3487,6 +4580,23 @@ def __init__( sync_mode: Optional[Union[str, "VideoSyncMode"]] = None, **kwargs ): + """ + :keyword label: An optional label for the codec. The label can be used to control muxing + behavior. + :paramtype label: str + :keyword key_frame_interval: The distance between two key frames. The value should be non-zero + in the range [0.5, 20] seconds, specified in ISO 8601 format. The default is 2 seconds(PT2S). + Note that this setting is ignored if VideoSyncMode.Passthrough is set, where the + KeyFrameInterval value will follow the input source setting. + :paramtype key_frame_interval: ~datetime.timedelta + :keyword stretch_mode: The resizing mode - how the input video will be resized to fit the + desired output resolution(s). Default is AutoSize. Possible values include: "None", "AutoSize", + "AutoFit". + :paramtype stretch_mode: str or ~azure.mgmt.media.models.StretchMode + :keyword sync_mode: The Video Sync Mode. Possible values include: "Auto", "Passthrough", "Cfr", + "Vfr". + :paramtype sync_mode: str or ~azure.mgmt.media.models.VideoSyncMode + """ super(Video, self).__init__(label=label, **kwargs) self.odata_type = '#Microsoft.Media.Video' # type: str self.key_frame_interval = key_frame_interval @@ -3499,32 +4609,34 @@ class H264Video(Video): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param label: An optional label for the codec. The label can be used to control muxing - behavior. - :type label: str - :param key_frame_interval: The distance between two key frames. The value should be non-zero in + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar label: An optional label for the codec. The label can be used to control muxing behavior. + :vartype label: str + :ivar key_frame_interval: The distance between two key frames. The value should be non-zero in the range [0.5, 20] seconds, specified in ISO 8601 format. The default is 2 seconds(PT2S). Note that this setting is ignored if VideoSyncMode.Passthrough is set, where the KeyFrameInterval value will follow the input source setting. - :type key_frame_interval: ~datetime.timedelta - :param stretch_mode: The resizing mode - how the input video will be resized to fit the desired + :vartype key_frame_interval: ~datetime.timedelta + :ivar stretch_mode: The resizing mode - how the input video will be resized to fit the desired output resolution(s). Default is AutoSize. Possible values include: "None", "AutoSize", "AutoFit". - :type stretch_mode: str or ~azure.mgmt.media.models.StretchMode - :param sync_mode: The Video Sync Mode. Possible values include: "Auto", "Passthrough", "Cfr", + :vartype stretch_mode: str or ~azure.mgmt.media.models.StretchMode + :ivar sync_mode: The Video Sync Mode. Possible values include: "Auto", "Passthrough", "Cfr", "Vfr". - :type sync_mode: str or ~azure.mgmt.media.models.VideoSyncMode - :param scene_change_detection: Whether or not the encoder should insert key frames at scene + :vartype sync_mode: str or ~azure.mgmt.media.models.VideoSyncMode + :ivar complexity: Tells the encoder how to choose its encoding settings. The default value is + Balanced. Possible values include: "Speed", "Balanced", "Quality". + :vartype complexity: str or ~azure.mgmt.media.models.H264Complexity + :ivar layers: The collection of output H.264 layers to be produced by the encoder. + :vartype layers: list[~azure.mgmt.media.models.H264Layer] + :ivar rate_control_mode: The video rate control mode. Possible values include: "ABR", "CBR", + "CRF". + :vartype rate_control_mode: str or ~azure.mgmt.media.models.H264RateControlMode + :ivar scene_change_detection: Whether or not the encoder should insert key frames at scene changes. If not specified, the default is false. This flag should be set to true only when the encoder is being configured to produce a single output video. - :type scene_change_detection: bool - :param complexity: Tells the encoder how to choose its encoding settings. The default value is - Balanced. Possible values include: "Speed", "Balanced", "Quality". - :type complexity: str or ~azure.mgmt.media.models.H264Complexity - :param layers: The collection of output H.264 layers to be produced by the encoder. - :type layers: list[~azure.mgmt.media.models.H264Layer] + :vartype scene_change_detection: bool """ _validation = { @@ -3537,9 +4649,10 @@ class H264Video(Video): 'key_frame_interval': {'key': 'keyFrameInterval', 'type': 'duration'}, 'stretch_mode': {'key': 'stretchMode', 'type': 'str'}, 'sync_mode': {'key': 'syncMode', 'type': 'str'}, - 'scene_change_detection': {'key': 'sceneChangeDetection', 'type': 'bool'}, 'complexity': {'key': 'complexity', 'type': 'str'}, 'layers': {'key': 'layers', 'type': '[H264Layer]'}, + 'rate_control_mode': {'key': 'rateControlMode', 'type': 'str'}, + 'scene_change_detection': {'key': 'sceneChangeDetection', 'type': 'bool'}, } def __init__( @@ -3549,71 +4662,95 @@ def __init__( key_frame_interval: Optional[datetime.timedelta] = None, stretch_mode: Optional[Union[str, "StretchMode"]] = None, sync_mode: Optional[Union[str, "VideoSyncMode"]] = None, - scene_change_detection: Optional[bool] = None, complexity: Optional[Union[str, "H264Complexity"]] = None, layers: Optional[List["H264Layer"]] = None, + rate_control_mode: Optional[Union[str, "H264RateControlMode"]] = None, + scene_change_detection: Optional[bool] = None, **kwargs ): + """ + :keyword label: An optional label for the codec. The label can be used to control muxing + behavior. + :paramtype label: str + :keyword key_frame_interval: The distance between two key frames. The value should be non-zero + in the range [0.5, 20] seconds, specified in ISO 8601 format. The default is 2 seconds(PT2S). + Note that this setting is ignored if VideoSyncMode.Passthrough is set, where the + KeyFrameInterval value will follow the input source setting. + :paramtype key_frame_interval: ~datetime.timedelta + :keyword stretch_mode: The resizing mode - how the input video will be resized to fit the + desired output resolution(s). Default is AutoSize. Possible values include: "None", "AutoSize", + "AutoFit". + :paramtype stretch_mode: str or ~azure.mgmt.media.models.StretchMode + :keyword sync_mode: The Video Sync Mode. Possible values include: "Auto", "Passthrough", "Cfr", + "Vfr". + :paramtype sync_mode: str or ~azure.mgmt.media.models.VideoSyncMode + :keyword complexity: Tells the encoder how to choose its encoding settings. The default value + is Balanced. Possible values include: "Speed", "Balanced", "Quality". + :paramtype complexity: str or ~azure.mgmt.media.models.H264Complexity + :keyword layers: The collection of output H.264 layers to be produced by the encoder. + :paramtype layers: list[~azure.mgmt.media.models.H264Layer] + :keyword rate_control_mode: The video rate control mode. Possible values include: "ABR", "CBR", + "CRF". + :paramtype rate_control_mode: str or ~azure.mgmt.media.models.H264RateControlMode + :keyword scene_change_detection: Whether or not the encoder should insert key frames at scene + changes. If not specified, the default is false. This flag should be set to true only when the + encoder is being configured to produce a single output video. + :paramtype scene_change_detection: bool + """ super(H264Video, self).__init__(label=label, key_frame_interval=key_frame_interval, stretch_mode=stretch_mode, sync_mode=sync_mode, **kwargs) self.odata_type = '#Microsoft.Media.H264Video' # type: str - self.scene_change_detection = scene_change_detection self.complexity = complexity self.layers = layers + self.rate_control_mode = rate_control_mode + self.scene_change_detection = scene_change_detection class H265VideoLayer(Layer): """Describes the settings to be used when encoding the input video into a desired output bitrate layer. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: H265Layer. - All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param width: The width of the output video for this layer. The value can be absolute (in + :ivar width: The width of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example 50% means the output video has half as many pixels in width as the input. - :type width: str - :param height: The height of the output video for this layer. The value can be absolute (in + :vartype width: str + :ivar height: The height of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example 50% means the output video has half as many pixels in height as the input. - :type height: str - :param label: The alphanumeric label for this layer, which can be used in multiplexing - different video and audio layers, or in naming the output file. - :type label: str - :param bitrate: Required. The average bitrate in bits per second at which to encode the input + :vartype height: str + :ivar label: The alphanumeric label for this layer, which can be used in multiplexing different + video and audio layers, or in naming the output file. + :vartype label: str + :ivar bitrate: Required. The average bitrate in bits per second at which to encode the input video when generating this layer. For example: a target bitrate of 3000Kbps or 3Mbps means this value should be 3000000 This is a required field. - :type bitrate: int - :param max_bitrate: The maximum bitrate (in bits per second), at which the VBV buffer should be + :vartype bitrate: int + :ivar max_bitrate: The maximum bitrate (in bits per second), at which the VBV buffer should be assumed to refill. If not specified, defaults to the same value as bitrate. - :type max_bitrate: int - :param b_frames: The number of B-frames to be used when encoding this layer. If not specified, + :vartype max_bitrate: int + :ivar b_frames: The number of B-frames to be used when encoding this layer. If not specified, the encoder chooses an appropriate number based on the video profile and level. - :type b_frames: int - :param frame_rate: The frame rate (in frames per second) at which to encode this layer. The + :vartype b_frames: int + :ivar frame_rate: The frame rate (in frames per second) at which to encode this layer. The value can be in the form of M/N where M and N are integers (For example, 30000/1001), or in the form of a number (For example, 30, or 29.97). The encoder enforces constraints on allowed frame rates based on the profile and level. If it is not specified, the encoder will use the same frame rate as the input video. - :type frame_rate: str - :param slices: The number of slices to be used when encoding this layer. If not specified, + :vartype frame_rate: str + :ivar slices: The number of slices to be used when encoding this layer. If not specified, default is zero, which means that encoder will use a single slice for each frame. - :type slices: int - :param adaptive_b_frame: Specifies whether or not adaptive B-frames are to be used when - encoding this layer. If not specified, the encoder will turn it on whenever the video profile - permits its use. - :type adaptive_b_frame: bool + :vartype slices: int + :ivar adaptive_b_frame: Specifies whether or not adaptive B-frames are to be used when encoding + this layer. If not specified, the encoder will turn it on whenever the video profile permits + its use. + :vartype adaptive_b_frame: bool """ _validation = { - 'odata_type': {'required': True}, 'bitrate': {'required': True}, } _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'width': {'key': 'width', 'type': 'str'}, 'height': {'key': 'height', 'type': 'str'}, 'label': {'key': 'label', 'type': 'str'}, @@ -3625,10 +4762,6 @@ class H265VideoLayer(Layer): 'adaptive_b_frame': {'key': 'adaptiveBFrame', 'type': 'bool'}, } - _subtype_map = { - 'odata_type': {'#Microsoft.Media.H265Layer': 'H265Layer'} - } - def __init__( self, *, @@ -3643,8 +4776,43 @@ def __init__( adaptive_b_frame: Optional[bool] = None, **kwargs ): + """ + :keyword width: The width of the output video for this layer. The value can be absolute (in + pixels) or relative (in percentage). For example 50% means the output video has half as many + pixels in width as the input. + :paramtype width: str + :keyword height: The height of the output video for this layer. The value can be absolute (in + pixels) or relative (in percentage). For example 50% means the output video has half as many + pixels in height as the input. + :paramtype height: str + :keyword label: The alphanumeric label for this layer, which can be used in multiplexing + different video and audio layers, or in naming the output file. + :paramtype label: str + :keyword bitrate: Required. The average bitrate in bits per second at which to encode the input + video when generating this layer. For example: a target bitrate of 3000Kbps or 3Mbps means this + value should be 3000000 This is a required field. + :paramtype bitrate: int + :keyword max_bitrate: The maximum bitrate (in bits per second), at which the VBV buffer should + be assumed to refill. If not specified, defaults to the same value as bitrate. + :paramtype max_bitrate: int + :keyword b_frames: The number of B-frames to be used when encoding this layer. If not + specified, the encoder chooses an appropriate number based on the video profile and level. + :paramtype b_frames: int + :keyword frame_rate: The frame rate (in frames per second) at which to encode this layer. The + value can be in the form of M/N where M and N are integers (For example, 30000/1001), or in the + form of a number (For example, 30, or 29.97). The encoder enforces constraints on allowed frame + rates based on the profile and level. If it is not specified, the encoder will use the same + frame rate as the input video. + :paramtype frame_rate: str + :keyword slices: The number of slices to be used when encoding this layer. If not specified, + default is zero, which means that encoder will use a single slice for each frame. + :paramtype slices: int + :keyword adaptive_b_frame: Specifies whether or not adaptive B-frames are to be used when + encoding this layer. If not specified, the encoder will turn it on whenever the video profile + permits its use. + :paramtype adaptive_b_frame: bool + """ super(H265VideoLayer, self).__init__(width=width, height=height, label=label, **kwargs) - self.odata_type = '#Microsoft.Media.H265VideoLayer' # type: str self.bitrate = bitrate self.max_bitrate = max_bitrate self.b_frames = b_frames @@ -3658,65 +4826,67 @@ class H265Layer(H265VideoLayer): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param width: The width of the output video for this layer. The value can be absolute (in + :ivar width: The width of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example 50% means the output video has half as many pixels in width as the input. - :type width: str - :param height: The height of the output video for this layer. The value can be absolute (in + :vartype width: str + :ivar height: The height of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example 50% means the output video has half as many pixels in height as the input. - :type height: str - :param label: The alphanumeric label for this layer, which can be used in multiplexing - different video and audio layers, or in naming the output file. - :type label: str - :param bitrate: Required. The average bitrate in bits per second at which to encode the input + :vartype height: str + :ivar label: The alphanumeric label for this layer, which can be used in multiplexing different + video and audio layers, or in naming the output file. + :vartype label: str + :ivar bitrate: Required. The average bitrate in bits per second at which to encode the input video when generating this layer. For example: a target bitrate of 3000Kbps or 3Mbps means this value should be 3000000 This is a required field. - :type bitrate: int - :param max_bitrate: The maximum bitrate (in bits per second), at which the VBV buffer should be + :vartype bitrate: int + :ivar max_bitrate: The maximum bitrate (in bits per second), at which the VBV buffer should be assumed to refill. If not specified, defaults to the same value as bitrate. - :type max_bitrate: int - :param b_frames: The number of B-frames to be used when encoding this layer. If not specified, + :vartype max_bitrate: int + :ivar b_frames: The number of B-frames to be used when encoding this layer. If not specified, the encoder chooses an appropriate number based on the video profile and level. - :type b_frames: int - :param frame_rate: The frame rate (in frames per second) at which to encode this layer. The + :vartype b_frames: int + :ivar frame_rate: The frame rate (in frames per second) at which to encode this layer. The value can be in the form of M/N where M and N are integers (For example, 30000/1001), or in the form of a number (For example, 30, or 29.97). The encoder enforces constraints on allowed frame rates based on the profile and level. If it is not specified, the encoder will use the same frame rate as the input video. - :type frame_rate: str - :param slices: The number of slices to be used when encoding this layer. If not specified, + :vartype frame_rate: str + :ivar slices: The number of slices to be used when encoding this layer. If not specified, default is zero, which means that encoder will use a single slice for each frame. - :type slices: int - :param adaptive_b_frame: Specifies whether or not adaptive B-frames are to be used when - encoding this layer. If not specified, the encoder will turn it on whenever the video profile - permits its use. - :type adaptive_b_frame: bool - :param profile: We currently support Main. Default is Auto. Possible values include: "Auto", - "Main". - :type profile: str or ~azure.mgmt.media.models.H265VideoProfile - :param level: We currently support Level up to 6.2. The value can be Auto, or a number that + :vartype slices: int + :ivar adaptive_b_frame: Specifies whether or not adaptive B-frames are to be used when encoding + this layer. If not specified, the encoder will turn it on whenever the video profile permits + its use. + :vartype adaptive_b_frame: bool + :ivar profile: We currently support Main. Default is Auto. Possible values include: "Auto", + "Main", "Main10". + :vartype profile: str or ~azure.mgmt.media.models.H265VideoProfile + :ivar level: We currently support Level up to 6.2. The value can be Auto, or a number that matches the H.265 profile. If not specified, the default is Auto, which lets the encoder choose the Level that is appropriate for this layer. - :type level: str - :param buffer_window: The VBV buffer window length. The value should be in ISO 8601 format. The + :vartype level: str + :ivar buffer_window: The VBV buffer window length. The value should be in ISO 8601 format. The value should be in the range [0.1-100] seconds. The default is 5 seconds (for example, PT5S). - :type buffer_window: ~datetime.timedelta - :param reference_frames: The number of reference frames to be used when encoding this layer. If + :vartype buffer_window: ~datetime.timedelta + :ivar crf: The value of CRF to be used when encoding this layer. This setting takes effect when + RateControlMode of video codec is set at CRF mode. The range of CRF value is between 0 and 51, + where lower values would result in better quality, at the expense of higher file sizes. Higher + values mean more compression, but at some point quality degradation will be noticed. Default + value is 28. + :vartype crf: float + :ivar reference_frames: The number of reference frames to be used when encoding this layer. If not specified, the encoder determines an appropriate number based on the encoder complexity setting. - :type reference_frames: int + :vartype reference_frames: int """ _validation = { - 'odata_type': {'required': True}, 'bitrate': {'required': True}, } _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'width': {'key': 'width', 'type': 'str'}, 'height': {'key': 'height', 'type': 'str'}, 'label': {'key': 'label', 'type': 'str'}, @@ -3729,6 +4899,7 @@ class H265Layer(H265VideoLayer): 'profile': {'key': 'profile', 'type': 'str'}, 'level': {'key': 'level', 'type': 'str'}, 'buffer_window': {'key': 'bufferWindow', 'type': 'duration'}, + 'crf': {'key': 'crf', 'type': 'float'}, 'reference_frames': {'key': 'referenceFrames', 'type': 'int'}, } @@ -3747,14 +4918,72 @@ def __init__( profile: Optional[Union[str, "H265VideoProfile"]] = None, level: Optional[str] = None, buffer_window: Optional[datetime.timedelta] = None, + crf: Optional[float] = None, reference_frames: Optional[int] = None, **kwargs ): + """ + :keyword width: The width of the output video for this layer. The value can be absolute (in + pixels) or relative (in percentage). For example 50% means the output video has half as many + pixels in width as the input. + :paramtype width: str + :keyword height: The height of the output video for this layer. The value can be absolute (in + pixels) or relative (in percentage). For example 50% means the output video has half as many + pixels in height as the input. + :paramtype height: str + :keyword label: The alphanumeric label for this layer, which can be used in multiplexing + different video and audio layers, or in naming the output file. + :paramtype label: str + :keyword bitrate: Required. The average bitrate in bits per second at which to encode the input + video when generating this layer. For example: a target bitrate of 3000Kbps or 3Mbps means this + value should be 3000000 This is a required field. + :paramtype bitrate: int + :keyword max_bitrate: The maximum bitrate (in bits per second), at which the VBV buffer should + be assumed to refill. If not specified, defaults to the same value as bitrate. + :paramtype max_bitrate: int + :keyword b_frames: The number of B-frames to be used when encoding this layer. If not + specified, the encoder chooses an appropriate number based on the video profile and level. + :paramtype b_frames: int + :keyword frame_rate: The frame rate (in frames per second) at which to encode this layer. The + value can be in the form of M/N where M and N are integers (For example, 30000/1001), or in the + form of a number (For example, 30, or 29.97). The encoder enforces constraints on allowed frame + rates based on the profile and level. If it is not specified, the encoder will use the same + frame rate as the input video. + :paramtype frame_rate: str + :keyword slices: The number of slices to be used when encoding this layer. If not specified, + default is zero, which means that encoder will use a single slice for each frame. + :paramtype slices: int + :keyword adaptive_b_frame: Specifies whether or not adaptive B-frames are to be used when + encoding this layer. If not specified, the encoder will turn it on whenever the video profile + permits its use. + :paramtype adaptive_b_frame: bool + :keyword profile: We currently support Main. Default is Auto. Possible values include: "Auto", + "Main", "Main10". + :paramtype profile: str or ~azure.mgmt.media.models.H265VideoProfile + :keyword level: We currently support Level up to 6.2. The value can be Auto, or a number that + matches the H.265 profile. If not specified, the default is Auto, which lets the encoder choose + the Level that is appropriate for this layer. + :paramtype level: str + :keyword buffer_window: The VBV buffer window length. The value should be in ISO 8601 format. + The value should be in the range [0.1-100] seconds. The default is 5 seconds (for example, + PT5S). + :paramtype buffer_window: ~datetime.timedelta + :keyword crf: The value of CRF to be used when encoding this layer. This setting takes effect + when RateControlMode of video codec is set at CRF mode. The range of CRF value is between 0 and + 51, where lower values would result in better quality, at the expense of higher file sizes. + Higher values mean more compression, but at some point quality degradation will be noticed. + Default value is 28. + :paramtype crf: float + :keyword reference_frames: The number of reference frames to be used when encoding this layer. + If not specified, the encoder determines an appropriate number based on the encoder complexity + setting. + :paramtype reference_frames: int + """ super(H265Layer, self).__init__(width=width, height=height, label=label, bitrate=bitrate, max_bitrate=max_bitrate, b_frames=b_frames, frame_rate=frame_rate, slices=slices, adaptive_b_frame=adaptive_b_frame, **kwargs) - self.odata_type = '#Microsoft.Media.H265Layer' # type: str self.profile = profile self.level = level self.buffer_window = buffer_window + self.crf = crf self.reference_frames = reference_frames @@ -3763,34 +4992,33 @@ class H265Video(Video): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param label: An optional label for the codec. The label can be used to control muxing - behavior. - :type label: str - :param key_frame_interval: The distance between two key frames. The value should be non-zero in + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar label: An optional label for the codec. The label can be used to control muxing behavior. + :vartype label: str + :ivar key_frame_interval: The distance between two key frames. The value should be non-zero in the range [0.5, 20] seconds, specified in ISO 8601 format. The default is 2 seconds(PT2S). Note that this setting is ignored if VideoSyncMode.Passthrough is set, where the KeyFrameInterval value will follow the input source setting. - :type key_frame_interval: ~datetime.timedelta - :param stretch_mode: The resizing mode - how the input video will be resized to fit the desired + :vartype key_frame_interval: ~datetime.timedelta + :ivar stretch_mode: The resizing mode - how the input video will be resized to fit the desired output resolution(s). Default is AutoSize. Possible values include: "None", "AutoSize", "AutoFit". - :type stretch_mode: str or ~azure.mgmt.media.models.StretchMode - :param sync_mode: The Video Sync Mode. Possible values include: "Auto", "Passthrough", "Cfr", + :vartype stretch_mode: str or ~azure.mgmt.media.models.StretchMode + :ivar sync_mode: The Video Sync Mode. Possible values include: "Auto", "Passthrough", "Cfr", "Vfr". - :type sync_mode: str or ~azure.mgmt.media.models.VideoSyncMode - :param scene_change_detection: Specifies whether or not the encoder should insert key frames at + :vartype sync_mode: str or ~azure.mgmt.media.models.VideoSyncMode + :ivar scene_change_detection: Specifies whether or not the encoder should insert key frames at scene changes. If not specified, the default is false. This flag should be set to true only when the encoder is being configured to produce a single output video. - :type scene_change_detection: bool - :param complexity: Tells the encoder how to choose its encoding settings. Quality will provide + :vartype scene_change_detection: bool + :ivar complexity: Tells the encoder how to choose its encoding settings. Quality will provide for a higher compression ratio but at a higher cost and longer compute time. Speed will produce a relatively larger file but is faster and more economical. The default value is Balanced. Possible values include: "Speed", "Balanced", "Quality". - :type complexity: str or ~azure.mgmt.media.models.H265Complexity - :param layers: The collection of output H.265 layers to be produced by the encoder. - :type layers: list[~azure.mgmt.media.models.H265Layer] + :vartype complexity: str or ~azure.mgmt.media.models.H265Complexity + :ivar layers: The collection of output H.265 layers to be produced by the encoder. + :vartype layers: list[~azure.mgmt.media.models.H265Layer] """ _validation = { @@ -3820,6 +5048,34 @@ def __init__( layers: Optional[List["H265Layer"]] = None, **kwargs ): + """ + :keyword label: An optional label for the codec. The label can be used to control muxing + behavior. + :paramtype label: str + :keyword key_frame_interval: The distance between two key frames. The value should be non-zero + in the range [0.5, 20] seconds, specified in ISO 8601 format. The default is 2 seconds(PT2S). + Note that this setting is ignored if VideoSyncMode.Passthrough is set, where the + KeyFrameInterval value will follow the input source setting. + :paramtype key_frame_interval: ~datetime.timedelta + :keyword stretch_mode: The resizing mode - how the input video will be resized to fit the + desired output resolution(s). Default is AutoSize. Possible values include: "None", "AutoSize", + "AutoFit". + :paramtype stretch_mode: str or ~azure.mgmt.media.models.StretchMode + :keyword sync_mode: The Video Sync Mode. Possible values include: "Auto", "Passthrough", "Cfr", + "Vfr". + :paramtype sync_mode: str or ~azure.mgmt.media.models.VideoSyncMode + :keyword scene_change_detection: Specifies whether or not the encoder should insert key frames + at scene changes. If not specified, the default is false. This flag should be set to true only + when the encoder is being configured to produce a single output video. + :paramtype scene_change_detection: bool + :keyword complexity: Tells the encoder how to choose its encoding settings. Quality will + provide for a higher compression ratio but at a higher cost and longer compute time. Speed + will produce a relatively larger file but is faster and more economical. The default value is + Balanced. Possible values include: "Speed", "Balanced", "Quality". + :paramtype complexity: str or ~azure.mgmt.media.models.H265Complexity + :keyword layers: The collection of output H.265 layers to be produced by the encoder. + :paramtype layers: list[~azure.mgmt.media.models.H265Layer] + """ super(H265Video, self).__init__(label=label, key_frame_interval=key_frame_interval, stretch_mode=stretch_mode, sync_mode=sync_mode, **kwargs) self.odata_type = '#Microsoft.Media.H265Video' # type: str self.scene_change_detection = scene_change_detection @@ -3830,10 +5086,10 @@ def __init__( class Hls(msrest.serialization.Model): """HTTP Live Streaming (HLS) packing setting for the live output. - :param fragments_per_ts_segment: The number of fragments in an HTTP Live Streaming (HLS) TS + :ivar fragments_per_ts_segment: The number of fragments in an HTTP Live Streaming (HLS) TS segment in the output of the live event. This value does not affect the packing ratio for HLS CMAF output. - :type fragments_per_ts_segment: int + :vartype fragments_per_ts_segment: int """ _attribute_map = { @@ -3846,10 +5102,55 @@ def __init__( fragments_per_ts_segment: Optional[int] = None, **kwargs ): + """ + :keyword fragments_per_ts_segment: The number of fragments in an HTTP Live Streaming (HLS) TS + segment in the output of the live event. This value does not affect the packing ratio for HLS + CMAF output. + :paramtype fragments_per_ts_segment: int + """ super(Hls, self).__init__(**kwargs) self.fragments_per_ts_segment = fragments_per_ts_segment +class HlsSettings(msrest.serialization.Model): + """The HLS setting for a text track. + + :ivar default: The default for the HLS setting. + :vartype default: bool + :ivar forced: The forced for the HLS setting. + :vartype forced: bool + :ivar characteristics: The characteristics for the HLS setting. + :vartype characteristics: str + """ + + _attribute_map = { + 'default': {'key': 'default', 'type': 'bool'}, + 'forced': {'key': 'forced', 'type': 'bool'}, + 'characteristics': {'key': 'characteristics', 'type': 'str'}, + } + + def __init__( + self, + *, + default: Optional[bool] = None, + forced: Optional[bool] = None, + characteristics: Optional[str] = None, + **kwargs + ): + """ + :keyword default: The default for the HLS setting. + :paramtype default: bool + :keyword forced: The forced for the HLS setting. + :paramtype forced: bool + :keyword characteristics: The characteristics for the HLS setting. + :paramtype characteristics: str + """ + super(HlsSettings, self).__init__(**kwargs) + self.default = default + self.forced = forced + self.characteristics = characteristics + + class Image(Video): """Describes the basic properties for generating thumbnails from the input video. @@ -3858,32 +5159,31 @@ class Image(Video): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param label: An optional label for the codec. The label can be used to control muxing - behavior. - :type label: str - :param key_frame_interval: The distance between two key frames. The value should be non-zero in + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar label: An optional label for the codec. The label can be used to control muxing behavior. + :vartype label: str + :ivar key_frame_interval: The distance between two key frames. The value should be non-zero in the range [0.5, 20] seconds, specified in ISO 8601 format. The default is 2 seconds(PT2S). Note that this setting is ignored if VideoSyncMode.Passthrough is set, where the KeyFrameInterval value will follow the input source setting. - :type key_frame_interval: ~datetime.timedelta - :param stretch_mode: The resizing mode - how the input video will be resized to fit the desired + :vartype key_frame_interval: ~datetime.timedelta + :ivar stretch_mode: The resizing mode - how the input video will be resized to fit the desired output resolution(s). Default is AutoSize. Possible values include: "None", "AutoSize", "AutoFit". - :type stretch_mode: str or ~azure.mgmt.media.models.StretchMode - :param sync_mode: The Video Sync Mode. Possible values include: "Auto", "Passthrough", "Cfr", + :vartype stretch_mode: str or ~azure.mgmt.media.models.StretchMode + :ivar sync_mode: The Video Sync Mode. Possible values include: "Auto", "Passthrough", "Cfr", "Vfr". - :type sync_mode: str or ~azure.mgmt.media.models.VideoSyncMode - :param start: Required. The position in the input video from where to start generating + :vartype sync_mode: str or ~azure.mgmt.media.models.VideoSyncMode + :ivar start: Required. The position in the input video from where to start generating thumbnails. The value can be in ISO 8601 format (For example, PT05S to start at 5 seconds), or a frame count (For example, 10 to start at the 10th frame), or a relative value to stream duration (For example, 10% to start at 10% of stream duration). Also supports a macro {Best}, which tells the encoder to select the best thumbnail from the first few seconds of the video and will only produce one thumbnail, no matter what other settings are for Step and Range. The default value is macro {Best}. - :type start: str - :param step: The intervals at which thumbnails are generated. The value can be in ISO 8601 + :vartype start: str + :ivar step: The intervals at which thumbnails are generated. The value can be in ISO 8601 format (For example, PT05S for one image every 5 seconds), or a frame count (For example, 30 for one image every 30 frames), or a relative value to stream duration (For example, 10% for one image every 10% of stream duration). Note: Step value will affect the first generated @@ -3893,15 +5193,15 @@ class Image(Video): has long duration, the first generated thumbnail might be far away from the one specified at start time. Try to select reasonable value for Step if the first thumbnail is expected close to start time, or set Range value at 1 if only one thumbnail is needed at start time. - :type step: str - :param range: The position relative to transform preset start time in the input video at which + :vartype step: str + :ivar range: The position relative to transform preset start time in the input video at which to stop generating thumbnails. The value can be in ISO 8601 format (For example, PT5M30S to stop at 5 minutes and 30 seconds from start time), or a frame count (For example, 300 to stop at the 300th frame from the frame at start time. If this value is 1, it means only producing one thumbnail at start time), or a relative value to the stream duration (For example, 50% to stop at half of stream duration from start time). The default value is 100%, which means to stop at the end of the stream. - :type range: str + :vartype range: str """ _validation = { @@ -3936,6 +5236,50 @@ def __init__( range: Optional[str] = None, **kwargs ): + """ + :keyword label: An optional label for the codec. The label can be used to control muxing + behavior. + :paramtype label: str + :keyword key_frame_interval: The distance between two key frames. The value should be non-zero + in the range [0.5, 20] seconds, specified in ISO 8601 format. The default is 2 seconds(PT2S). + Note that this setting is ignored if VideoSyncMode.Passthrough is set, where the + KeyFrameInterval value will follow the input source setting. + :paramtype key_frame_interval: ~datetime.timedelta + :keyword stretch_mode: The resizing mode - how the input video will be resized to fit the + desired output resolution(s). Default is AutoSize. Possible values include: "None", "AutoSize", + "AutoFit". + :paramtype stretch_mode: str or ~azure.mgmt.media.models.StretchMode + :keyword sync_mode: The Video Sync Mode. Possible values include: "Auto", "Passthrough", "Cfr", + "Vfr". + :paramtype sync_mode: str or ~azure.mgmt.media.models.VideoSyncMode + :keyword start: Required. The position in the input video from where to start generating + thumbnails. The value can be in ISO 8601 format (For example, PT05S to start at 5 seconds), or + a frame count (For example, 10 to start at the 10th frame), or a relative value to stream + duration (For example, 10% to start at 10% of stream duration). Also supports a macro {Best}, + which tells the encoder to select the best thumbnail from the first few seconds of the video + and will only produce one thumbnail, no matter what other settings are for Step and Range. The + default value is macro {Best}. + :paramtype start: str + :keyword step: The intervals at which thumbnails are generated. The value can be in ISO 8601 + format (For example, PT05S for one image every 5 seconds), or a frame count (For example, 30 + for one image every 30 frames), or a relative value to stream duration (For example, 10% for + one image every 10% of stream duration). Note: Step value will affect the first generated + thumbnail, which may not be exactly the one specified at transform preset start time. This is + due to the encoder, which tries to select the best thumbnail between start time and Step + position from start time as the first output. As the default value is 10%, it means if stream + has long duration, the first generated thumbnail might be far away from the one specified at + start time. Try to select reasonable value for Step if the first thumbnail is expected close to + start time, or set Range value at 1 if only one thumbnail is needed at start time. + :paramtype step: str + :keyword range: The position relative to transform preset start time in the input video at + which to stop generating thumbnails. The value can be in ISO 8601 format (For example, PT5M30S + to stop at 5 minutes and 30 seconds from start time), or a frame count (For example, 300 to + stop at the 300th frame from the frame at start time. If this value is 1, it means only + producing one thumbnail at start time), or a relative value to the stream duration (For + example, 50% to stop at half of stream duration from start time). The default value is 100%, + which means to stop at the end of the stream. + :paramtype range: str + """ super(Image, self).__init__(label=label, key_frame_interval=key_frame_interval, stretch_mode=stretch_mode, sync_mode=sync_mode, **kwargs) self.odata_type = '#Microsoft.Media.Image' # type: str self.start = start @@ -3951,20 +5295,19 @@ class ImageFormat(Format): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param filename_pattern: Required. The pattern of the file names for the generated output - files. The following macros are supported in the file name: {Basename} - An expansion macro - that will use the name of the input video file. If the base name(the file suffix is not - included) of the input video file is less than 32 characters long, the base name of input video - files will be used. If the length of base name of the input video file exceeds 32 characters, - the base name is truncated to the first 32 characters in total length. {Extension} - The - appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - - A unique index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video - bitrate. Not applicable to thumbnails. {Codec} - The type of the audio/video codec. - {Resolution} - The video resolution. Any unsubstituted macros will be collapsed and removed - from the filename. - :type filename_pattern: str + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar filename_pattern: Required. The pattern of the file names for the generated output files. + The following macros are supported in the file name: {Basename} - An expansion macro that will + use the name of the input video file. If the base name(the file suffix is not included) of the + input video file is less than 32 characters long, the base name of input video files will be + used. If the length of base name of the input video file exceeds 32 characters, the base name + is truncated to the first 32 characters in total length. {Extension} - The appropriate + extension for this format. {Label} - The label assigned to the codec/layer. {Index} - A unique + index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video bitrate. Not + applicable to thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video + resolution. Any unsubstituted macros will be collapsed and removed from the filename. + :vartype filename_pattern: str """ _validation = { @@ -3987,6 +5330,20 @@ def __init__( filename_pattern: str, **kwargs ): + """ + :keyword filename_pattern: Required. The pattern of the file names for the generated output + files. The following macros are supported in the file name: {Basename} - An expansion macro + that will use the name of the input video file. If the base name(the file suffix is not + included) of the input video file is less than 32 characters long, the base name of input video + files will be used. If the length of base name of the input video file exceeds 32 characters, + the base name is truncated to the first 32 characters in total length. {Extension} - The + appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} + - A unique index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video + bitrate. Not applicable to thumbnails. {Codec} - The type of the audio/video codec. + {Resolution} - The video resolution. Any unsubstituted macros will be collapsed and removed + from the filename. + :paramtype filename_pattern: str + """ super(ImageFormat, self).__init__(filename_pattern=filename_pattern, **kwargs) self.odata_type = '#Microsoft.Media.ImageFormat' # type: str @@ -3996,13 +5353,13 @@ class InputFile(InputDefinition): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param included_tracks: The list of TrackDescriptors which define the metadata and selection of + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar included_tracks: The list of TrackDescriptors which define the metadata and selection of tracks in the input. - :type included_tracks: list[~azure.mgmt.media.models.TrackDescriptor] - :param filename: Name of the file that this input definition applies to. - :type filename: str + :vartype included_tracks: list[~azure.mgmt.media.models.TrackDescriptor] + :ivar filename: Name of the file that this input definition applies to. + :vartype filename: str """ _validation = { @@ -4022,6 +5379,13 @@ def __init__( filename: Optional[str] = None, **kwargs ): + """ + :keyword included_tracks: The list of TrackDescriptors which define the metadata and selection + of tracks in the input. + :paramtype included_tracks: list[~azure.mgmt.media.models.TrackDescriptor] + :keyword filename: Name of the file that this input definition applies to. + :paramtype filename: str + """ super(InputFile, self).__init__(included_tracks=included_tracks, **kwargs) self.odata_type = '#Microsoft.Media.InputFile' # type: str self.filename = filename @@ -4030,8 +5394,8 @@ def __init__( class IPAccessControl(msrest.serialization.Model): """The IP access control. - :param allow: The IP allow list. - :type allow: list[~azure.mgmt.media.models.IPRange] + :ivar allow: The IP allow list. + :vartype allow: list[~azure.mgmt.media.models.IPRange] """ _attribute_map = { @@ -4044,6 +5408,10 @@ def __init__( allow: Optional[List["IPRange"]] = None, **kwargs ): + """ + :keyword allow: The IP allow list. + :paramtype allow: list[~azure.mgmt.media.models.IPRange] + """ super(IPAccessControl, self).__init__(**kwargs) self.allow = allow @@ -4051,12 +5419,12 @@ def __init__( class IPRange(msrest.serialization.Model): """The IP address range in the CIDR scheme. - :param name: The friendly name for the IP address range. - :type name: str - :param address: The IP address. - :type address: str - :param subnet_prefix_length: The subnet mask prefix length (see CIDR notation). - :type subnet_prefix_length: int + :ivar name: The friendly name for the IP address range. + :vartype name: str + :ivar address: The IP address. + :vartype address: str + :ivar subnet_prefix_length: The subnet mask prefix length (see CIDR notation). + :vartype subnet_prefix_length: int """ _attribute_map = { @@ -4073,6 +5441,14 @@ def __init__( subnet_prefix_length: Optional[int] = None, **kwargs ): + """ + :keyword name: The friendly name for the IP address range. + :paramtype name: str + :keyword address: The IP address. + :paramtype address: str + :keyword subnet_prefix_length: The subnet mask prefix length (see CIDR notation). + :paramtype subnet_prefix_length: int + """ super(IPRange, self).__init__(**kwargs) self.name = name self.address = address @@ -4100,22 +5476,22 @@ class Job(ProxyResource): :ivar state: The current state of the job. Possible values include: "Canceled", "Canceling", "Error", "Finished", "Processing", "Queued", "Scheduled". :vartype state: str or ~azure.mgmt.media.models.JobState - :param description: Optional customer supplied description of the Job. - :type description: str - :param input: The inputs for the Job. - :type input: ~azure.mgmt.media.models.JobInput + :ivar description: Optional customer supplied description of the Job. + :vartype description: str + :ivar input: The inputs for the Job. + :vartype input: ~azure.mgmt.media.models.JobInput :ivar last_modified: The UTC date and time when the customer has last updated the Job, in 'YYYY-MM-DDThh:mm:ssZ' format. :vartype last_modified: ~datetime.datetime - :param outputs: The outputs for the Job. - :type outputs: list[~azure.mgmt.media.models.JobOutput] - :param priority: Priority with which the job should be processed. Higher priority jobs are + :ivar outputs: The outputs for the Job. + :vartype outputs: list[~azure.mgmt.media.models.JobOutput] + :ivar priority: Priority with which the job should be processed. Higher priority jobs are processed before lower priority jobs. If not set, the default is normal. Possible values include: "Low", "Normal", "High". - :type priority: str or ~azure.mgmt.media.models.Priority - :param correlation_data: Customer provided key, value pairs that will be returned in Job and + :vartype priority: str or ~azure.mgmt.media.models.Priority + :ivar correlation_data: Customer provided key, value pairs that will be returned in Job and JobOutput state events. - :type correlation_data: dict[str, str] + :vartype correlation_data: dict[str, str] :ivar start_time: The UTC date and time at which this Job began processing. :vartype start_time: ~datetime.datetime :ivar end_time: The UTC date and time at which this Job finished processing. @@ -4161,6 +5537,21 @@ def __init__( correlation_data: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword description: Optional customer supplied description of the Job. + :paramtype description: str + :keyword input: The inputs for the Job. + :paramtype input: ~azure.mgmt.media.models.JobInput + :keyword outputs: The outputs for the Job. + :paramtype outputs: list[~azure.mgmt.media.models.JobOutput] + :keyword priority: Priority with which the job should be processed. Higher priority jobs are + processed before lower priority jobs. If not set, the default is normal. Possible values + include: "Low", "Normal", "High". + :paramtype priority: str or ~azure.mgmt.media.models.Priority + :keyword correlation_data: Customer provided key, value pairs that will be returned in Job and + JobOutput state events. + :paramtype correlation_data: dict[str, str] + """ super(Job, self).__init__(**kwargs) self.system_data = None self.created = None @@ -4178,11 +5569,11 @@ def __init__( class JobCollection(msrest.serialization.Model): """A collection of Job items. - :param value: A collection of Job items. - :type value: list[~azure.mgmt.media.models.Job] - :param odata_next_link: A link to the next page of the collection (when the collection contains + :ivar value: A collection of Job items. + :vartype value: list[~azure.mgmt.media.models.Job] + :ivar odata_next_link: A link to the next page of the collection (when the collection contains too many results to return in one response). - :type odata_next_link: str + :vartype odata_next_link: str """ _attribute_map = { @@ -4197,6 +5588,13 @@ def __init__( odata_next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: A collection of Job items. + :paramtype value: list[~azure.mgmt.media.models.Job] + :keyword odata_next_link: A link to the next page of the collection (when the collection + contains too many results to return in one response). + :paramtype odata_next_link: str + """ super(JobCollection, self).__init__(**kwargs) self.value = value self.odata_next_link = odata_next_link @@ -4245,6 +5643,8 @@ def __init__( self, **kwargs ): + """ + """ super(JobError, self).__init__(**kwargs) self.code = None self.message = None @@ -4278,6 +5678,8 @@ def __init__( self, **kwargs ): + """ + """ super(JobErrorDetail, self).__init__(**kwargs) self.code = None self.message = None @@ -4291,8 +5693,8 @@ class JobInput(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str """ _validation = { @@ -4311,6 +5713,8 @@ def __init__( self, **kwargs ): + """ + """ super(JobInput, self).__init__(**kwargs) self.odata_type = None # type: Optional[str] @@ -4323,26 +5727,26 @@ class JobInputClip(JobInput): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param files: List of files. Required for JobInputHttp. Maximum of 4000 characters each. Query + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar files: List of files. Required for JobInputHttp. Maximum of 4000 characters each. Query strings will not be returned in service responses to prevent sensitive data exposure. - :type files: list[str] - :param start: Defines a point on the timeline of the input media at which processing will - start. Defaults to the beginning of the input media. - :type start: ~azure.mgmt.media.models.ClipTime - :param end: Defines a point on the timeline of the input media at which processing will end. + :vartype files: list[str] + :ivar start: Defines a point on the timeline of the input media at which processing will start. + Defaults to the beginning of the input media. + :vartype start: ~azure.mgmt.media.models.ClipTime + :ivar end: Defines a point on the timeline of the input media at which processing will end. Defaults to the end of the input media. - :type end: ~azure.mgmt.media.models.ClipTime - :param label: A label that is assigned to a JobInputClip, that is used to satisfy a reference + :vartype end: ~azure.mgmt.media.models.ClipTime + :ivar label: A label that is assigned to a JobInputClip, that is used to satisfy a reference used in the Transform. For example, a Transform can be authored so as to take an image file with the label 'xyz' and apply it as an overlay onto the input video before it is encoded. When submitting a Job, exactly one of the JobInputs should be the image file, and it should have the label 'xyz'. - :type label: str - :param input_definitions: Defines a list of InputDefinitions. For each InputDefinition, it + :vartype label: str + :ivar input_definitions: Defines a list of InputDefinitions. For each InputDefinition, it defines a list of track selections and related metadata. - :type input_definitions: list[~azure.mgmt.media.models.InputDefinition] + :vartype input_definitions: list[~azure.mgmt.media.models.InputDefinition] """ _validation = { @@ -4372,6 +5776,26 @@ def __init__( input_definitions: Optional[List["InputDefinition"]] = None, **kwargs ): + """ + :keyword files: List of files. Required for JobInputHttp. Maximum of 4000 characters each. + Query strings will not be returned in service responses to prevent sensitive data exposure. + :paramtype files: list[str] + :keyword start: Defines a point on the timeline of the input media at which processing will + start. Defaults to the beginning of the input media. + :paramtype start: ~azure.mgmt.media.models.ClipTime + :keyword end: Defines a point on the timeline of the input media at which processing will end. + Defaults to the end of the input media. + :paramtype end: ~azure.mgmt.media.models.ClipTime + :keyword label: A label that is assigned to a JobInputClip, that is used to satisfy a reference + used in the Transform. For example, a Transform can be authored so as to take an image file + with the label 'xyz' and apply it as an overlay onto the input video before it is encoded. When + submitting a Job, exactly one of the JobInputs should be the image file, and it should have the + label 'xyz'. + :paramtype label: str + :keyword input_definitions: Defines a list of InputDefinitions. For each InputDefinition, it + defines a list of track selections and related metadata. + :paramtype input_definitions: list[~azure.mgmt.media.models.InputDefinition] + """ super(JobInputClip, self).__init__(**kwargs) self.odata_type = '#Microsoft.Media.JobInputClip' # type: str self.files = files @@ -4386,28 +5810,28 @@ class JobInputAsset(JobInputClip): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param files: List of files. Required for JobInputHttp. Maximum of 4000 characters each. Query + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar files: List of files. Required for JobInputHttp. Maximum of 4000 characters each. Query strings will not be returned in service responses to prevent sensitive data exposure. - :type files: list[str] - :param start: Defines a point on the timeline of the input media at which processing will - start. Defaults to the beginning of the input media. - :type start: ~azure.mgmt.media.models.ClipTime - :param end: Defines a point on the timeline of the input media at which processing will end. + :vartype files: list[str] + :ivar start: Defines a point on the timeline of the input media at which processing will start. + Defaults to the beginning of the input media. + :vartype start: ~azure.mgmt.media.models.ClipTime + :ivar end: Defines a point on the timeline of the input media at which processing will end. Defaults to the end of the input media. - :type end: ~azure.mgmt.media.models.ClipTime - :param label: A label that is assigned to a JobInputClip, that is used to satisfy a reference + :vartype end: ~azure.mgmt.media.models.ClipTime + :ivar label: A label that is assigned to a JobInputClip, that is used to satisfy a reference used in the Transform. For example, a Transform can be authored so as to take an image file with the label 'xyz' and apply it as an overlay onto the input video before it is encoded. When submitting a Job, exactly one of the JobInputs should be the image file, and it should have the label 'xyz'. - :type label: str - :param input_definitions: Defines a list of InputDefinitions. For each InputDefinition, it + :vartype label: str + :ivar input_definitions: Defines a list of InputDefinitions. For each InputDefinition, it defines a list of track selections and related metadata. - :type input_definitions: list[~azure.mgmt.media.models.InputDefinition] - :param asset_name: Required. The name of the input Asset. - :type asset_name: str + :vartype input_definitions: list[~azure.mgmt.media.models.InputDefinition] + :ivar asset_name: Required. The name of the input Asset. + :vartype asset_name: str """ _validation = { @@ -4436,6 +5860,28 @@ def __init__( input_definitions: Optional[List["InputDefinition"]] = None, **kwargs ): + """ + :keyword files: List of files. Required for JobInputHttp. Maximum of 4000 characters each. + Query strings will not be returned in service responses to prevent sensitive data exposure. + :paramtype files: list[str] + :keyword start: Defines a point on the timeline of the input media at which processing will + start. Defaults to the beginning of the input media. + :paramtype start: ~azure.mgmt.media.models.ClipTime + :keyword end: Defines a point on the timeline of the input media at which processing will end. + Defaults to the end of the input media. + :paramtype end: ~azure.mgmt.media.models.ClipTime + :keyword label: A label that is assigned to a JobInputClip, that is used to satisfy a reference + used in the Transform. For example, a Transform can be authored so as to take an image file + with the label 'xyz' and apply it as an overlay onto the input video before it is encoded. When + submitting a Job, exactly one of the JobInputs should be the image file, and it should have the + label 'xyz'. + :paramtype label: str + :keyword input_definitions: Defines a list of InputDefinitions. For each InputDefinition, it + defines a list of track selections and related metadata. + :paramtype input_definitions: list[~azure.mgmt.media.models.InputDefinition] + :keyword asset_name: Required. The name of the input Asset. + :paramtype asset_name: str + """ super(JobInputAsset, self).__init__(files=files, start=start, end=end, label=label, input_definitions=input_definitions, **kwargs) self.odata_type = '#Microsoft.Media.JobInputAsset' # type: str self.asset_name = asset_name @@ -4446,31 +5892,31 @@ class JobInputHttp(JobInputClip): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param files: List of files. Required for JobInputHttp. Maximum of 4000 characters each. Query + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar files: List of files. Required for JobInputHttp. Maximum of 4000 characters each. Query strings will not be returned in service responses to prevent sensitive data exposure. - :type files: list[str] - :param start: Defines a point on the timeline of the input media at which processing will - start. Defaults to the beginning of the input media. - :type start: ~azure.mgmt.media.models.ClipTime - :param end: Defines a point on the timeline of the input media at which processing will end. + :vartype files: list[str] + :ivar start: Defines a point on the timeline of the input media at which processing will start. + Defaults to the beginning of the input media. + :vartype start: ~azure.mgmt.media.models.ClipTime + :ivar end: Defines a point on the timeline of the input media at which processing will end. Defaults to the end of the input media. - :type end: ~azure.mgmt.media.models.ClipTime - :param label: A label that is assigned to a JobInputClip, that is used to satisfy a reference + :vartype end: ~azure.mgmt.media.models.ClipTime + :ivar label: A label that is assigned to a JobInputClip, that is used to satisfy a reference used in the Transform. For example, a Transform can be authored so as to take an image file with the label 'xyz' and apply it as an overlay onto the input video before it is encoded. When submitting a Job, exactly one of the JobInputs should be the image file, and it should have the label 'xyz'. - :type label: str - :param input_definitions: Defines a list of InputDefinitions. For each InputDefinition, it + :vartype label: str + :ivar input_definitions: Defines a list of InputDefinitions. For each InputDefinition, it defines a list of track selections and related metadata. - :type input_definitions: list[~azure.mgmt.media.models.InputDefinition] - :param base_uri: Base URI for HTTPS job input. It will be concatenated with provided file - names. If no base uri is given, then the provided file list is assumed to be fully qualified - uris. Maximum length of 4000 characters. The query strings will not be returned in service - responses to prevent sensitive data exposure. - :type base_uri: str + :vartype input_definitions: list[~azure.mgmt.media.models.InputDefinition] + :ivar base_uri: Base URI for HTTPS job input. It will be concatenated with provided file names. + If no base uri is given, then the provided file list is assumed to be fully qualified uris. + Maximum length of 4000 characters. The query strings will not be returned in service responses + to prevent sensitive data exposure. + :vartype base_uri: str """ _validation = { @@ -4498,6 +5944,31 @@ def __init__( base_uri: Optional[str] = None, **kwargs ): + """ + :keyword files: List of files. Required for JobInputHttp. Maximum of 4000 characters each. + Query strings will not be returned in service responses to prevent sensitive data exposure. + :paramtype files: list[str] + :keyword start: Defines a point on the timeline of the input media at which processing will + start. Defaults to the beginning of the input media. + :paramtype start: ~azure.mgmt.media.models.ClipTime + :keyword end: Defines a point on the timeline of the input media at which processing will end. + Defaults to the end of the input media. + :paramtype end: ~azure.mgmt.media.models.ClipTime + :keyword label: A label that is assigned to a JobInputClip, that is used to satisfy a reference + used in the Transform. For example, a Transform can be authored so as to take an image file + with the label 'xyz' and apply it as an overlay onto the input video before it is encoded. When + submitting a Job, exactly one of the JobInputs should be the image file, and it should have the + label 'xyz'. + :paramtype label: str + :keyword input_definitions: Defines a list of InputDefinitions. For each InputDefinition, it + defines a list of track selections and related metadata. + :paramtype input_definitions: list[~azure.mgmt.media.models.InputDefinition] + :keyword base_uri: Base URI for HTTPS job input. It will be concatenated with provided file + names. If no base uri is given, then the provided file list is assumed to be fully qualified + uris. Maximum length of 4000 characters. The query strings will not be returned in service + responses to prevent sensitive data exposure. + :paramtype base_uri: str + """ super(JobInputHttp, self).__init__(files=files, start=start, end=end, label=label, input_definitions=input_definitions, **kwargs) self.odata_type = '#Microsoft.Media.JobInputHttp' # type: str self.base_uri = base_uri @@ -4508,10 +5979,10 @@ class JobInputs(JobInput): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param inputs: List of inputs to a Job. - :type inputs: list[~azure.mgmt.media.models.JobInput] + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar inputs: List of inputs to a Job. + :vartype inputs: list[~azure.mgmt.media.models.JobInput] """ _validation = { @@ -4529,6 +6000,10 @@ def __init__( inputs: Optional[List["JobInput"]] = None, **kwargs ): + """ + :keyword inputs: List of inputs to a Job. + :paramtype inputs: list[~azure.mgmt.media.models.JobInput] + """ super(JobInputs, self).__init__(**kwargs) self.odata_type = '#Microsoft.Media.JobInputs' # type: str self.inputs = inputs @@ -4539,10 +6014,10 @@ class JobInputSequence(JobInput): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param inputs: JobInputs that make up the timeline. - :type inputs: list[~azure.mgmt.media.models.JobInputClip] + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar inputs: JobInputs that make up the timeline. + :vartype inputs: list[~azure.mgmt.media.models.JobInputClip] """ _validation = { @@ -4560,6 +6035,10 @@ def __init__( inputs: Optional[List["JobInputClip"]] = None, **kwargs ): + """ + :keyword inputs: JobInputs that make up the timeline. + :paramtype inputs: list[~azure.mgmt.media.models.JobInputClip] + """ super(JobInputSequence, self).__init__(**kwargs) self.odata_type = '#Microsoft.Media.JobInputSequence' # type: str self.inputs = inputs @@ -4575,13 +6054,13 @@ class JobOutput(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str :ivar error: If the JobOutput is in the Error state, it contains the details of the error. :vartype error: ~azure.mgmt.media.models.JobError - :param preset_override: A preset used to override the preset in the corresponding transform + :ivar preset_override: A preset used to override the preset in the corresponding transform output. - :type preset_override: ~azure.mgmt.media.models.Preset + :vartype preset_override: ~azure.mgmt.media.models.Preset :ivar state: Describes the state of the JobOutput. Possible values include: "Canceled", "Canceling", "Error", "Finished", "Processing", "Queued", "Scheduled". :vartype state: str or ~azure.mgmt.media.models.JobState @@ -4589,7 +6068,7 @@ class JobOutput(msrest.serialization.Model): percentage. The value is an estimate and not intended to be used to predict Job completion times. To determine if the JobOutput is complete, use the State property. :vartype progress: int - :param label: A label that is assigned to a JobOutput in order to help uniquely identify it. + :ivar label: A label that is assigned to a JobOutput in order to help uniquely identify it. This is useful when your Transform has more than one TransformOutput, whereby your Job has more than one JobOutput. In such cases, when you submit the Job, you will add two or more JobOutputs, in the same order as TransformOutputs in the Transform. Subsequently, when you @@ -4599,7 +6078,7 @@ class JobOutput(msrest.serialization.Model): the corresponding TransformOutput and the output index is the relative index of the this JobOutput within the Job. Note that this index is the same as the relative index of the corresponding TransformOutput within its Transform. - :type label: str + :vartype label: str :ivar start_time: The UTC date and time at which this Job Output began processing. :vartype start_time: ~datetime.datetime :ivar end_time: The UTC date and time at which this Job Output finished processing. @@ -4637,6 +6116,22 @@ def __init__( label: Optional[str] = None, **kwargs ): + """ + :keyword preset_override: A preset used to override the preset in the corresponding transform + output. + :paramtype preset_override: ~azure.mgmt.media.models.Preset + :keyword label: A label that is assigned to a JobOutput in order to help uniquely identify it. + This is useful when your Transform has more than one TransformOutput, whereby your Job has more + than one JobOutput. In such cases, when you submit the Job, you will add two or more + JobOutputs, in the same order as TransformOutputs in the Transform. Subsequently, when you + retrieve the Job, either through events or on a GET request, you can use the label to easily + identify the JobOutput. If a label is not provided, a default value of + '{presetName}_{outputIndex}' will be used, where the preset name is the name of the preset in + the corresponding TransformOutput and the output index is the relative index of the this + JobOutput within the Job. Note that this index is the same as the relative index of the + corresponding TransformOutput within its Transform. + :paramtype label: str + """ super(JobOutput, self).__init__(**kwargs) self.odata_type = None # type: Optional[str] self.error = None @@ -4655,13 +6150,13 @@ class JobOutputAsset(JobOutput): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str :ivar error: If the JobOutput is in the Error state, it contains the details of the error. :vartype error: ~azure.mgmt.media.models.JobError - :param preset_override: A preset used to override the preset in the corresponding transform + :ivar preset_override: A preset used to override the preset in the corresponding transform output. - :type preset_override: ~azure.mgmt.media.models.Preset + :vartype preset_override: ~azure.mgmt.media.models.Preset :ivar state: Describes the state of the JobOutput. Possible values include: "Canceled", "Canceling", "Error", "Finished", "Processing", "Queued", "Scheduled". :vartype state: str or ~azure.mgmt.media.models.JobState @@ -4669,7 +6164,7 @@ class JobOutputAsset(JobOutput): percentage. The value is an estimate and not intended to be used to predict Job completion times. To determine if the JobOutput is complete, use the State property. :vartype progress: int - :param label: A label that is assigned to a JobOutput in order to help uniquely identify it. + :ivar label: A label that is assigned to a JobOutput in order to help uniquely identify it. This is useful when your Transform has more than one TransformOutput, whereby your Job has more than one JobOutput. In such cases, when you submit the Job, you will add two or more JobOutputs, in the same order as TransformOutputs in the Transform. Subsequently, when you @@ -4679,13 +6174,13 @@ class JobOutputAsset(JobOutput): the corresponding TransformOutput and the output index is the relative index of the this JobOutput within the Job. Note that this index is the same as the relative index of the corresponding TransformOutput within its Transform. - :type label: str + :vartype label: str :ivar start_time: The UTC date and time at which this Job Output began processing. :vartype start_time: ~datetime.datetime :ivar end_time: The UTC date and time at which this Job Output finished processing. :vartype end_time: ~datetime.datetime - :param asset_name: Required. The name of the output Asset. - :type asset_name: str + :ivar asset_name: Required. The name of the output Asset. + :vartype asset_name: str """ _validation = { @@ -4718,6 +6213,24 @@ def __init__( label: Optional[str] = None, **kwargs ): + """ + :keyword preset_override: A preset used to override the preset in the corresponding transform + output. + :paramtype preset_override: ~azure.mgmt.media.models.Preset + :keyword label: A label that is assigned to a JobOutput in order to help uniquely identify it. + This is useful when your Transform has more than one TransformOutput, whereby your Job has more + than one JobOutput. In such cases, when you submit the Job, you will add two or more + JobOutputs, in the same order as TransformOutputs in the Transform. Subsequently, when you + retrieve the Job, either through events or on a GET request, you can use the label to easily + identify the JobOutput. If a label is not provided, a default value of + '{presetName}_{outputIndex}' will be used, where the preset name is the name of the preset in + the corresponding TransformOutput and the output index is the relative index of the this + JobOutput within the Job. Note that this index is the same as the relative index of the + corresponding TransformOutput within its Transform. + :paramtype label: str + :keyword asset_name: Required. The name of the output Asset. + :paramtype asset_name: str + """ super(JobOutputAsset, self).__init__(preset_override=preset_override, label=label, **kwargs) self.odata_type = '#Microsoft.Media.JobOutputAsset' # type: str self.asset_name = asset_name @@ -4728,20 +6241,19 @@ class JpgFormat(ImageFormat): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param filename_pattern: Required. The pattern of the file names for the generated output - files. The following macros are supported in the file name: {Basename} - An expansion macro - that will use the name of the input video file. If the base name(the file suffix is not - included) of the input video file is less than 32 characters long, the base name of input video - files will be used. If the length of base name of the input video file exceeds 32 characters, - the base name is truncated to the first 32 characters in total length. {Extension} - The - appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - - A unique index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video - bitrate. Not applicable to thumbnails. {Codec} - The type of the audio/video codec. - {Resolution} - The video resolution. Any unsubstituted macros will be collapsed and removed - from the filename. - :type filename_pattern: str + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar filename_pattern: Required. The pattern of the file names for the generated output files. + The following macros are supported in the file name: {Basename} - An expansion macro that will + use the name of the input video file. If the base name(the file suffix is not included) of the + input video file is less than 32 characters long, the base name of input video files will be + used. If the length of base name of the input video file exceeds 32 characters, the base name + is truncated to the first 32 characters in total length. {Extension} - The appropriate + extension for this format. {Label} - The label assigned to the codec/layer. {Index} - A unique + index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video bitrate. Not + applicable to thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video + resolution. Any unsubstituted macros will be collapsed and removed from the filename. + :vartype filename_pattern: str """ _validation = { @@ -4760,6 +6272,20 @@ def __init__( filename_pattern: str, **kwargs ): + """ + :keyword filename_pattern: Required. The pattern of the file names for the generated output + files. The following macros are supported in the file name: {Basename} - An expansion macro + that will use the name of the input video file. If the base name(the file suffix is not + included) of the input video file is less than 32 characters long, the base name of input video + files will be used. If the length of base name of the input video file exceeds 32 characters, + the base name is truncated to the first 32 characters in total length. {Extension} - The + appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} + - A unique index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video + bitrate. Not applicable to thumbnails. {Codec} - The type of the audio/video codec. + {Resolution} - The video resolution. Any unsubstituted macros will be collapsed and removed + from the filename. + :paramtype filename_pattern: str + """ super(JpgFormat, self).__init__(filename_pattern=filename_pattern, **kwargs) self.odata_type = '#Microsoft.Media.JpgFormat' # type: str @@ -4769,32 +6295,31 @@ class JpgImage(Image): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param label: An optional label for the codec. The label can be used to control muxing - behavior. - :type label: str - :param key_frame_interval: The distance between two key frames. The value should be non-zero in + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar label: An optional label for the codec. The label can be used to control muxing behavior. + :vartype label: str + :ivar key_frame_interval: The distance between two key frames. The value should be non-zero in the range [0.5, 20] seconds, specified in ISO 8601 format. The default is 2 seconds(PT2S). Note that this setting is ignored if VideoSyncMode.Passthrough is set, where the KeyFrameInterval value will follow the input source setting. - :type key_frame_interval: ~datetime.timedelta - :param stretch_mode: The resizing mode - how the input video will be resized to fit the desired + :vartype key_frame_interval: ~datetime.timedelta + :ivar stretch_mode: The resizing mode - how the input video will be resized to fit the desired output resolution(s). Default is AutoSize. Possible values include: "None", "AutoSize", "AutoFit". - :type stretch_mode: str or ~azure.mgmt.media.models.StretchMode - :param sync_mode: The Video Sync Mode. Possible values include: "Auto", "Passthrough", "Cfr", + :vartype stretch_mode: str or ~azure.mgmt.media.models.StretchMode + :ivar sync_mode: The Video Sync Mode. Possible values include: "Auto", "Passthrough", "Cfr", "Vfr". - :type sync_mode: str or ~azure.mgmt.media.models.VideoSyncMode - :param start: Required. The position in the input video from where to start generating + :vartype sync_mode: str or ~azure.mgmt.media.models.VideoSyncMode + :ivar start: Required. The position in the input video from where to start generating thumbnails. The value can be in ISO 8601 format (For example, PT05S to start at 5 seconds), or a frame count (For example, 10 to start at the 10th frame), or a relative value to stream duration (For example, 10% to start at 10% of stream duration). Also supports a macro {Best}, which tells the encoder to select the best thumbnail from the first few seconds of the video and will only produce one thumbnail, no matter what other settings are for Step and Range. The default value is macro {Best}. - :type start: str - :param step: The intervals at which thumbnails are generated. The value can be in ISO 8601 + :vartype start: str + :ivar step: The intervals at which thumbnails are generated. The value can be in ISO 8601 format (For example, PT05S for one image every 5 seconds), or a frame count (For example, 30 for one image every 30 frames), or a relative value to stream duration (For example, 10% for one image every 10% of stream duration). Note: Step value will affect the first generated @@ -4804,23 +6329,23 @@ class JpgImage(Image): has long duration, the first generated thumbnail might be far away from the one specified at start time. Try to select reasonable value for Step if the first thumbnail is expected close to start time, or set Range value at 1 if only one thumbnail is needed at start time. - :type step: str - :param range: The position relative to transform preset start time in the input video at which + :vartype step: str + :ivar range: The position relative to transform preset start time in the input video at which to stop generating thumbnails. The value can be in ISO 8601 format (For example, PT5M30S to stop at 5 minutes and 30 seconds from start time), or a frame count (For example, 300 to stop at the 300th frame from the frame at start time. If this value is 1, it means only producing one thumbnail at start time), or a relative value to the stream duration (For example, 50% to stop at half of stream duration from start time). The default value is 100%, which means to stop at the end of the stream. - :type range: str - :param layers: A collection of output JPEG image layers to be produced by the encoder. - :type layers: list[~azure.mgmt.media.models.JpgLayer] - :param sprite_column: Sets the number of columns used in thumbnail sprite image. The number of + :vartype range: str + :ivar layers: A collection of output JPEG image layers to be produced by the encoder. + :vartype layers: list[~azure.mgmt.media.models.JpgLayer] + :ivar sprite_column: Sets the number of columns used in thumbnail sprite image. The number of rows are automatically calculated and a VTT file is generated with the coordinate mappings for each thumbnail in the sprite. Note: this value should be a positive integer and a proper value is recommended so that the output image resolution will not go beyond JPEG maximum pixel resolution limit 65535x65535. - :type sprite_column: int + :vartype sprite_column: int """ _validation = { @@ -4855,6 +6380,58 @@ def __init__( sprite_column: Optional[int] = None, **kwargs ): + """ + :keyword label: An optional label for the codec. The label can be used to control muxing + behavior. + :paramtype label: str + :keyword key_frame_interval: The distance between two key frames. The value should be non-zero + in the range [0.5, 20] seconds, specified in ISO 8601 format. The default is 2 seconds(PT2S). + Note that this setting is ignored if VideoSyncMode.Passthrough is set, where the + KeyFrameInterval value will follow the input source setting. + :paramtype key_frame_interval: ~datetime.timedelta + :keyword stretch_mode: The resizing mode - how the input video will be resized to fit the + desired output resolution(s). Default is AutoSize. Possible values include: "None", "AutoSize", + "AutoFit". + :paramtype stretch_mode: str or ~azure.mgmt.media.models.StretchMode + :keyword sync_mode: The Video Sync Mode. Possible values include: "Auto", "Passthrough", "Cfr", + "Vfr". + :paramtype sync_mode: str or ~azure.mgmt.media.models.VideoSyncMode + :keyword start: Required. The position in the input video from where to start generating + thumbnails. The value can be in ISO 8601 format (For example, PT05S to start at 5 seconds), or + a frame count (For example, 10 to start at the 10th frame), or a relative value to stream + duration (For example, 10% to start at 10% of stream duration). Also supports a macro {Best}, + which tells the encoder to select the best thumbnail from the first few seconds of the video + and will only produce one thumbnail, no matter what other settings are for Step and Range. The + default value is macro {Best}. + :paramtype start: str + :keyword step: The intervals at which thumbnails are generated. The value can be in ISO 8601 + format (For example, PT05S for one image every 5 seconds), or a frame count (For example, 30 + for one image every 30 frames), or a relative value to stream duration (For example, 10% for + one image every 10% of stream duration). Note: Step value will affect the first generated + thumbnail, which may not be exactly the one specified at transform preset start time. This is + due to the encoder, which tries to select the best thumbnail between start time and Step + position from start time as the first output. As the default value is 10%, it means if stream + has long duration, the first generated thumbnail might be far away from the one specified at + start time. Try to select reasonable value for Step if the first thumbnail is expected close to + start time, or set Range value at 1 if only one thumbnail is needed at start time. + :paramtype step: str + :keyword range: The position relative to transform preset start time in the input video at + which to stop generating thumbnails. The value can be in ISO 8601 format (For example, PT5M30S + to stop at 5 minutes and 30 seconds from start time), or a frame count (For example, 300 to + stop at the 300th frame from the frame at start time. If this value is 1, it means only + producing one thumbnail at start time), or a relative value to the stream duration (For + example, 50% to stop at half of stream duration from start time). The default value is 100%, + which means to stop at the end of the stream. + :paramtype range: str + :keyword layers: A collection of output JPEG image layers to be produced by the encoder. + :paramtype layers: list[~azure.mgmt.media.models.JpgLayer] + :keyword sprite_column: Sets the number of columns used in thumbnail sprite image. The number + of rows are automatically calculated and a VTT file is generated with the coordinate mappings + for each thumbnail in the sprite. Note: this value should be a positive integer and a proper + value is recommended so that the output image resolution will not go beyond JPEG maximum pixel + resolution limit 65535x65535. + :paramtype sprite_column: int + """ super(JpgImage, self).__init__(label=label, key_frame_interval=key_frame_interval, stretch_mode=stretch_mode, sync_mode=sync_mode, start=start, step=step, range=range, **kwargs) self.odata_type = '#Microsoft.Media.JpgImage' # type: str self.layers = layers @@ -4864,32 +6441,23 @@ def __init__( class JpgLayer(Layer): """Describes the settings to produce a JPEG image from the input video. - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param width: The width of the output video for this layer. The value can be absolute (in + :ivar width: The width of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example 50% means the output video has half as many pixels in width as the input. - :type width: str - :param height: The height of the output video for this layer. The value can be absolute (in + :vartype width: str + :ivar height: The height of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example 50% means the output video has half as many pixels in height as the input. - :type height: str - :param label: The alphanumeric label for this layer, which can be used in multiplexing - different video and audio layers, or in naming the output file. - :type label: str - :param quality: The compression quality of the JPEG output. Range is from 0-100 and the default + :vartype height: str + :ivar label: The alphanumeric label for this layer, which can be used in multiplexing different + video and audio layers, or in naming the output file. + :vartype label: str + :ivar quality: The compression quality of the JPEG output. Range is from 0-100 and the default is 70. - :type quality: int + :vartype quality: int """ - _validation = { - 'odata_type': {'required': True}, - } - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'width': {'key': 'width', 'type': 'str'}, 'height': {'key': 'height', 'type': 'str'}, 'label': {'key': 'label', 'type': 'str'}, @@ -4905,16 +6473,31 @@ def __init__( quality: Optional[int] = None, **kwargs ): + """ + :keyword width: The width of the output video for this layer. The value can be absolute (in + pixels) or relative (in percentage). For example 50% means the output video has half as many + pixels in width as the input. + :paramtype width: str + :keyword height: The height of the output video for this layer. The value can be absolute (in + pixels) or relative (in percentage). For example 50% means the output video has half as many + pixels in height as the input. + :paramtype height: str + :keyword label: The alphanumeric label for this layer, which can be used in multiplexing + different video and audio layers, or in naming the output file. + :paramtype label: str + :keyword quality: The compression quality of the JPEG output. Range is from 0-100 and the + default is 70. + :paramtype quality: int + """ super(JpgLayer, self).__init__(width=width, height=height, label=label, **kwargs) - self.odata_type = '#Microsoft.Media.JpgLayer' # type: str self.quality = quality class KeyDelivery(msrest.serialization.Model): """KeyDelivery. - :param access_control: The access control properties for Key Delivery. - :type access_control: ~azure.mgmt.media.models.AccessControl + :ivar access_control: The access control properties for Key Delivery. + :vartype access_control: ~azure.mgmt.media.models.AccessControl """ _attribute_map = { @@ -4927,6 +6510,10 @@ def __init__( access_control: Optional["AccessControl"] = None, **kwargs ): + """ + :keyword access_control: The access control properties for Key Delivery. + :paramtype access_control: ~azure.mgmt.media.models.AccessControl + """ super(KeyDelivery, self).__init__(**kwargs) self.access_control = access_control @@ -4936,10 +6523,10 @@ class KeyVaultProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param key_identifier: The URL of the Key Vault key used to encrypt the account. The key may + :ivar key_identifier: 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 the Media Services account, including the key version. :vartype current_key_identifier: str @@ -4960,6 +6547,12 @@ def __init__( key_identifier: Optional[str] = None, **kwargs ): + """ + :keyword key_identifier: 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 @@ -4968,12 +6561,12 @@ def __init__( class ListContainerSasInput(msrest.serialization.Model): """The parameters to the list SAS request. - :param permissions: The permissions to set on the SAS URL. Possible values include: "Read", + :ivar permissions: The permissions to set on the SAS URL. Possible values include: "Read", "ReadWrite", "ReadWriteDelete". - :type permissions: str or ~azure.mgmt.media.models.AssetContainerPermission - :param expiry_time: The SAS URL expiration time. This must be less than 24 hours from the + :vartype permissions: str or ~azure.mgmt.media.models.AssetContainerPermission + :ivar expiry_time: The SAS URL expiration time. This must be less than 24 hours from the current time. - :type expiry_time: ~datetime.datetime + :vartype expiry_time: ~datetime.datetime """ _attribute_map = { @@ -4988,6 +6581,14 @@ def __init__( expiry_time: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword permissions: The permissions to set on the SAS URL. Possible values include: "Read", + "ReadWrite", "ReadWriteDelete". + :paramtype permissions: str or ~azure.mgmt.media.models.AssetContainerPermission + :keyword expiry_time: The SAS URL expiration time. This must be less than 24 hours from the + current time. + :paramtype expiry_time: ~datetime.datetime + """ super(ListContainerSasInput, self).__init__(**kwargs) self.permissions = permissions self.expiry_time = expiry_time @@ -4996,8 +6597,8 @@ def __init__( class ListContentKeysResponse(msrest.serialization.Model): """Class of response for listContentKeys action. - :param content_keys: ContentKeys used by current Streaming Locator. - :type content_keys: list[~azure.mgmt.media.models.StreamingLocatorContentKey] + :ivar content_keys: ContentKeys used by current Streaming Locator. + :vartype content_keys: list[~azure.mgmt.media.models.StreamingLocatorContentKey] """ _attribute_map = { @@ -5010,6 +6611,10 @@ def __init__( content_keys: Optional[List["StreamingLocatorContentKey"]] = None, **kwargs ): + """ + :keyword content_keys: ContentKeys used by current Streaming Locator. + :paramtype content_keys: list[~azure.mgmt.media.models.StreamingLocatorContentKey] + """ super(ListContentKeysResponse, self).__init__(**kwargs) self.content_keys = content_keys @@ -5017,8 +6622,8 @@ def __init__( class ListEdgePoliciesInput(msrest.serialization.Model): """ListEdgePoliciesInput. - :param device_id: Unique identifier of the edge device. - :type device_id: str + :ivar device_id: Unique identifier of the edge device. + :vartype device_id: str """ _attribute_map = { @@ -5031,6 +6636,10 @@ def __init__( device_id: Optional[str] = None, **kwargs ): + """ + :keyword device_id: Unique identifier of the edge device. + :paramtype device_id: str + """ super(ListEdgePoliciesInput, self).__init__(**kwargs) self.device_id = device_id @@ -5038,10 +6647,10 @@ def __init__( class ListPathsResponse(msrest.serialization.Model): """Class of response for listPaths action. - :param streaming_paths: Streaming Paths supported by current Streaming Locator. - :type streaming_paths: list[~azure.mgmt.media.models.StreamingPath] - :param download_paths: Download Paths supported by current Streaming Locator. - :type download_paths: list[str] + :ivar streaming_paths: Streaming Paths supported by current Streaming Locator. + :vartype streaming_paths: list[~azure.mgmt.media.models.StreamingPath] + :ivar download_paths: Download Paths supported by current Streaming Locator. + :vartype download_paths: list[str] """ _attribute_map = { @@ -5056,6 +6665,12 @@ def __init__( download_paths: Optional[List[str]] = None, **kwargs ): + """ + :keyword streaming_paths: Streaming Paths supported by current Streaming Locator. + :paramtype streaming_paths: list[~azure.mgmt.media.models.StreamingPath] + :keyword download_paths: Download Paths supported by current Streaming Locator. + :paramtype download_paths: list[str] + """ super(ListPathsResponse, self).__init__(**kwargs) self.streaming_paths = streaming_paths self.download_paths = download_paths @@ -5082,6 +6697,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListStreamingLocatorsResponse, self).__init__(**kwargs) self.streaming_locators = None @@ -5101,10 +6718,10 @@ class TrackedResource(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :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 + :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 = { @@ -5129,6 +6746,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 @@ -5149,48 +6772,48 @@ class LiveEvent(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :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 + :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 system_data: The system metadata relating to this resource. :vartype system_data: ~azure.mgmt.media.models.SystemData - :param description: A description for the live event. - :type description: str - :param input: Live event input settings. It defines how the live event receives input from a + :ivar description: A description for the live event. + :vartype description: str + :ivar input: Live event input settings. It defines how the live event receives input from a contribution encoder. - :type input: ~azure.mgmt.media.models.LiveEventInput - :param preview: Live event preview settings. Preview allows live event producers to preview the + :vartype input: ~azure.mgmt.media.models.LiveEventInput + :ivar preview: Live event preview settings. Preview allows live event producers to preview the live streaming content without creating any live output. - :type preview: ~azure.mgmt.media.models.LiveEventPreview - :param encoding: Encoding settings for the live event. It configures whether a live encoder is + :vartype preview: ~azure.mgmt.media.models.LiveEventPreview + :ivar encoding: Encoding settings for the live event. It configures whether a live encoder is used for the live event and settings for the live encoder if it is used. - :type encoding: ~azure.mgmt.media.models.LiveEventEncoding - :param transcriptions: Live transcription settings for the live event. See + :vartype encoding: ~azure.mgmt.media.models.LiveEventEncoding + :ivar transcriptions: Live transcription settings for the live event. See https://go.microsoft.com/fwlink/?linkid=2133742 for more information about the live transcription feature. - :type transcriptions: list[~azure.mgmt.media.models.LiveEventTranscription] + :vartype transcriptions: list[~azure.mgmt.media.models.LiveEventTranscription] :ivar provisioning_state: The provisioning state of the live event. :vartype provisioning_state: str :ivar resource_state: The resource state of the live event. See https://go.microsoft.com/fwlink/?linkid=2139012 for more information. Possible values include: "Stopped", "Allocating", "StandBy", "Starting", "Running", "Stopping", "Deleting". :vartype resource_state: str or ~azure.mgmt.media.models.LiveEventResourceState - :param cross_site_access_policies: Live event cross site access policies. - :type cross_site_access_policies: ~azure.mgmt.media.models.CrossSiteAccessPolicies - :param use_static_hostname: Specifies whether a static hostname would be assigned to the live + :ivar cross_site_access_policies: Live event cross site access policies. + :vartype cross_site_access_policies: ~azure.mgmt.media.models.CrossSiteAccessPolicies + :ivar use_static_hostname: Specifies whether a static hostname would be assigned to the live event preview and ingest endpoints. This value can only be updated if the live event is in Standby state. - :type use_static_hostname: bool - :param hostname_prefix: When useStaticHostname is set to true, the hostnamePrefix specifies the + :vartype use_static_hostname: bool + :ivar hostname_prefix: When useStaticHostname is set to true, the hostnamePrefix specifies the first part of the hostname assigned to the live event preview and ingest endpoints. The final hostname would be a combination of this prefix, the media service account name and a short code for the Azure Media Services data center. - :type hostname_prefix: str - :param stream_options: The options to use for the LiveEvent. This value is specified at - creation time and cannot be updated. The valid values for the array entry values are 'Default' - and 'LowLatency'. - :type stream_options: list[str or ~azure.mgmt.media.models.StreamOptionsFlag] + :vartype hostname_prefix: str + :ivar stream_options: The options to use for the LiveEvent. This value is specified at creation + time and cannot be updated. The valid values for the array entry values are 'Default' and + 'LowLatency'. + :vartype stream_options: list[str or ~azure.mgmt.media.models.StreamOptionsFlag] :ivar created: The creation time for the live event. :vartype created: ~datetime.datetime :ivar last_modified: The last modified time of the live event. @@ -5247,6 +6870,42 @@ def __init__( stream_options: Optional[List[Union[str, "StreamOptionsFlag"]]] = 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 description: A description for the live event. + :paramtype description: str + :keyword input: Live event input settings. It defines how the live event receives input from a + contribution encoder. + :paramtype input: ~azure.mgmt.media.models.LiveEventInput + :keyword preview: Live event preview settings. Preview allows live event producers to preview + the live streaming content without creating any live output. + :paramtype preview: ~azure.mgmt.media.models.LiveEventPreview + :keyword encoding: Encoding settings for the live event. It configures whether a live encoder + is used for the live event and settings for the live encoder if it is used. + :paramtype encoding: ~azure.mgmt.media.models.LiveEventEncoding + :keyword transcriptions: Live transcription settings for the live event. See + https://go.microsoft.com/fwlink/?linkid=2133742 for more information about the live + transcription feature. + :paramtype transcriptions: list[~azure.mgmt.media.models.LiveEventTranscription] + :keyword cross_site_access_policies: Live event cross site access policies. + :paramtype cross_site_access_policies: ~azure.mgmt.media.models.CrossSiteAccessPolicies + :keyword use_static_hostname: Specifies whether a static hostname would be assigned to the live + event preview and ingest endpoints. This value can only be updated if the live event is in + Standby state. + :paramtype use_static_hostname: bool + :keyword hostname_prefix: When useStaticHostname is set to true, the hostnamePrefix specifies + the first part of the hostname assigned to the live event preview and ingest endpoints. The + final hostname would be a combination of this prefix, the media service account name and a + short code for the Azure Media Services data center. + :paramtype hostname_prefix: str + :keyword stream_options: The options to use for the LiveEvent. This value is specified at + creation time and cannot be updated. The valid values for the array entry values are 'Default' + and 'LowLatency'. + :paramtype stream_options: list[str or ~azure.mgmt.media.models.StreamOptionsFlag] + """ super(LiveEvent, self).__init__(tags=tags, location=location, **kwargs) self.system_data = None self.description = description @@ -5267,10 +6926,9 @@ def __init__( class LiveEventActionInput(msrest.serialization.Model): """The LiveEvent action input parameter definition. - :param remove_outputs_on_stop: The flag indicates whether live outputs are automatically - deleted when live event is being stopped. Deleting live outputs do not delete the underlying - assets. - :type remove_outputs_on_stop: bool + :ivar remove_outputs_on_stop: The flag indicates whether live outputs are automatically deleted + when live event is being stopped. Deleting live outputs do not delete the underlying assets. + :vartype remove_outputs_on_stop: bool """ _attribute_map = { @@ -5283,6 +6941,12 @@ def __init__( remove_outputs_on_stop: Optional[bool] = None, **kwargs ): + """ + :keyword remove_outputs_on_stop: The flag indicates whether live outputs are automatically + deleted when live event is being stopped. Deleting live outputs do not delete the underlying + assets. + :paramtype remove_outputs_on_stop: bool + """ super(LiveEventActionInput, self).__init__(**kwargs) self.remove_outputs_on_stop = remove_outputs_on_stop @@ -5290,28 +6954,29 @@ def __init__( class LiveEventEncoding(msrest.serialization.Model): """Specifies the live event type and optional encoding settings for encoding live events. - :param encoding_type: Live event type. When encodingType is set to None, the service simply - passes through the incoming video and audio layer(s) to the output. When encodingType is set to - Standard or Premium1080p, a live encoder transcodes the incoming stream into multiple bitrates - or layers. See https://go.microsoft.com/fwlink/?linkid=2095101 for more information. This - property cannot be modified after the live event is created. Possible values include: "None", - "Standard", "Premium1080p", "PassthroughBasic", "PassthroughStandard". - :type encoding_type: str or ~azure.mgmt.media.models.LiveEventEncodingType - :param preset_name: The optional encoding preset name, used when encodingType is not None. This + :ivar encoding_type: Live event type. When encodingType is set to PassthroughBasic or + PassthroughStandard, the service simply passes through the incoming video and audio layer(s) to + the output. When encodingType is set to Standard or Premium1080p, a live encoder transcodes the + incoming stream into multiple bitrates or layers. See + https://go.microsoft.com/fwlink/?linkid=2095101 for more information. This property cannot be + modified after the live event is created. Possible values include: "None", "Standard", + "Premium1080p", "PassthroughBasic", "PassthroughStandard". + :vartype encoding_type: str or ~azure.mgmt.media.models.LiveEventEncodingType + :ivar preset_name: The optional encoding preset name, used when encodingType is not None. This value is specified at creation time and cannot be updated. If the encodingType is set to Standard, then the default preset name is ‘Default720p’. Else if the encodingType is set to Premium1080p, the default preset is ‘Default1080p’. - :type preset_name: str - :param stretch_mode: Specifies how the input video will be resized to fit the desired output + :vartype preset_name: str + :ivar stretch_mode: Specifies how the input video will be resized to fit the desired output resolution(s). Default is None. Possible values include: "None", "AutoSize", "AutoFit". - :type stretch_mode: str or ~azure.mgmt.media.models.StretchMode - :param key_frame_interval: Use an ISO 8601 time value between 0.5 to 20 seconds to specify the + :vartype stretch_mode: str or ~azure.mgmt.media.models.StretchMode + :ivar key_frame_interval: Use an ISO 8601 time value between 0.5 to 20 seconds to specify the output fragment length for the video and audio tracks of an encoding live event. For example, use PT2S to indicate 2 seconds. For the video track it also defines the key frame interval, or the length of a GoP (group of pictures). If this value is not set for an encoding live event, the fragment duration defaults to 2 seconds. The value cannot be set for pass-through live events. - :type key_frame_interval: ~datetime.timedelta + :vartype key_frame_interval: ~datetime.timedelta """ _attribute_map = { @@ -5330,6 +6995,31 @@ def __init__( key_frame_interval: Optional[datetime.timedelta] = None, **kwargs ): + """ + :keyword encoding_type: Live event type. When encodingType is set to PassthroughBasic or + PassthroughStandard, the service simply passes through the incoming video and audio layer(s) to + the output. When encodingType is set to Standard or Premium1080p, a live encoder transcodes the + incoming stream into multiple bitrates or layers. See + https://go.microsoft.com/fwlink/?linkid=2095101 for more information. This property cannot be + modified after the live event is created. Possible values include: "None", "Standard", + "Premium1080p", "PassthroughBasic", "PassthroughStandard". + :paramtype encoding_type: str or ~azure.mgmt.media.models.LiveEventEncodingType + :keyword preset_name: The optional encoding preset name, used when encodingType is not None. + This value is specified at creation time and cannot be updated. If the encodingType is set to + Standard, then the default preset name is ‘Default720p’. Else if the encodingType is set to + Premium1080p, the default preset is ‘Default1080p’. + :paramtype preset_name: str + :keyword stretch_mode: Specifies how the input video will be resized to fit the desired output + resolution(s). Default is None. Possible values include: "None", "AutoSize", "AutoFit". + :paramtype stretch_mode: str or ~azure.mgmt.media.models.StretchMode + :keyword key_frame_interval: Use an ISO 8601 time value between 0.5 to 20 seconds to specify + the output fragment length for the video and audio tracks of an encoding live event. For + example, use PT2S to indicate 2 seconds. For the video track it also defines the key frame + interval, or the length of a GoP (group of pictures). If this value is not set for an + encoding live event, the fragment duration defaults to 2 seconds. The value cannot be set for + pass-through live events. + :paramtype key_frame_interval: ~datetime.timedelta + """ super(LiveEventEncoding, self).__init__(**kwargs) self.encoding_type = encoding_type self.preset_name = preset_name @@ -5340,10 +7030,10 @@ def __init__( class LiveEventEndpoint(msrest.serialization.Model): """The live event endpoint. - :param protocol: The endpoint protocol. - :type protocol: str - :param url: The endpoint URL. - :type url: str + :ivar protocol: The endpoint protocol. + :vartype protocol: str + :ivar url: The endpoint URL. + :vartype url: str """ _attribute_map = { @@ -5358,6 +7048,12 @@ def __init__( url: Optional[str] = None, **kwargs ): + """ + :keyword protocol: The endpoint protocol. + :paramtype protocol: str + :keyword url: The endpoint URL. + :paramtype url: str + """ super(LiveEventEndpoint, self).__init__(**kwargs) self.protocol = protocol self.url = url @@ -5368,21 +7064,21 @@ class LiveEventInput(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param streaming_protocol: Required. The input protocol for the live event. This is specified - at creation time and cannot be updated. Possible values include: "FragmentedMP4", "RTMP". - :type streaming_protocol: str or ~azure.mgmt.media.models.LiveEventInputProtocol - :param access_control: Access control for live event input. - :type access_control: ~azure.mgmt.media.models.LiveEventInputAccessControl - :param key_frame_interval_duration: ISO 8601 time duration of the key frame interval duration - of the input. This value sets the EXT-X-TARGETDURATION property in the HLS output. For example, + :ivar streaming_protocol: Required. The input protocol for the live event. This is specified at + creation time and cannot be updated. Possible values include: "FragmentedMP4", "RTMP". + :vartype streaming_protocol: str or ~azure.mgmt.media.models.LiveEventInputProtocol + :ivar access_control: Access control for live event input. + :vartype access_control: ~azure.mgmt.media.models.LiveEventInputAccessControl + :ivar key_frame_interval_duration: ISO 8601 time duration of the key frame interval duration of + the input. This value sets the EXT-X-TARGETDURATION property in the HLS output. For example, use PT2S to indicate 2 seconds. Leave the value empty for encoding live events. - :type key_frame_interval_duration: str - :param access_token: A UUID in string form to uniquely identify the stream. This can be + :vartype key_frame_interval_duration: str + :ivar access_token: A UUID in string form to uniquely identify the stream. This can be specified at creation time but cannot be updated. If omitted, the service will generate a unique value. - :type access_token: str - :param endpoints: The input endpoints for the live event. - :type endpoints: list[~azure.mgmt.media.models.LiveEventEndpoint] + :vartype access_token: str + :ivar endpoints: The input endpoints for the live event. + :vartype endpoints: list[~azure.mgmt.media.models.LiveEventEndpoint] """ _validation = { @@ -5407,6 +7103,23 @@ def __init__( endpoints: Optional[List["LiveEventEndpoint"]] = None, **kwargs ): + """ + :keyword streaming_protocol: Required. The input protocol for the live event. This is specified + at creation time and cannot be updated. Possible values include: "FragmentedMP4", "RTMP". + :paramtype streaming_protocol: str or ~azure.mgmt.media.models.LiveEventInputProtocol + :keyword access_control: Access control for live event input. + :paramtype access_control: ~azure.mgmt.media.models.LiveEventInputAccessControl + :keyword key_frame_interval_duration: ISO 8601 time duration of the key frame interval duration + of the input. This value sets the EXT-X-TARGETDURATION property in the HLS output. For example, + use PT2S to indicate 2 seconds. Leave the value empty for encoding live events. + :paramtype key_frame_interval_duration: str + :keyword access_token: A UUID in string form to uniquely identify the stream. This can be + specified at creation time but cannot be updated. If omitted, the service will generate a + unique value. + :paramtype access_token: str + :keyword endpoints: The input endpoints for the live event. + :paramtype endpoints: list[~azure.mgmt.media.models.LiveEventEndpoint] + """ super(LiveEventInput, self).__init__(**kwargs) self.streaming_protocol = streaming_protocol self.access_control = access_control @@ -5418,8 +7131,8 @@ def __init__( class LiveEventInputAccessControl(msrest.serialization.Model): """The IP access control for live event input. - :param ip: The IP access control properties. - :type ip: ~azure.mgmt.media.models.IPAccessControl + :ivar ip: The IP access control properties. + :vartype ip: ~azure.mgmt.media.models.IPAccessControl """ _attribute_map = { @@ -5432,6 +7145,10 @@ def __init__( ip: Optional["IPAccessControl"] = None, **kwargs ): + """ + :keyword ip: The IP access control properties. + :paramtype ip: ~azure.mgmt.media.models.IPAccessControl + """ super(LiveEventInputAccessControl, self).__init__(**kwargs) self.ip = ip @@ -5439,15 +7156,15 @@ def __init__( class LiveEventInputTrackSelection(msrest.serialization.Model): """A track selection condition. This property is reserved for future use, any value set on this property will be ignored. - :param property: Property name to select. This property is reserved for future use, any value + :ivar property: Property name to select. This property is reserved for future use, any value set on this property will be ignored. - :type property: str - :param operation: Comparing operation. This property is reserved for future use, any value set + :vartype property: str + :ivar operation: Comparing operation. This property is reserved for future use, any value set on this property will be ignored. - :type operation: str - :param value: Property value to select. This property is reserved for future use, any value set + :vartype operation: str + :ivar value: Property value to select. This property is reserved for future use, any value set on this property will be ignored. - :type value: str + :vartype value: str """ _attribute_map = { @@ -5464,6 +7181,17 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword property: Property name to select. This property is reserved for future use, any value + set on this property will be ignored. + :paramtype property: str + :keyword operation: Comparing operation. This property is reserved for future use, any value + set on this property will be ignored. + :paramtype operation: str + :keyword value: Property value to select. This property is reserved for future use, any value + set on this property will be ignored. + :paramtype value: str + """ super(LiveEventInputTrackSelection, self).__init__(**kwargs) self.property = property self.operation = operation @@ -5473,13 +7201,13 @@ def __init__( class LiveEventListResult(msrest.serialization.Model): """The LiveEvent list result. - :param value: The result of the List Live Event operation. - :type value: list[~azure.mgmt.media.models.LiveEvent] - :param odata_count: The number of result. - :type odata_count: int - :param odata_next_link: The link to the next set of results. Not empty if value contains + :ivar value: The result of the List Live Event operation. + :vartype value: list[~azure.mgmt.media.models.LiveEvent] + :ivar odata_count: The number of result. + :vartype odata_count: int + :ivar odata_next_link: The link to the next set of results. Not empty if value contains incomplete list of live outputs. - :type odata_next_link: str + :vartype odata_next_link: str """ _attribute_map = { @@ -5496,6 +7224,15 @@ def __init__( odata_next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The result of the List Live Event operation. + :paramtype value: list[~azure.mgmt.media.models.LiveEvent] + :keyword odata_count: The number of result. + :paramtype odata_count: int + :keyword odata_next_link: The link to the next set of results. Not empty if value contains + incomplete list of live outputs. + :paramtype odata_next_link: str + """ super(LiveEventListResult, self).__init__(**kwargs) self.value = value self.odata_count = odata_count @@ -5507,9 +7244,9 @@ class LiveEventOutputTranscriptionTrack(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param track_name: Required. The output track name. This property is reserved for future use, + :ivar track_name: Required. The output track name. This property is reserved for future use, any value set on this property will be ignored. - :type track_name: str + :vartype track_name: str """ _validation = { @@ -5526,6 +7263,11 @@ def __init__( track_name: str, **kwargs ): + """ + :keyword track_name: Required. The output track name. This property is reserved for future use, + any value set on this property will be ignored. + :paramtype track_name: str + """ super(LiveEventOutputTranscriptionTrack, self).__init__(**kwargs) self.track_name = track_name @@ -5533,25 +7275,25 @@ def __init__( class LiveEventPreview(msrest.serialization.Model): """Live event preview settings. - :param endpoints: The endpoints for preview. Do not share the preview URL with the live event + :ivar endpoints: The endpoints for preview. Do not share the preview URL with the live event audience. - :type endpoints: list[~azure.mgmt.media.models.LiveEventEndpoint] - :param access_control: The access control for live event preview. - :type access_control: ~azure.mgmt.media.models.LiveEventPreviewAccessControl - :param preview_locator: The identifier of the preview locator in Guid format. Specifying this - at creation time allows the caller to know the preview locator url before the event is created. - If omitted, the service will generate a random identifier. This value cannot be updated once - the live event is created. - :type preview_locator: str - :param streaming_policy_name: The name of streaming policy used for the live event preview. - This value is specified at creation time and cannot be updated. - :type streaming_policy_name: str - :param alternative_media_id: An alternative media identifier associated with the streaming + :vartype endpoints: list[~azure.mgmt.media.models.LiveEventEndpoint] + :ivar access_control: The access control for live event preview. + :vartype access_control: ~azure.mgmt.media.models.LiveEventPreviewAccessControl + :ivar preview_locator: The identifier of the preview locator in Guid format. Specifying this at + creation time allows the caller to know the preview locator url before the event is created. If + omitted, the service will generate a random identifier. This value cannot be updated once the + live event is created. + :vartype preview_locator: str + :ivar streaming_policy_name: The name of streaming policy used for the live event preview. This + value is specified at creation time and cannot be updated. + :vartype streaming_policy_name: str + :ivar alternative_media_id: An alternative media identifier associated with the streaming locator created for the preview. This value is specified at creation time and cannot be updated. The identifier can be used in the CustomLicenseAcquisitionUrlTemplate or the CustomKeyAcquisitionUrlTemplate of the StreamingPolicy specified in the StreamingPolicyName field. - :type alternative_media_id: str + :vartype alternative_media_id: str """ _attribute_map = { @@ -5572,6 +7314,27 @@ def __init__( alternative_media_id: Optional[str] = None, **kwargs ): + """ + :keyword endpoints: The endpoints for preview. Do not share the preview URL with the live event + audience. + :paramtype endpoints: list[~azure.mgmt.media.models.LiveEventEndpoint] + :keyword access_control: The access control for live event preview. + :paramtype access_control: ~azure.mgmt.media.models.LiveEventPreviewAccessControl + :keyword preview_locator: The identifier of the preview locator in Guid format. Specifying this + at creation time allows the caller to know the preview locator url before the event is created. + If omitted, the service will generate a random identifier. This value cannot be updated once + the live event is created. + :paramtype preview_locator: str + :keyword streaming_policy_name: The name of streaming policy used for the live event preview. + This value is specified at creation time and cannot be updated. + :paramtype streaming_policy_name: str + :keyword alternative_media_id: An alternative media identifier associated with the streaming + locator created for the preview. This value is specified at creation time and cannot be + updated. The identifier can be used in the CustomLicenseAcquisitionUrlTemplate or the + CustomKeyAcquisitionUrlTemplate of the StreamingPolicy specified in the StreamingPolicyName + field. + :paramtype alternative_media_id: str + """ super(LiveEventPreview, self).__init__(**kwargs) self.endpoints = endpoints self.access_control = access_control @@ -5583,8 +7346,8 @@ def __init__( class LiveEventPreviewAccessControl(msrest.serialization.Model): """The IP access control for the live event preview endpoint. - :param ip: The IP access control properties. - :type ip: ~azure.mgmt.media.models.IPAccessControl + :ivar ip: The IP access control properties. + :vartype ip: ~azure.mgmt.media.models.IPAccessControl """ _attribute_map = { @@ -5597,6 +7360,10 @@ def __init__( ip: Optional["IPAccessControl"] = None, **kwargs ): + """ + :keyword ip: The IP access control properties. + :paramtype ip: ~azure.mgmt.media.models.IPAccessControl + """ super(LiveEventPreviewAccessControl, self).__init__(**kwargs) self.ip = ip @@ -5604,19 +7371,19 @@ def __init__( class LiveEventTranscription(msrest.serialization.Model): """Describes the transcription tracks in the output of a live event, generated using speech-to-text transcription. This property is reserved for future use, any value set on this property will be ignored. - :param language: Specifies the language (locale) to be used for speech-to-text transcription – + :ivar language: Specifies the language (locale) to be used for speech-to-text transcription – it should match the spoken language in the audio track. The value should be in BCP-47 format (e.g: 'en-US'). See https://go.microsoft.com/fwlink/?linkid=2133742 for more information about the live transcription feature and the list of supported languages. - :type language: str - :param input_track_selection: Provides a mechanism to select the audio track in the input live + :vartype language: str + :ivar input_track_selection: Provides a mechanism to select the audio track in the input live feed, to which speech-to-text transcription is applied. This property is reserved for future use, any value set on this property will be ignored. - :type input_track_selection: list[~azure.mgmt.media.models.LiveEventInputTrackSelection] - :param output_transcription_track: Describes a transcription track in the output of a live + :vartype input_track_selection: list[~azure.mgmt.media.models.LiveEventInputTrackSelection] + :ivar output_transcription_track: Describes a transcription track in the output of a live event, generated using speech-to-text transcription. This property is reserved for future use, any value set on this property will be ignored. - :type output_transcription_track: ~azure.mgmt.media.models.LiveEventOutputTranscriptionTrack + :vartype output_transcription_track: ~azure.mgmt.media.models.LiveEventOutputTranscriptionTrack """ _attribute_map = { @@ -5633,6 +7400,22 @@ def __init__( output_transcription_track: Optional["LiveEventOutputTranscriptionTrack"] = None, **kwargs ): + """ + :keyword language: Specifies the language (locale) to be used for speech-to-text transcription + – it should match the spoken language in the audio track. The value should be in BCP-47 format + (e.g: 'en-US'). See https://go.microsoft.com/fwlink/?linkid=2133742 for more information about + the live transcription feature and the list of supported languages. + :paramtype language: str + :keyword input_track_selection: Provides a mechanism to select the audio track in the input + live feed, to which speech-to-text transcription is applied. This property is reserved for + future use, any value set on this property will be ignored. + :paramtype input_track_selection: list[~azure.mgmt.media.models.LiveEventInputTrackSelection] + :keyword output_transcription_track: Describes a transcription track in the output of a live + event, generated using speech-to-text transcription. This property is reserved for future use, + any value set on this property will be ignored. + :paramtype output_transcription_track: + ~azure.mgmt.media.models.LiveEventOutputTranscriptionTrack + """ super(LiveEventTranscription, self).__init__(**kwargs) self.language = language self.input_track_selection = input_track_selection @@ -5654,23 +7437,23 @@ class LiveOutput(ProxyResource): :vartype type: str :ivar system_data: The system metadata relating to this resource. :vartype system_data: ~azure.mgmt.media.models.SystemData - :param description: The description of the live output. - :type description: str - :param asset_name: The asset that the live output will write to. - :type asset_name: str - :param archive_window_length: ISO 8601 time between 1 minute to 25 hours to indicate the - maximum content length that can be archived in the asset for this live output. This also sets - the maximum content length for the rewind window. For example, use PT1H30M to indicate 1 hour - and 30 minutes of archive window. - :type archive_window_length: ~datetime.timedelta - :param manifest_name: The manifest file name. If not provided, the service will generate one + :ivar description: The description of the live output. + :vartype description: str + :ivar asset_name: The asset that the live output will write to. + :vartype asset_name: str + :ivar archive_window_length: ISO 8601 time between 1 minute to 25 hours to indicate the maximum + content length that can be archived in the asset for this live output. This also sets the + maximum content length for the rewind window. For example, use PT1H30M to indicate 1 hour and + 30 minutes of archive window. + :vartype archive_window_length: ~datetime.timedelta + :ivar manifest_name: The manifest file name. If not provided, the service will generate one automatically. - :type manifest_name: str - :param hls: HTTP Live Streaming (HLS) packing setting for the live output. - :type hls: ~azure.mgmt.media.models.Hls - :param output_snap_time: The initial timestamp that the live output will start at, any content + :vartype manifest_name: str + :ivar hls: HTTP Live Streaming (HLS) packing setting for the live output. + :vartype hls: ~azure.mgmt.media.models.Hls + :ivar output_snap_time: The initial timestamp that the live output will start at, any content before this value will not be archived. - :type output_snap_time: long + :vartype output_snap_time: long :ivar created: The creation time the live output. :vartype created: ~datetime.datetime :ivar last_modified: The time the live output was last modified. @@ -5721,6 +7504,25 @@ def __init__( output_snap_time: Optional[int] = None, **kwargs ): + """ + :keyword description: The description of the live output. + :paramtype description: str + :keyword asset_name: The asset that the live output will write to. + :paramtype asset_name: str + :keyword archive_window_length: ISO 8601 time between 1 minute to 25 hours to indicate the + maximum content length that can be archived in the asset for this live output. This also sets + the maximum content length for the rewind window. For example, use PT1H30M to indicate 1 hour + and 30 minutes of archive window. + :paramtype archive_window_length: ~datetime.timedelta + :keyword manifest_name: The manifest file name. If not provided, the service will generate one + automatically. + :paramtype manifest_name: str + :keyword hls: HTTP Live Streaming (HLS) packing setting for the live output. + :paramtype hls: ~azure.mgmt.media.models.Hls + :keyword output_snap_time: The initial timestamp that the live output will start at, any + content before this value will not be archived. + :paramtype output_snap_time: long + """ super(LiveOutput, self).__init__(**kwargs) self.system_data = None self.description = description @@ -5738,13 +7540,13 @@ def __init__( class LiveOutputListResult(msrest.serialization.Model): """The LiveOutput list result. - :param value: The result of the List LiveOutput operation. - :type value: list[~azure.mgmt.media.models.LiveOutput] - :param odata_count: The number of result. - :type odata_count: int - :param odata_next_link: The link to the next set of results. Not empty if value contains + :ivar value: The result of the List LiveOutput operation. + :vartype value: list[~azure.mgmt.media.models.LiveOutput] + :ivar odata_count: The number of result. + :vartype odata_count: int + :ivar odata_next_link: The link to the next set of results. Not empty if value contains incomplete list of live outputs. - :type odata_next_link: str + :vartype odata_next_link: str """ _attribute_map = { @@ -5761,6 +7563,15 @@ def __init__( odata_next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The result of the List LiveOutput operation. + :paramtype value: list[~azure.mgmt.media.models.LiveOutput] + :keyword odata_count: The number of result. + :paramtype odata_count: int + :keyword odata_next_link: The link to the next set of results. Not empty if value contains + incomplete list of live outputs. + :paramtype odata_next_link: str + """ super(LiveOutputListResult, self).__init__(**kwargs) self.value = value self.odata_count = odata_count @@ -5796,6 +7607,8 @@ def __init__( self, **kwargs ): + """ + """ super(LogSpecification, self).__init__(**kwargs) self.name = None self.display_name = None @@ -5817,27 +7630,27 @@ class MediaService(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :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 Managed Identity for the Media Services account. - :type identity: ~azure.mgmt.media.models.MediaServiceIdentity + :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 Managed Identity for the Media Services account. + :vartype identity: ~azure.mgmt.media.models.MediaServiceIdentity :ivar system_data: The system metadata relating to this resource. :vartype system_data: ~azure.mgmt.media.models.SystemData :ivar media_service_id: The Media Services account ID. :vartype media_service_id: str - :param storage_accounts: The storage accounts for this resource. - :type storage_accounts: list[~azure.mgmt.media.models.StorageAccount] - :param storage_authentication: Possible values include: "System", "ManagedIdentity". - :type storage_authentication: str or ~azure.mgmt.media.models.StorageAuthentication - :param encryption: The account encryption properties. - :type encryption: ~azure.mgmt.media.models.AccountEncryption - :param key_delivery: The Key Delivery properties for Media Services account. - :type key_delivery: ~azure.mgmt.media.models.KeyDelivery - :param public_network_access: Whether or not public network access is allowed for resources + :ivar storage_accounts: The storage accounts for this resource. + :vartype storage_accounts: list[~azure.mgmt.media.models.StorageAccount] + :ivar storage_authentication: Possible values include: "System", "ManagedIdentity". + :vartype storage_authentication: str or ~azure.mgmt.media.models.StorageAuthentication + :ivar encryption: The account encryption properties. + :vartype encryption: ~azure.mgmt.media.models.AccountEncryption + :ivar key_delivery: The Key Delivery properties for Media Services account. + :vartype key_delivery: ~azure.mgmt.media.models.KeyDelivery + :ivar public_network_access: Whether or not public network access is allowed for resources under the Media Services account. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or ~azure.mgmt.media.models.PublicNetworkAccess + :vartype public_network_access: str or ~azure.mgmt.media.models.PublicNetworkAccess """ _validation = { @@ -5878,6 +7691,25 @@ def __init__( public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = 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 Managed Identity for the Media Services account. + :paramtype identity: ~azure.mgmt.media.models.MediaServiceIdentity + :keyword storage_accounts: The storage accounts for this resource. + :paramtype storage_accounts: list[~azure.mgmt.media.models.StorageAccount] + :keyword storage_authentication: Possible values include: "System", "ManagedIdentity". + :paramtype storage_authentication: str or ~azure.mgmt.media.models.StorageAuthentication + :keyword encryption: The account encryption properties. + :paramtype encryption: ~azure.mgmt.media.models.AccountEncryption + :keyword key_delivery: The Key Delivery properties for Media Services account. + :paramtype key_delivery: ~azure.mgmt.media.models.KeyDelivery + :keyword public_network_access: Whether or not public network access is allowed for resources + under the Media Services account. Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or ~azure.mgmt.media.models.PublicNetworkAccess + """ super(MediaService, self).__init__(tags=tags, location=location, **kwargs) self.identity = identity self.system_data = None @@ -5892,11 +7724,11 @@ def __init__( class MediaServiceCollection(msrest.serialization.Model): """A collection of MediaService items. - :param value: A collection of MediaService items. - :type value: list[~azure.mgmt.media.models.MediaService] - :param odata_next_link: A link to the next page of the collection (when the collection contains + :ivar value: A collection of MediaService items. + :vartype value: list[~azure.mgmt.media.models.MediaService] + :ivar odata_next_link: A link to the next page of the collection (when the collection contains too many results to return in one response). - :type odata_next_link: str + :vartype odata_next_link: str """ _attribute_map = { @@ -5911,6 +7743,13 @@ def __init__( odata_next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: A collection of MediaService items. + :paramtype value: list[~azure.mgmt.media.models.MediaService] + :keyword odata_next_link: A link to the next page of the collection (when the collection + contains too many results to return in one response). + :paramtype odata_next_link: str + """ super(MediaServiceCollection, self).__init__(**kwargs) self.value = value self.odata_next_link = odata_next_link @@ -5923,14 +7762,15 @@ class MediaServiceIdentity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The identity type. - :type type: str + :ivar type: Required. The identity type. + :vartype type: str :ivar principal_id: The Principal ID of the identity. :vartype principal_id: str :ivar tenant_id: The Tenant ID of the identity. :vartype tenant_id: str - :param user_assigned_identities: The user assigned managed identities. - :type user_assigned_identities: dict[str, ~azure.mgmt.media.models.UserAssignedManagedIdentity] + :ivar user_assigned_identities: The user assigned managed identities. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.media.models.UserAssignedManagedIdentity] """ _validation = { @@ -5953,6 +7793,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, + ~azure.mgmt.media.models.UserAssignedManagedIdentity] + """ super(MediaServiceIdentity, self).__init__(**kwargs) self.type = type self.principal_id = None @@ -5965,23 +7812,23 @@ class MediaServiceUpdate(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 Managed Identity for the Media Services account. - :type identity: ~azure.mgmt.media.models.MediaServiceIdentity + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar identity: The Managed Identity for the Media Services account. + :vartype identity: ~azure.mgmt.media.models.MediaServiceIdentity :ivar media_service_id: The Media Services account ID. :vartype media_service_id: str - :param storage_accounts: The storage accounts for this resource. - :type storage_accounts: list[~azure.mgmt.media.models.StorageAccount] - :param storage_authentication: Possible values include: "System", "ManagedIdentity". - :type storage_authentication: str or ~azure.mgmt.media.models.StorageAuthentication - :param encryption: The account encryption properties. - :type encryption: ~azure.mgmt.media.models.AccountEncryption - :param key_delivery: The Key Delivery properties for Media Services account. - :type key_delivery: ~azure.mgmt.media.models.KeyDelivery - :param public_network_access: Whether or not public network access is allowed for resources + :ivar storage_accounts: The storage accounts for this resource. + :vartype storage_accounts: list[~azure.mgmt.media.models.StorageAccount] + :ivar storage_authentication: Possible values include: "System", "ManagedIdentity". + :vartype storage_authentication: str or ~azure.mgmt.media.models.StorageAuthentication + :ivar encryption: The account encryption properties. + :vartype encryption: ~azure.mgmt.media.models.AccountEncryption + :ivar key_delivery: The Key Delivery properties for Media Services account. + :vartype key_delivery: ~azure.mgmt.media.models.KeyDelivery + :ivar public_network_access: Whether or not public network access is allowed for resources under the Media Services account. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or ~azure.mgmt.media.models.PublicNetworkAccess + :vartype public_network_access: str or ~azure.mgmt.media.models.PublicNetworkAccess """ _validation = { @@ -6011,6 +7858,23 @@ def __init__( public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: The Managed Identity for the Media Services account. + :paramtype identity: ~azure.mgmt.media.models.MediaServiceIdentity + :keyword storage_accounts: The storage accounts for this resource. + :paramtype storage_accounts: list[~azure.mgmt.media.models.StorageAccount] + :keyword storage_authentication: Possible values include: "System", "ManagedIdentity". + :paramtype storage_authentication: str or ~azure.mgmt.media.models.StorageAuthentication + :keyword encryption: The account encryption properties. + :paramtype encryption: ~azure.mgmt.media.models.AccountEncryption + :keyword key_delivery: The Key Delivery properties for Media Services account. + :paramtype key_delivery: ~azure.mgmt.media.models.KeyDelivery + :keyword public_network_access: Whether or not public network access is allowed for resources + under the Media Services account. Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or ~azure.mgmt.media.models.PublicNetworkAccess + """ super(MediaServiceUpdate, self).__init__(**kwargs) self.tags = tags self.identity = identity @@ -6051,6 +7915,8 @@ def __init__( self, **kwargs ): + """ + """ super(MetricDimension, self).__init__(**kwargs) self.name = None self.display_name = None @@ -6076,8 +7942,8 @@ class MetricSpecification(msrest.serialization.Model): :ivar lock_aggregation_type: The metric lock aggregation type. Possible values include: "Average", "Count", "Total". :vartype lock_aggregation_type: str or ~azure.mgmt.media.models.MetricAggregationType - :param supported_aggregation_types: Supported aggregation types. - :type supported_aggregation_types: list[str] + :ivar supported_aggregation_types: Supported aggregation types. + :vartype supported_aggregation_types: list[str] :ivar dimensions: The metric dimensions. :vartype dimensions: list[~azure.mgmt.media.models.MetricDimension] :ivar enable_regional_mdm_account: Indicates whether regional MDM account is enabled. @@ -6125,6 +7991,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 @@ -6148,23 +8018,22 @@ class MultiBitrateFormat(Format): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param filename_pattern: Required. The pattern of the file names for the generated output - files. The following macros are supported in the file name: {Basename} - An expansion macro - that will use the name of the input video file. If the base name(the file suffix is not - included) of the input video file is less than 32 characters long, the base name of input video - files will be used. If the length of base name of the input video file exceeds 32 characters, - the base name is truncated to the first 32 characters in total length. {Extension} - The - appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - - A unique index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video - bitrate. Not applicable to thumbnails. {Codec} - The type of the audio/video codec. - {Resolution} - The video resolution. Any unsubstituted macros will be collapsed and removed - from the filename. - :type filename_pattern: str - :param output_files: The list of output files to produce. Each entry in the list is a set of + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar filename_pattern: Required. The pattern of the file names for the generated output files. + The following macros are supported in the file name: {Basename} - An expansion macro that will + use the name of the input video file. If the base name(the file suffix is not included) of the + input video file is less than 32 characters long, the base name of input video files will be + used. If the length of base name of the input video file exceeds 32 characters, the base name + is truncated to the first 32 characters in total length. {Extension} - The appropriate + extension for this format. {Label} - The label assigned to the codec/layer. {Index} - A unique + index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video bitrate. Not + applicable to thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video + resolution. Any unsubstituted macros will be collapsed and removed from the filename. + :vartype filename_pattern: str + :ivar output_files: The list of output files to produce. Each entry in the list is a set of audio and video layer labels to be muxed together . - :type output_files: list[~azure.mgmt.media.models.OutputFile] + :vartype output_files: list[~azure.mgmt.media.models.OutputFile] """ _validation = { @@ -6189,6 +8058,23 @@ def __init__( output_files: Optional[List["OutputFile"]] = None, **kwargs ): + """ + :keyword filename_pattern: Required. The pattern of the file names for the generated output + files. The following macros are supported in the file name: {Basename} - An expansion macro + that will use the name of the input video file. If the base name(the file suffix is not + included) of the input video file is less than 32 characters long, the base name of input video + files will be used. If the length of base name of the input video file exceeds 32 characters, + the base name is truncated to the first 32 characters in total length. {Extension} - The + appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} + - A unique index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video + bitrate. Not applicable to thumbnails. {Codec} - The type of the audio/video codec. + {Resolution} - The video resolution. Any unsubstituted macros will be collapsed and removed + from the filename. + :paramtype filename_pattern: str + :keyword output_files: The list of output files to produce. Each entry in the list is a set of + audio and video layer labels to be muxed together . + :paramtype output_files: list[~azure.mgmt.media.models.OutputFile] + """ super(MultiBitrateFormat, self).__init__(filename_pattern=filename_pattern, **kwargs) self.odata_type = '#Microsoft.Media.MultiBitrateFormat' # type: str self.output_files = output_files @@ -6199,23 +8085,22 @@ class Mp4Format(MultiBitrateFormat): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param filename_pattern: Required. The pattern of the file names for the generated output - files. The following macros are supported in the file name: {Basename} - An expansion macro - that will use the name of the input video file. If the base name(the file suffix is not - included) of the input video file is less than 32 characters long, the base name of input video - files will be used. If the length of base name of the input video file exceeds 32 characters, - the base name is truncated to the first 32 characters in total length. {Extension} - The - appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - - A unique index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video - bitrate. Not applicable to thumbnails. {Codec} - The type of the audio/video codec. - {Resolution} - The video resolution. Any unsubstituted macros will be collapsed and removed - from the filename. - :type filename_pattern: str - :param output_files: The list of output files to produce. Each entry in the list is a set of + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar filename_pattern: Required. The pattern of the file names for the generated output files. + The following macros are supported in the file name: {Basename} - An expansion macro that will + use the name of the input video file. If the base name(the file suffix is not included) of the + input video file is less than 32 characters long, the base name of input video files will be + used. If the length of base name of the input video file exceeds 32 characters, the base name + is truncated to the first 32 characters in total length. {Extension} - The appropriate + extension for this format. {Label} - The label assigned to the codec/layer. {Index} - A unique + index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video bitrate. Not + applicable to thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video + resolution. Any unsubstituted macros will be collapsed and removed from the filename. + :vartype filename_pattern: str + :ivar output_files: The list of output files to produce. Each entry in the list is a set of audio and video layer labels to be muxed together . - :type output_files: list[~azure.mgmt.media.models.OutputFile] + :vartype output_files: list[~azure.mgmt.media.models.OutputFile] """ _validation = { @@ -6236,6 +8121,23 @@ def __init__( output_files: Optional[List["OutputFile"]] = None, **kwargs ): + """ + :keyword filename_pattern: Required. The pattern of the file names for the generated output + files. The following macros are supported in the file name: {Basename} - An expansion macro + that will use the name of the input video file. If the base name(the file suffix is not + included) of the input video file is less than 32 characters long, the base name of input video + files will be used. If the length of base name of the input video file exceeds 32 characters, + the base name is truncated to the first 32 characters in total length. {Extension} - The + appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} + - A unique index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video + bitrate. Not applicable to thumbnails. {Codec} - The type of the audio/video codec. + {Resolution} - The video resolution. Any unsubstituted macros will be collapsed and removed + from the filename. + :paramtype filename_pattern: str + :keyword output_files: The list of output files to produce. Each entry in the list is a set of + audio and video layer labels to be muxed together . + :paramtype output_files: list[~azure.mgmt.media.models.OutputFile] + """ super(Mp4Format, self).__init__(filename_pattern=filename_pattern, output_files=output_files, **kwargs) self.odata_type = '#Microsoft.Media.Mp4Format' # type: str @@ -6243,8 +8145,8 @@ def __init__( class NoEncryption(msrest.serialization.Model): """Class for NoEncryption scheme. - :param enabled_protocols: Representing supported protocols. - :type enabled_protocols: ~azure.mgmt.media.models.EnabledProtocols + :ivar enabled_protocols: Representing supported protocols. + :vartype enabled_protocols: ~azure.mgmt.media.models.EnabledProtocols """ _attribute_map = { @@ -6257,6 +8159,10 @@ def __init__( enabled_protocols: Optional["EnabledProtocols"] = None, **kwargs ): + """ + :keyword enabled_protocols: Representing supported protocols. + :paramtype enabled_protocols: ~azure.mgmt.media.models.EnabledProtocols + """ super(NoEncryption, self).__init__(**kwargs) self.enabled_protocols = enabled_protocols @@ -6266,18 +8172,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: ~azure.mgmt.media.models.OperationDisplay - :param origin: Origin of the operation. - :type origin: str - :param properties: Operation properties format. - :type properties: ~azure.mgmt.media.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 ~azure.mgmt.media.models.ActionType + :ivar name: Required. The operation name. + :vartype name: str + :ivar display: The operation display name. + :vartype display: ~azure.mgmt.media.models.OperationDisplay + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar properties: Operation properties format. + :vartype properties: ~azure.mgmt.media.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 ~azure.mgmt.media.models.ActionType """ _validation = { @@ -6304,6 +8210,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: ~azure.mgmt.media.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword properties: Operation properties format. + :paramtype properties: ~azure.mgmt.media.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 ~azure.mgmt.media.models.ActionType + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -6316,8 +8236,8 @@ def __init__( class OperationCollection(msrest.serialization.Model): """A collection of Operation items. - :param value: A collection of Operation items. - :type value: list[~azure.mgmt.media.models.Operation] + :ivar value: A collection of Operation items. + :vartype value: list[~azure.mgmt.media.models.Operation] """ _attribute_map = { @@ -6330,6 +8250,10 @@ def __init__( value: Optional[List["Operation"]] = None, **kwargs ): + """ + :keyword value: A collection of Operation items. + :paramtype value: list[~azure.mgmt.media.models.Operation] + """ super(OperationCollection, self).__init__(**kwargs) self.value = value @@ -6337,14 +8261,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 = { @@ -6363,6 +8287,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 @@ -6375,12 +8309,12 @@ class OutputFile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param labels: Required. The list of labels that describe how the encoder should multiplex - video and audio into an output file. For example, if the encoder is producing two video layers - with labels v1 and v2, and one audio layer with label a1, then an array like '[v1, a1]' tells - the encoder to produce an output file with the video track represented by v1 and the audio - track represented by a1. - :type labels: list[str] + :ivar labels: Required. The list of labels that describe how the encoder should multiplex video + and audio into an output file. For example, if the encoder is producing two video layers with + labels v1 and v2, and one audio layer with label a1, then an array like '[v1, a1]' tells the + encoder to produce an output file with the video track represented by v1 and the audio track + represented by a1. + :vartype labels: list[str] """ _validation = { @@ -6397,6 +8331,14 @@ def __init__( labels: List[str], **kwargs ): + """ + :keyword labels: Required. The list of labels that describe how the encoder should multiplex + video and audio into an output file. For example, if the encoder is producing two video layers + with labels v1 and v2, and one audio layer with label a1, then an array like '[v1, a1]' tells + the encoder to produce an output file with the video track represented by v1 and the audio + track represented by a1. + :paramtype labels: list[str] + """ super(OutputFile, self).__init__(**kwargs) self.labels = labels @@ -6406,20 +8348,19 @@ class PngFormat(ImageFormat): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param filename_pattern: Required. The pattern of the file names for the generated output - files. The following macros are supported in the file name: {Basename} - An expansion macro - that will use the name of the input video file. If the base name(the file suffix is not - included) of the input video file is less than 32 characters long, the base name of input video - files will be used. If the length of base name of the input video file exceeds 32 characters, - the base name is truncated to the first 32 characters in total length. {Extension} - The - appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - - A unique index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video - bitrate. Not applicable to thumbnails. {Codec} - The type of the audio/video codec. - {Resolution} - The video resolution. Any unsubstituted macros will be collapsed and removed - from the filename. - :type filename_pattern: str + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar filename_pattern: Required. The pattern of the file names for the generated output files. + The following macros are supported in the file name: {Basename} - An expansion macro that will + use the name of the input video file. If the base name(the file suffix is not included) of the + input video file is less than 32 characters long, the base name of input video files will be + used. If the length of base name of the input video file exceeds 32 characters, the base name + is truncated to the first 32 characters in total length. {Extension} - The appropriate + extension for this format. {Label} - The label assigned to the codec/layer. {Index} - A unique + index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video bitrate. Not + applicable to thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video + resolution. Any unsubstituted macros will be collapsed and removed from the filename. + :vartype filename_pattern: str """ _validation = { @@ -6438,6 +8379,20 @@ def __init__( filename_pattern: str, **kwargs ): + """ + :keyword filename_pattern: Required. The pattern of the file names for the generated output + files. The following macros are supported in the file name: {Basename} - An expansion macro + that will use the name of the input video file. If the base name(the file suffix is not + included) of the input video file is less than 32 characters long, the base name of input video + files will be used. If the length of base name of the input video file exceeds 32 characters, + the base name is truncated to the first 32 characters in total length. {Extension} - The + appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} + - A unique index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video + bitrate. Not applicable to thumbnails. {Codec} - The type of the audio/video codec. + {Resolution} - The video resolution. Any unsubstituted macros will be collapsed and removed + from the filename. + :paramtype filename_pattern: str + """ super(PngFormat, self).__init__(filename_pattern=filename_pattern, **kwargs) self.odata_type = '#Microsoft.Media.PngFormat' # type: str @@ -6447,32 +8402,31 @@ class PngImage(Image): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param label: An optional label for the codec. The label can be used to control muxing - behavior. - :type label: str - :param key_frame_interval: The distance between two key frames. The value should be non-zero in + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar label: An optional label for the codec. The label can be used to control muxing behavior. + :vartype label: str + :ivar key_frame_interval: The distance between two key frames. The value should be non-zero in the range [0.5, 20] seconds, specified in ISO 8601 format. The default is 2 seconds(PT2S). Note that this setting is ignored if VideoSyncMode.Passthrough is set, where the KeyFrameInterval value will follow the input source setting. - :type key_frame_interval: ~datetime.timedelta - :param stretch_mode: The resizing mode - how the input video will be resized to fit the desired + :vartype key_frame_interval: ~datetime.timedelta + :ivar stretch_mode: The resizing mode - how the input video will be resized to fit the desired output resolution(s). Default is AutoSize. Possible values include: "None", "AutoSize", "AutoFit". - :type stretch_mode: str or ~azure.mgmt.media.models.StretchMode - :param sync_mode: The Video Sync Mode. Possible values include: "Auto", "Passthrough", "Cfr", + :vartype stretch_mode: str or ~azure.mgmt.media.models.StretchMode + :ivar sync_mode: The Video Sync Mode. Possible values include: "Auto", "Passthrough", "Cfr", "Vfr". - :type sync_mode: str or ~azure.mgmt.media.models.VideoSyncMode - :param start: Required. The position in the input video from where to start generating + :vartype sync_mode: str or ~azure.mgmt.media.models.VideoSyncMode + :ivar start: Required. The position in the input video from where to start generating thumbnails. The value can be in ISO 8601 format (For example, PT05S to start at 5 seconds), or a frame count (For example, 10 to start at the 10th frame), or a relative value to stream duration (For example, 10% to start at 10% of stream duration). Also supports a macro {Best}, which tells the encoder to select the best thumbnail from the first few seconds of the video and will only produce one thumbnail, no matter what other settings are for Step and Range. The default value is macro {Best}. - :type start: str - :param step: The intervals at which thumbnails are generated. The value can be in ISO 8601 + :vartype start: str + :ivar step: The intervals at which thumbnails are generated. The value can be in ISO 8601 format (For example, PT05S for one image every 5 seconds), or a frame count (For example, 30 for one image every 30 frames), or a relative value to stream duration (For example, 10% for one image every 10% of stream duration). Note: Step value will affect the first generated @@ -6482,17 +8436,17 @@ class PngImage(Image): has long duration, the first generated thumbnail might be far away from the one specified at start time. Try to select reasonable value for Step if the first thumbnail is expected close to start time, or set Range value at 1 if only one thumbnail is needed at start time. - :type step: str - :param range: The position relative to transform preset start time in the input video at which + :vartype step: str + :ivar range: The position relative to transform preset start time in the input video at which to stop generating thumbnails. The value can be in ISO 8601 format (For example, PT5M30S to stop at 5 minutes and 30 seconds from start time), or a frame count (For example, 300 to stop at the 300th frame from the frame at start time. If this value is 1, it means only producing one thumbnail at start time), or a relative value to the stream duration (For example, 50% to stop at half of stream duration from start time). The default value is 100%, which means to stop at the end of the stream. - :type range: str - :param layers: A collection of output PNG image layers to be produced by the encoder. - :type layers: list[~azure.mgmt.media.models.PngLayer] + :vartype range: str + :ivar layers: A collection of output PNG image layers to be produced by the encoder. + :vartype layers: list[~azure.mgmt.media.models.PngLayer] """ _validation = { @@ -6525,6 +8479,52 @@ def __init__( layers: Optional[List["PngLayer"]] = None, **kwargs ): + """ + :keyword label: An optional label for the codec. The label can be used to control muxing + behavior. + :paramtype label: str + :keyword key_frame_interval: The distance between two key frames. The value should be non-zero + in the range [0.5, 20] seconds, specified in ISO 8601 format. The default is 2 seconds(PT2S). + Note that this setting is ignored if VideoSyncMode.Passthrough is set, where the + KeyFrameInterval value will follow the input source setting. + :paramtype key_frame_interval: ~datetime.timedelta + :keyword stretch_mode: The resizing mode - how the input video will be resized to fit the + desired output resolution(s). Default is AutoSize. Possible values include: "None", "AutoSize", + "AutoFit". + :paramtype stretch_mode: str or ~azure.mgmt.media.models.StretchMode + :keyword sync_mode: The Video Sync Mode. Possible values include: "Auto", "Passthrough", "Cfr", + "Vfr". + :paramtype sync_mode: str or ~azure.mgmt.media.models.VideoSyncMode + :keyword start: Required. The position in the input video from where to start generating + thumbnails. The value can be in ISO 8601 format (For example, PT05S to start at 5 seconds), or + a frame count (For example, 10 to start at the 10th frame), or a relative value to stream + duration (For example, 10% to start at 10% of stream duration). Also supports a macro {Best}, + which tells the encoder to select the best thumbnail from the first few seconds of the video + and will only produce one thumbnail, no matter what other settings are for Step and Range. The + default value is macro {Best}. + :paramtype start: str + :keyword step: The intervals at which thumbnails are generated. The value can be in ISO 8601 + format (For example, PT05S for one image every 5 seconds), or a frame count (For example, 30 + for one image every 30 frames), or a relative value to stream duration (For example, 10% for + one image every 10% of stream duration). Note: Step value will affect the first generated + thumbnail, which may not be exactly the one specified at transform preset start time. This is + due to the encoder, which tries to select the best thumbnail between start time and Step + position from start time as the first output. As the default value is 10%, it means if stream + has long duration, the first generated thumbnail might be far away from the one specified at + start time. Try to select reasonable value for Step if the first thumbnail is expected close to + start time, or set Range value at 1 if only one thumbnail is needed at start time. + :paramtype step: str + :keyword range: The position relative to transform preset start time in the input video at + which to stop generating thumbnails. The value can be in ISO 8601 format (For example, PT5M30S + to stop at 5 minutes and 30 seconds from start time), or a frame count (For example, 300 to + stop at the 300th frame from the frame at start time. If this value is 1, it means only + producing one thumbnail at start time), or a relative value to the stream duration (For + example, 50% to stop at half of stream duration from start time). The default value is 100%, + which means to stop at the end of the stream. + :paramtype range: str + :keyword layers: A collection of output PNG image layers to be produced by the encoder. + :paramtype layers: list[~azure.mgmt.media.models.PngLayer] + """ super(PngImage, self).__init__(label=label, key_frame_interval=key_frame_interval, stretch_mode=stretch_mode, sync_mode=sync_mode, start=start, step=step, range=range, **kwargs) self.odata_type = '#Microsoft.Media.PngImage' # type: str self.layers = layers @@ -6533,29 +8533,20 @@ def __init__( class PngLayer(Layer): """Describes the settings to produce a PNG image from the input video. - All required parameters must be populated in order to send to Azure. - - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param width: The width of the output video for this layer. The value can be absolute (in + :ivar width: The width of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example 50% means the output video has half as many pixels in width as the input. - :type width: str - :param height: The height of the output video for this layer. The value can be absolute (in + :vartype width: str + :ivar height: The height of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example 50% means the output video has half as many pixels in height as the input. - :type height: str - :param label: The alphanumeric label for this layer, which can be used in multiplexing - different video and audio layers, or in naming the output file. - :type label: str + :vartype height: str + :ivar label: The alphanumeric label for this layer, which can be used in multiplexing different + video and audio layers, or in naming the output file. + :vartype label: str """ - _validation = { - 'odata_type': {'required': True}, - } - _attribute_map = { - 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'width': {'key': 'width', 'type': 'str'}, 'height': {'key': 'height', 'type': 'str'}, 'label': {'key': 'label', 'type': 'str'}, @@ -6569,25 +8560,37 @@ def __init__( label: Optional[str] = None, **kwargs ): + """ + :keyword width: The width of the output video for this layer. The value can be absolute (in + pixels) or relative (in percentage). For example 50% means the output video has half as many + pixels in width as the input. + :paramtype width: str + :keyword height: The height of the output video for this layer. The value can be absolute (in + pixels) or relative (in percentage). For example 50% means the output video has half as many + pixels in height as the input. + :paramtype height: str + :keyword label: The alphanumeric label for this layer, which can be used in multiplexing + different video and audio layers, or in naming the output file. + :paramtype label: str + """ super(PngLayer, self).__init__(width=width, height=height, label=label, **kwargs) - self.odata_type = '#Microsoft.Media.PngLayer' # type: str class PresentationTimeRange(msrest.serialization.Model): """The presentation time range, this is asset related and not recommended for Account Filter. - :param start_timestamp: The absolute start time boundary. - :type start_timestamp: long - :param end_timestamp: The absolute end time boundary. - :type end_timestamp: long - :param presentation_window_duration: The relative to end sliding window. - :type presentation_window_duration: long - :param live_backoff_duration: The relative to end right edge. - :type live_backoff_duration: long - :param timescale: The time scale of time stamps. - :type timescale: long - :param force_end_timestamp: The indicator of forcing existing of end time stamp. - :type force_end_timestamp: bool + :ivar start_timestamp: The absolute start time boundary. + :vartype start_timestamp: long + :ivar end_timestamp: The absolute end time boundary. + :vartype end_timestamp: long + :ivar presentation_window_duration: The relative to end sliding window. + :vartype presentation_window_duration: long + :ivar live_backoff_duration: The relative to end right edge. + :vartype live_backoff_duration: long + :ivar timescale: The time scale of time stamps. + :vartype timescale: long + :ivar force_end_timestamp: The indicator of forcing existing of end time stamp. + :vartype force_end_timestamp: bool """ _attribute_map = { @@ -6610,6 +8613,20 @@ def __init__( force_end_timestamp: Optional[bool] = None, **kwargs ): + """ + :keyword start_timestamp: The absolute start time boundary. + :paramtype start_timestamp: long + :keyword end_timestamp: The absolute end time boundary. + :paramtype end_timestamp: long + :keyword presentation_window_duration: The relative to end sliding window. + :paramtype presentation_window_duration: long + :keyword live_backoff_duration: The relative to end right edge. + :paramtype live_backoff_duration: long + :keyword timescale: The time scale of time stamps. + :paramtype timescale: long + :keyword force_end_timestamp: The indicator of forcing existing of end time stamp. + :paramtype force_end_timestamp: bool + """ super(PresentationTimeRange, self).__init__(**kwargs) self.start_timestamp = start_timestamp self.end_timestamp = end_timestamp @@ -6622,35 +8639,35 @@ def __init__( class PresetConfigurations(msrest.serialization.Model): """An object of optional configuration settings for encoder. - :param complexity: Allows you to configure the encoder settings to control the balance between + :ivar complexity: Allows you to configure the encoder settings to control the balance between speed and quality. Example: set Complexity as Speed for faster encoding but less compression efficiency. Possible values include: "Speed", "Balanced", "Quality". - :type complexity: str or ~azure.mgmt.media.models.Complexity - :param interleave_output: Sets the interleave mode of the output to control how audio and video + :vartype complexity: str or ~azure.mgmt.media.models.Complexity + :ivar interleave_output: Sets the interleave mode of the output to control how audio and video are stored in the container format. Example: set InterleavedOutput as NonInterleavedOutput to produce audio-only and video-only outputs in separate MP4 files. Possible values include: "NonInterleavedOutput", "InterleavedOutput". - :type interleave_output: str or ~azure.mgmt.media.models.InterleaveOutput - :param key_frame_interval_in_seconds: The key frame interval in seconds. Example: set + :vartype interleave_output: str or ~azure.mgmt.media.models.InterleaveOutput + :ivar key_frame_interval_in_seconds: The key frame interval in seconds. Example: set KeyFrameIntervalInSeconds as 2 to reduce the playback buffering for some players. - :type key_frame_interval_in_seconds: float - :param max_bitrate_bps: The maximum bitrate in bits per second (threshold for the top video + :vartype key_frame_interval_in_seconds: float + :ivar max_bitrate_bps: The maximum bitrate in bits per second (threshold for the top video layer). Example: set MaxBitrateBps as 6000000 to avoid producing very high bitrate outputs for contents with high complexity. - :type max_bitrate_bps: int - :param max_height: The maximum height of output video layers. Example: set MaxHeight as 720 to + :vartype max_bitrate_bps: int + :ivar max_height: The maximum height of output video layers. Example: set MaxHeight as 720 to produce output layers up to 720P even if the input is 4K. - :type max_height: int - :param max_layers: The maximum number of output video layers. Example: set MaxLayers as 4 to + :vartype max_height: int + :ivar max_layers: The maximum number of output video layers. Example: set MaxLayers as 4 to make sure at most 4 output layers are produced to control the overall cost of the encoding job. - :type max_layers: int - :param min_bitrate_bps: The minimum bitrate in bits per second (threshold for the bottom video + :vartype max_layers: int + :ivar min_bitrate_bps: The minimum bitrate in bits per second (threshold for the bottom video layer). Example: set MinBitrateBps as 200000 to have a bottom layer that covers users with low network bandwidth. - :type min_bitrate_bps: int - :param min_height: The minimum height of output video layers. Example: set MinHeight as 360 to + :vartype min_bitrate_bps: int + :ivar min_height: The minimum height of output video layers. Example: set MinHeight as 360 to avoid output layers of smaller resolutions like 180P. - :type min_height: int + :vartype min_height: int """ _attribute_map = { @@ -6677,6 +8694,37 @@ def __init__( min_height: Optional[int] = None, **kwargs ): + """ + :keyword complexity: Allows you to configure the encoder settings to control the balance + between speed and quality. Example: set Complexity as Speed for faster encoding but less + compression efficiency. Possible values include: "Speed", "Balanced", "Quality". + :paramtype complexity: str or ~azure.mgmt.media.models.Complexity + :keyword interleave_output: Sets the interleave mode of the output to control how audio and + video are stored in the container format. Example: set InterleavedOutput as + NonInterleavedOutput to produce audio-only and video-only outputs in separate MP4 files. + Possible values include: "NonInterleavedOutput", "InterleavedOutput". + :paramtype interleave_output: str or ~azure.mgmt.media.models.InterleaveOutput + :keyword key_frame_interval_in_seconds: The key frame interval in seconds. Example: set + KeyFrameIntervalInSeconds as 2 to reduce the playback buffering for some players. + :paramtype key_frame_interval_in_seconds: float + :keyword max_bitrate_bps: The maximum bitrate in bits per second (threshold for the top video + layer). Example: set MaxBitrateBps as 6000000 to avoid producing very high bitrate outputs for + contents with high complexity. + :paramtype max_bitrate_bps: int + :keyword max_height: The maximum height of output video layers. Example: set MaxHeight as 720 + to produce output layers up to 720P even if the input is 4K. + :paramtype max_height: int + :keyword max_layers: The maximum number of output video layers. Example: set MaxLayers as 4 to + make sure at most 4 output layers are produced to control the overall cost of the encoding job. + :paramtype max_layers: int + :keyword min_bitrate_bps: The minimum bitrate in bits per second (threshold for the bottom + video layer). Example: set MinBitrateBps as 200000 to have a bottom layer that covers users + with low network bandwidth. + :paramtype min_bitrate_bps: int + :keyword min_height: The minimum height of output video layers. Example: set MinHeight as 360 + to avoid output layers of smaller resolutions like 180P. + :paramtype min_height: int + """ super(PresetConfigurations, self).__init__(**kwargs) self.complexity = complexity self.interleave_output = interleave_output @@ -6709,6 +8757,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -6726,11 +8776,11 @@ class PrivateEndpointConnection(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~azure.mgmt.media.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: + :ivar private_endpoint: The resource of private end point. + :vartype private_endpoint: ~azure.mgmt.media.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: ~azure.mgmt.media.models.PrivateLinkServiceConnectionState :ivar provisioning_state: The provisioning state of the private endpoint connection resource. Possible values include: "Succeeded", "Creating", "Deleting", "Failed". @@ -6761,6 +8811,14 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword private_endpoint: The resource of private end point. + :paramtype private_endpoint: ~azure.mgmt.media.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: + ~azure.mgmt.media.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state @@ -6770,8 +8828,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[~azure.mgmt.media.models.PrivateEndpointConnection] + :ivar value: Array of private endpoint connections. + :vartype value: list[~azure.mgmt.media.models.PrivateEndpointConnection] """ _attribute_map = { @@ -6784,6 +8842,10 @@ def __init__( value: Optional[List["PrivateEndpointConnection"]] = None, **kwargs ): + """ + :keyword value: Array of private endpoint connections. + :paramtype value: list[~azure.mgmt.media.models.PrivateEndpointConnection] + """ super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) self.value = value @@ -6805,8 +8867,8 @@ class PrivateLinkResource(Resource): :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 = { @@ -6832,6 +8894,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 @@ -6841,8 +8907,8 @@ def __init__( class PrivateLinkResourceListResult(msrest.serialization.Model): """A list of private link resources. - :param value: Array of private link resources. - :type value: list[~azure.mgmt.media.models.PrivateLinkResource] + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.media.models.PrivateLinkResource] """ _attribute_map = { @@ -6855,6 +8921,10 @@ def __init__( value: Optional[List["PrivateLinkResource"]] = None, **kwargs ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.media.models.PrivateLinkResource] + """ super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = value @@ -6862,14 +8932,14 @@ 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 ~azure.mgmt.media.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 ~azure.mgmt.media.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 = { @@ -6886,6 +8956,16 @@ 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 ~azure.mgmt.media.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 @@ -6913,6 +8993,8 @@ def __init__( self, **kwargs ): + """ + """ super(Properties, self).__init__(**kwargs) self.service_specification = None @@ -6920,18 +9002,18 @@ def __init__( class Rectangle(msrest.serialization.Model): """Describes the properties of a rectangular window applied to the input media before processing it. - :param left: The number of pixels from the left-margin. This can be absolute pixel value (e.g + :ivar left: The number of pixels from the left-margin. This can be absolute pixel value (e.g 100), or relative to the size of the video (For example, 50%). - :type left: str - :param top: The number of pixels from the top-margin. This can be absolute pixel value (e.g + :vartype left: str + :ivar top: The number of pixels from the top-margin. This can be absolute pixel value (e.g 100), or relative to the size of the video (For example, 50%). - :type top: str - :param width: The width of the rectangular region in pixels. This can be absolute pixel value + :vartype top: str + :ivar width: The width of the rectangular region in pixels. This can be absolute pixel value (e.g 100), or relative to the size of the video (For example, 50%). - :type width: str - :param height: The height of the rectangular region in pixels. This can be absolute pixel value + :vartype width: str + :ivar height: The height of the rectangular region in pixels. This can be absolute pixel value (e.g 100), or relative to the size of the video (For example, 50%). - :type height: str + :vartype height: str """ _attribute_map = { @@ -6950,6 +9032,20 @@ def __init__( height: Optional[str] = None, **kwargs ): + """ + :keyword left: The number of pixels from the left-margin. This can be absolute pixel value (e.g + 100), or relative to the size of the video (For example, 50%). + :paramtype left: str + :keyword top: The number of pixels from the top-margin. This can be absolute pixel value (e.g + 100), or relative to the size of the video (For example, 50%). + :paramtype top: str + :keyword width: The width of the rectangular region in pixels. This can be absolute pixel value + (e.g 100), or relative to the size of the video (For example, 50%). + :paramtype width: str + :keyword height: The height of the rectangular region in pixels. This can be absolute pixel + value (e.g 100), or relative to the size of the video (For example, 50%). + :paramtype height: str + """ super(Rectangle, self).__init__(**kwargs) self.left = left self.top = top @@ -6962,12 +9058,12 @@ class ResourceIdentity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param user_assigned_identity: The user assigned managed identity's ARM ID to use when - accessing a resource. - :type user_assigned_identity: str - :param use_system_assigned_identity: Required. Indicates whether to use System Assigned Managed + :ivar user_assigned_identity: The user assigned managed identity's ARM ID to use when accessing + a resource. + :vartype user_assigned_identity: str + :ivar use_system_assigned_identity: Required. Indicates whether to use System Assigned Managed Identity. Mutual exclusive with User Assigned Managed Identity. - :type use_system_assigned_identity: bool + :vartype use_system_assigned_identity: bool """ _validation = { @@ -6986,6 +9082,14 @@ def __init__( user_assigned_identity: Optional[str] = None, **kwargs ): + """ + :keyword user_assigned_identity: The user assigned managed identity's ARM ID to use when + accessing a resource. + :paramtype user_assigned_identity: str + :keyword use_system_assigned_identity: Required. Indicates whether to use System Assigned + Managed Identity. Mutual exclusive with User Assigned Managed Identity. + :paramtype use_system_assigned_identity: bool + """ super(ResourceIdentity, self).__init__(**kwargs) self.user_assigned_identity = user_assigned_identity self.use_system_assigned_identity = use_system_assigned_identity @@ -6996,22 +9100,22 @@ class SelectAudioTrackByAttribute(AudioTrackDescriptor): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param channel_mapping: Optional designation for single channel audio tracks. Can be used to + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar channel_mapping: Optional designation for single channel audio tracks. Can be used to combine the tracks into stereo or multi-channel audio tracks. Possible values include: "FrontLeft", "FrontRight", "Center", "LowFrequencyEffects", "BackLeft", "BackRight", "StereoLeft", "StereoRight". - :type channel_mapping: str or ~azure.mgmt.media.models.ChannelMapping - :param attribute: Required. The TrackAttribute to filter the tracks by. Possible values - include: "Bitrate", "Language". - :type attribute: str or ~azure.mgmt.media.models.TrackAttribute - :param filter: Required. The type of AttributeFilter to apply to the TrackAttribute in order to + :vartype channel_mapping: str or ~azure.mgmt.media.models.ChannelMapping + :ivar attribute: Required. The TrackAttribute to filter the tracks by. Possible values include: + "Bitrate", "Language". + :vartype attribute: str or ~azure.mgmt.media.models.TrackAttribute + :ivar filter: Required. The type of AttributeFilter to apply to the TrackAttribute in order to select the tracks. Possible values include: "All", "Top", "Bottom", "ValueEquals". - :type filter: str or ~azure.mgmt.media.models.AttributeFilter - :param filter_value: The value to filter the tracks by. Only used when + :vartype filter: str or ~azure.mgmt.media.models.AttributeFilter + :ivar filter_value: The value to filter the tracks by. Only used when AttributeFilter.ValueEquals is specified for the Filter property. - :type filter_value: str + :vartype filter_value: str """ _validation = { @@ -7037,6 +9141,22 @@ def __init__( filter_value: Optional[str] = None, **kwargs ): + """ + :keyword channel_mapping: Optional designation for single channel audio tracks. Can be used to + combine the tracks into stereo or multi-channel audio tracks. Possible values include: + "FrontLeft", "FrontRight", "Center", "LowFrequencyEffects", "BackLeft", "BackRight", + "StereoLeft", "StereoRight". + :paramtype channel_mapping: str or ~azure.mgmt.media.models.ChannelMapping + :keyword attribute: Required. The TrackAttribute to filter the tracks by. Possible values + include: "Bitrate", "Language". + :paramtype attribute: str or ~azure.mgmt.media.models.TrackAttribute + :keyword filter: Required. The type of AttributeFilter to apply to the TrackAttribute in order + to select the tracks. Possible values include: "All", "Top", "Bottom", "ValueEquals". + :paramtype filter: str or ~azure.mgmt.media.models.AttributeFilter + :keyword filter_value: The value to filter the tracks by. Only used when + AttributeFilter.ValueEquals is specified for the Filter property. + :paramtype filter_value: str + """ super(SelectAudioTrackByAttribute, self).__init__(channel_mapping=channel_mapping, **kwargs) self.odata_type = '#Microsoft.Media.SelectAudioTrackByAttribute' # type: str self.attribute = attribute @@ -7049,15 +9169,15 @@ class SelectAudioTrackById(AudioTrackDescriptor): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param channel_mapping: Optional designation for single channel audio tracks. Can be used to + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar channel_mapping: Optional designation for single channel audio tracks. Can be used to combine the tracks into stereo or multi-channel audio tracks. Possible values include: "FrontLeft", "FrontRight", "Center", "LowFrequencyEffects", "BackLeft", "BackRight", "StereoLeft", "StereoRight". - :type channel_mapping: str or ~azure.mgmt.media.models.ChannelMapping - :param track_id: Required. Track identifier to select. - :type track_id: long + :vartype channel_mapping: str or ~azure.mgmt.media.models.ChannelMapping + :ivar track_id: Required. Track identifier to select. + :vartype track_id: long """ _validation = { @@ -7078,6 +9198,15 @@ def __init__( channel_mapping: Optional[Union[str, "ChannelMapping"]] = None, **kwargs ): + """ + :keyword channel_mapping: Optional designation for single channel audio tracks. Can be used to + combine the tracks into stereo or multi-channel audio tracks. Possible values include: + "FrontLeft", "FrontRight", "Center", "LowFrequencyEffects", "BackLeft", "BackRight", + "StereoLeft", "StereoRight". + :paramtype channel_mapping: str or ~azure.mgmt.media.models.ChannelMapping + :keyword track_id: Required. Track identifier to select. + :paramtype track_id: long + """ super(SelectAudioTrackById, self).__init__(channel_mapping=channel_mapping, **kwargs) self.odata_type = '#Microsoft.Media.SelectAudioTrackById' # type: str self.track_id = track_id @@ -7091,8 +9220,8 @@ class VideoTrackDescriptor(TrackDescriptor): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str """ _validation = { @@ -7111,6 +9240,8 @@ def __init__( self, **kwargs ): + """ + """ super(VideoTrackDescriptor, self).__init__(**kwargs) self.odata_type = '#Microsoft.Media.VideoTrackDescriptor' # type: str @@ -7120,19 +9251,19 @@ class SelectVideoTrackByAttribute(VideoTrackDescriptor): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param attribute: Required. The TrackAttribute to filter the tracks by. Possible values - include: "Bitrate", "Language". - :type attribute: str or ~azure.mgmt.media.models.TrackAttribute - :param filter: Required. The type of AttributeFilter to apply to the TrackAttribute in order to + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar attribute: Required. The TrackAttribute to filter the tracks by. Possible values include: + "Bitrate", "Language". + :vartype attribute: str or ~azure.mgmt.media.models.TrackAttribute + :ivar filter: Required. The type of AttributeFilter to apply to the TrackAttribute in order to select the tracks. Possible values include: "All", "Top", "Bottom", "ValueEquals". - :type filter: str or ~azure.mgmt.media.models.AttributeFilter - :param filter_value: The value to filter the tracks by. Only used when + :vartype filter: str or ~azure.mgmt.media.models.AttributeFilter + :ivar filter_value: The value to filter the tracks by. Only used when AttributeFilter.ValueEquals is specified for the Filter property. For TrackAttribute.Bitrate, this should be an integer value in bits per second (e.g: '1500000'). The TrackAttribute.Language is not supported for video tracks. - :type filter_value: str + :vartype filter_value: str """ _validation = { @@ -7156,6 +9287,19 @@ def __init__( filter_value: Optional[str] = None, **kwargs ): + """ + :keyword attribute: Required. The TrackAttribute to filter the tracks by. Possible values + include: "Bitrate", "Language". + :paramtype attribute: str or ~azure.mgmt.media.models.TrackAttribute + :keyword filter: Required. The type of AttributeFilter to apply to the TrackAttribute in order + to select the tracks. Possible values include: "All", "Top", "Bottom", "ValueEquals". + :paramtype filter: str or ~azure.mgmt.media.models.AttributeFilter + :keyword filter_value: The value to filter the tracks by. Only used when + AttributeFilter.ValueEquals is specified for the Filter property. For TrackAttribute.Bitrate, + this should be an integer value in bits per second (e.g: '1500000'). The + TrackAttribute.Language is not supported for video tracks. + :paramtype filter_value: str + """ super(SelectVideoTrackByAttribute, self).__init__(**kwargs) self.odata_type = '#Microsoft.Media.SelectVideoTrackByAttribute' # type: str self.attribute = attribute @@ -7168,10 +9312,10 @@ class SelectVideoTrackById(VideoTrackDescriptor): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param track_id: Required. Track identifier to select. - :type track_id: long + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar track_id: Required. Track identifier to select. + :vartype track_id: long """ _validation = { @@ -7190,6 +9334,10 @@ def __init__( track_id: int, **kwargs ): + """ + :keyword track_id: Required. Track identifier to select. + :paramtype track_id: long + """ super(SelectVideoTrackById, self).__init__(**kwargs) self.odata_type = '#Microsoft.Media.SelectVideoTrackById' # type: str self.track_id = track_id @@ -7220,6 +9368,8 @@ def __init__( self, **kwargs ): + """ + """ super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = None self.metric_specifications = None @@ -7230,15 +9380,15 @@ class StandardEncoderPreset(Preset): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param filters: One or more filtering operations that are applied to the input media before + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar filters: One or more filtering operations that are applied to the input media before encoding. - :type filters: ~azure.mgmt.media.models.Filters - :param codecs: Required. The list of codecs to be used when encoding the input video. - :type codecs: list[~azure.mgmt.media.models.Codec] - :param formats: Required. The list of outputs to be produced by the encoder. - :type formats: list[~azure.mgmt.media.models.Format] + :vartype filters: ~azure.mgmt.media.models.Filters + :ivar codecs: Required. The list of codecs to be used when encoding the input video. + :vartype codecs: list[~azure.mgmt.media.models.Codec] + :ivar formats: Required. The list of outputs to be produced by the encoder. + :vartype formats: list[~azure.mgmt.media.models.Format] """ _validation = { @@ -7262,6 +9412,15 @@ def __init__( filters: Optional["Filters"] = None, **kwargs ): + """ + :keyword filters: One or more filtering operations that are applied to the input media before + encoding. + :paramtype filters: ~azure.mgmt.media.models.Filters + :keyword codecs: Required. The list of codecs to be used when encoding the input video. + :paramtype codecs: list[~azure.mgmt.media.models.Codec] + :keyword formats: Required. The list of outputs to be produced by the encoder. + :paramtype formats: list[~azure.mgmt.media.models.Format] + """ super(StandardEncoderPreset, self).__init__(**kwargs) self.odata_type = '#Microsoft.Media.StandardEncoderPreset' # type: str self.filters = filters @@ -7276,16 +9435,16 @@ class StorageAccount(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: The ID of the storage account resource. Media Services relies on tables and queues - as well as blobs, so the primary storage account must be a Standard Storage account (either + :ivar id: The ID of the storage account resource. Media Services relies on tables and queues as + well as blobs, so the primary storage account must be a Standard Storage account (either Microsoft.ClassicStorage or Microsoft.Storage). Blob only storage accounts can be added as secondary storage accounts. - :type id: str - :param type: Required. The type of the storage account. Possible values include: "Primary", + :vartype id: str + :ivar type: Required. The type of the storage account. Possible values include: "Primary", "Secondary". - :type type: str or ~azure.mgmt.media.models.StorageAccountType - :param identity: The storage account identity. - :type identity: ~azure.mgmt.media.models.ResourceIdentity + :vartype type: str or ~azure.mgmt.media.models.StorageAccountType + :ivar identity: The storage account identity. + :vartype identity: ~azure.mgmt.media.models.ResourceIdentity :ivar status: The current status of the storage account mapping. :vartype status: str """ @@ -7310,6 +9469,18 @@ def __init__( identity: Optional["ResourceIdentity"] = None, **kwargs ): + """ + :keyword id: The ID of the storage account resource. Media Services relies on tables and queues + as well as blobs, so the primary storage account must be a Standard Storage account (either + Microsoft.ClassicStorage or Microsoft.Storage). Blob only storage accounts can be added as + secondary storage accounts. + :paramtype id: str + :keyword type: Required. The type of the storage account. Possible values include: "Primary", + "Secondary". + :paramtype type: str or ~azure.mgmt.media.models.StorageAccountType + :keyword identity: The storage account identity. + :paramtype identity: ~azure.mgmt.media.models.ResourceIdentity + """ super(StorageAccount, self).__init__(**kwargs) self.id = id self.type = type @@ -7320,10 +9491,10 @@ def __init__( class StorageEncryptedAssetDecryptionData(msrest.serialization.Model): """Data needed to decrypt asset files encrypted with legacy storage encryption. - :param key: The Asset File storage encryption key. - :type key: bytearray - :param asset_file_encryption_metadata: Asset File encryption metadata. - :type asset_file_encryption_metadata: + :ivar key: The Asset File storage encryption key. + :vartype key: bytearray + :ivar asset_file_encryption_metadata: Asset File encryption metadata. + :vartype asset_file_encryption_metadata: list[~azure.mgmt.media.models.AssetFileEncryptionMetadata] """ @@ -7339,6 +9510,13 @@ def __init__( asset_file_encryption_metadata: Optional[List["AssetFileEncryptionMetadata"]] = None, **kwargs ): + """ + :keyword key: The Asset File storage encryption key. + :paramtype key: bytearray + :keyword asset_file_encryption_metadata: Asset File encryption metadata. + :paramtype asset_file_encryption_metadata: + list[~azure.mgmt.media.models.AssetFileEncryptionMetadata] + """ super(StorageEncryptedAssetDecryptionData, self).__init__(**kwargs) self.key = key self.asset_file_encryption_metadata = asset_file_encryption_metadata @@ -7359,39 +9537,41 @@ class StreamingEndpoint(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :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 + :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 system_data: The system metadata relating to this resource. :vartype system_data: ~azure.mgmt.media.models.SystemData - :param description: The streaming endpoint description. - :type description: str - :param scale_units: The number of scale units. Use the Scale operation to adjust this value. - :type scale_units: int - :param availability_set_name: This feature is deprecated, do not set a value for this property. - :type availability_set_name: str - :param access_control: The access control definition of the streaming endpoint. - :type access_control: ~azure.mgmt.media.models.StreamingEndpointAccessControl - :param max_cache_age: Max cache age. - :type max_cache_age: long - :param custom_host_names: The custom host names of the streaming endpoint. - :type custom_host_names: list[str] + :ivar sku: The streaming endpoint sku. + :vartype sku: ~azure.mgmt.media.models.ArmStreamingEndpointCurrentSku + :ivar description: The streaming endpoint description. + :vartype description: str + :ivar scale_units: The number of scale units. Use the Scale operation to adjust this value. + :vartype scale_units: int + :ivar availability_set_name: This feature is deprecated, do not set a value for this property. + :vartype availability_set_name: str + :ivar access_control: The access control definition of the streaming endpoint. + :vartype access_control: ~azure.mgmt.media.models.StreamingEndpointAccessControl + :ivar max_cache_age: Max cache age. + :vartype max_cache_age: long + :ivar custom_host_names: The custom host names of the streaming endpoint. + :vartype custom_host_names: list[str] :ivar host_name: The streaming endpoint host name. :vartype host_name: str - :param cdn_enabled: The CDN enabled flag. - :type cdn_enabled: bool - :param cdn_provider: The CDN provider name. - :type cdn_provider: str - :param cdn_profile: The CDN profile name. - :type cdn_profile: str + :ivar cdn_enabled: The CDN enabled flag. + :vartype cdn_enabled: bool + :ivar cdn_provider: The CDN provider name. + :vartype cdn_provider: str + :ivar cdn_profile: The CDN profile name. + :vartype cdn_profile: str :ivar provisioning_state: The provisioning state of the streaming endpoint. :vartype provisioning_state: str :ivar resource_state: The resource state of the streaming endpoint. Possible values include: "Stopped", "Starting", "Running", "Stopping", "Deleting", "Scaling". :vartype resource_state: str or ~azure.mgmt.media.models.StreamingEndpointResourceState - :param cross_site_access_policies: The streaming endpoint access policies. - :type cross_site_access_policies: ~azure.mgmt.media.models.CrossSiteAccessPolicies + :ivar cross_site_access_policies: The streaming endpoint access policies. + :vartype cross_site_access_policies: ~azure.mgmt.media.models.CrossSiteAccessPolicies :ivar free_trial_end_time: The free trial expiration time. :vartype free_trial_end_time: ~datetime.datetime :ivar created: The exact time the streaming endpoint was created. @@ -7421,6 +9601,7 @@ class StreamingEndpoint(TrackedResource): 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'sku': {'key': 'sku', 'type': 'ArmStreamingEndpointCurrentSku'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'scale_units': {'key': 'properties.scaleUnits', 'type': 'int'}, 'availability_set_name': {'key': 'properties.availabilitySetName', 'type': 'str'}, @@ -7444,6 +9625,7 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, + sku: Optional["ArmStreamingEndpointCurrentSku"] = None, description: Optional[str] = None, scale_units: Optional[int] = None, availability_set_name: Optional[str] = None, @@ -7456,8 +9638,38 @@ def __init__( cross_site_access_policies: Optional["CrossSiteAccessPolicies"] = 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 sku: The streaming endpoint sku. + :paramtype sku: ~azure.mgmt.media.models.ArmStreamingEndpointCurrentSku + :keyword description: The streaming endpoint description. + :paramtype description: str + :keyword scale_units: The number of scale units. Use the Scale operation to adjust this value. + :paramtype scale_units: int + :keyword availability_set_name: This feature is deprecated, do not set a value for this + property. + :paramtype availability_set_name: str + :keyword access_control: The access control definition of the streaming endpoint. + :paramtype access_control: ~azure.mgmt.media.models.StreamingEndpointAccessControl + :keyword max_cache_age: Max cache age. + :paramtype max_cache_age: long + :keyword custom_host_names: The custom host names of the streaming endpoint. + :paramtype custom_host_names: list[str] + :keyword cdn_enabled: The CDN enabled flag. + :paramtype cdn_enabled: bool + :keyword cdn_provider: The CDN provider name. + :paramtype cdn_provider: str + :keyword cdn_profile: The CDN profile name. + :paramtype cdn_profile: str + :keyword cross_site_access_policies: The streaming endpoint access policies. + :paramtype cross_site_access_policies: ~azure.mgmt.media.models.CrossSiteAccessPolicies + """ super(StreamingEndpoint, self).__init__(tags=tags, location=location, **kwargs) self.system_data = None + self.sku = sku self.description = description self.scale_units = scale_units self.availability_set_name = availability_set_name @@ -7479,10 +9691,10 @@ def __init__( class StreamingEndpointAccessControl(msrest.serialization.Model): """Streaming endpoint access control definition. - :param akamai: The access control of Akamai. - :type akamai: ~azure.mgmt.media.models.AkamaiAccessControl - :param ip: The IP access control of the streaming endpoint. - :type ip: ~azure.mgmt.media.models.IPAccessControl + :ivar akamai: The access control of Akamai. + :vartype akamai: ~azure.mgmt.media.models.AkamaiAccessControl + :ivar ip: The IP access control of the streaming endpoint. + :vartype ip: ~azure.mgmt.media.models.IPAccessControl """ _attribute_map = { @@ -7497,6 +9709,12 @@ def __init__( ip: Optional["IPAccessControl"] = None, **kwargs ): + """ + :keyword akamai: The access control of Akamai. + :paramtype akamai: ~azure.mgmt.media.models.AkamaiAccessControl + :keyword ip: The IP access control of the streaming endpoint. + :paramtype ip: ~azure.mgmt.media.models.IPAccessControl + """ super(StreamingEndpointAccessControl, self).__init__(**kwargs) self.akamai = akamai self.ip = ip @@ -7505,13 +9723,13 @@ def __init__( class StreamingEndpointListResult(msrest.serialization.Model): """The streaming endpoint list result. - :param value: The result of the List StreamingEndpoint operation. - :type value: list[~azure.mgmt.media.models.StreamingEndpoint] - :param odata_count: The number of result. - :type odata_count: int - :param odata_next_link: The link to the next set of results. Not empty if value contains + :ivar value: The result of the List StreamingEndpoint operation. + :vartype value: list[~azure.mgmt.media.models.StreamingEndpoint] + :ivar odata_count: The number of result. + :vartype odata_count: int + :ivar odata_next_link: The link to the next set of results. Not empty if value contains incomplete list of streaming endpoints. - :type odata_next_link: str + :vartype odata_next_link: str """ _attribute_map = { @@ -7528,17 +9746,51 @@ def __init__( odata_next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The result of the List StreamingEndpoint operation. + :paramtype value: list[~azure.mgmt.media.models.StreamingEndpoint] + :keyword odata_count: The number of result. + :paramtype odata_count: int + :keyword odata_next_link: The link to the next set of results. Not empty if value contains + incomplete list of streaming endpoints. + :paramtype odata_next_link: str + """ super(StreamingEndpointListResult, self).__init__(**kwargs) self.value = value self.odata_count = odata_count self.odata_next_link = odata_next_link +class StreamingEndpointSkuInfoListResult(msrest.serialization.Model): + """StreamingEndpointSkuInfoListResult. + + :ivar value: The result of the List StreamingEndpoint skus. + :vartype value: list[~azure.mgmt.media.models.ArmStreamingEndpointSkuInfo] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ArmStreamingEndpointSkuInfo]'}, + } + + def __init__( + self, + *, + value: Optional[List["ArmStreamingEndpointSkuInfo"]] = None, + **kwargs + ): + """ + :keyword value: The result of the List StreamingEndpoint skus. + :paramtype value: list[~azure.mgmt.media.models.ArmStreamingEndpointSkuInfo] + """ + super(StreamingEndpointSkuInfoListResult, self).__init__(**kwargs) + self.value = value + + class StreamingEntityScaleUnit(msrest.serialization.Model): """scale units definition. - :param scale_unit: The scale unit number of the streaming endpoint. - :type scale_unit: int + :ivar scale_unit: The scale unit number of the streaming endpoint. + :vartype scale_unit: int """ _attribute_map = { @@ -7551,6 +9803,10 @@ def __init__( scale_unit: Optional[int] = None, **kwargs ): + """ + :keyword scale_unit: The scale unit number of the streaming endpoint. + :paramtype scale_unit: int + """ super(StreamingEntityScaleUnit, self).__init__(**kwargs) self.scale_unit = scale_unit @@ -7570,31 +9826,31 @@ class StreamingLocator(ProxyResource): :vartype type: str :ivar system_data: The system metadata relating to this resource. :vartype system_data: ~azure.mgmt.media.models.SystemData - :param asset_name: Asset Name. - :type asset_name: str + :ivar asset_name: Asset Name. + :vartype asset_name: str :ivar created: The creation time of the Streaming Locator. :vartype created: ~datetime.datetime - :param start_time: The start time of the Streaming Locator. - :type start_time: ~datetime.datetime - :param end_time: The end time of the Streaming Locator. - :type end_time: ~datetime.datetime - :param streaming_locator_id: The StreamingLocatorId of the Streaming Locator. - :type streaming_locator_id: str - :param streaming_policy_name: Name of the Streaming Policy used by this Streaming Locator. + :ivar start_time: The start time of the Streaming Locator. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time of the Streaming Locator. + :vartype end_time: ~datetime.datetime + :ivar streaming_locator_id: The StreamingLocatorId of the Streaming Locator. + :vartype streaming_locator_id: str + :ivar streaming_policy_name: Name of the Streaming Policy used by this Streaming Locator. Either specify the name of Streaming Policy you created or use one of the predefined Streaming Policies. The predefined Streaming Policies available are: 'Predefined_DownloadOnly', 'Predefined_ClearStreamingOnly', 'Predefined_DownloadAndClearStreaming', 'Predefined_ClearKey', 'Predefined_MultiDrmCencStreaming' and 'Predefined_MultiDrmStreaming'. - :type streaming_policy_name: str - :param default_content_key_policy_name: Name of the default ContentKeyPolicy used by this + :vartype streaming_policy_name: str + :ivar default_content_key_policy_name: Name of the default ContentKeyPolicy used by this Streaming Locator. - :type default_content_key_policy_name: str - :param content_keys: The ContentKeys used by this Streaming Locator. - :type content_keys: list[~azure.mgmt.media.models.StreamingLocatorContentKey] - :param alternative_media_id: Alternative Media ID of this Streaming Locator. - :type alternative_media_id: str - :param filters: A list of asset or account filters which apply to this streaming locator. - :type filters: list[str] + :vartype default_content_key_policy_name: str + :ivar content_keys: The ContentKeys used by this Streaming Locator. + :vartype content_keys: list[~azure.mgmt.media.models.StreamingLocatorContentKey] + :ivar alternative_media_id: Alternative Media ID of this Streaming Locator. + :vartype alternative_media_id: str + :ivar filters: A list of asset or account filters which apply to this streaming locator. + :vartype filters: list[str] """ _validation = { @@ -7636,6 +9892,31 @@ def __init__( filters: Optional[List[str]] = None, **kwargs ): + """ + :keyword asset_name: Asset Name. + :paramtype asset_name: str + :keyword start_time: The start time of the Streaming Locator. + :paramtype start_time: ~datetime.datetime + :keyword end_time: The end time of the Streaming Locator. + :paramtype end_time: ~datetime.datetime + :keyword streaming_locator_id: The StreamingLocatorId of the Streaming Locator. + :paramtype streaming_locator_id: str + :keyword streaming_policy_name: Name of the Streaming Policy used by this Streaming Locator. + Either specify the name of Streaming Policy you created or use one of the predefined Streaming + Policies. The predefined Streaming Policies available are: 'Predefined_DownloadOnly', + 'Predefined_ClearStreamingOnly', 'Predefined_DownloadAndClearStreaming', 'Predefined_ClearKey', + 'Predefined_MultiDrmCencStreaming' and 'Predefined_MultiDrmStreaming'. + :paramtype streaming_policy_name: str + :keyword default_content_key_policy_name: Name of the default ContentKeyPolicy used by this + Streaming Locator. + :paramtype default_content_key_policy_name: str + :keyword content_keys: The ContentKeys used by this Streaming Locator. + :paramtype content_keys: list[~azure.mgmt.media.models.StreamingLocatorContentKey] + :keyword alternative_media_id: Alternative Media ID of this Streaming Locator. + :paramtype alternative_media_id: str + :keyword filters: A list of asset or account filters which apply to this streaming locator. + :paramtype filters: list[str] + """ super(StreamingLocator, self).__init__(**kwargs) self.system_data = None self.asset_name = asset_name @@ -7653,11 +9934,11 @@ def __init__( class StreamingLocatorCollection(msrest.serialization.Model): """A collection of StreamingLocator items. - :param value: A collection of StreamingLocator items. - :type value: list[~azure.mgmt.media.models.StreamingLocator] - :param odata_next_link: A link to the next page of the collection (when the collection contains + :ivar value: A collection of StreamingLocator items. + :vartype value: list[~azure.mgmt.media.models.StreamingLocator] + :ivar odata_next_link: A link to the next page of the collection (when the collection contains too many results to return in one response). - :type odata_next_link: str + :vartype odata_next_link: str """ _attribute_map = { @@ -7672,6 +9953,13 @@ def __init__( odata_next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: A collection of StreamingLocator items. + :paramtype value: list[~azure.mgmt.media.models.StreamingLocator] + :keyword odata_next_link: A link to the next page of the collection (when the collection + contains too many results to return in one response). + :paramtype odata_next_link: str + """ super(StreamingLocatorCollection, self).__init__(**kwargs) self.value = value self.odata_next_link = odata_next_link @@ -7684,16 +9972,16 @@ class StreamingLocatorContentKey(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. ID of Content Key. - :type id: str + :ivar id: Required. ID of Content Key. + :vartype id: str :ivar type: Encryption type of Content Key. Possible values include: "CommonEncryptionCenc", "CommonEncryptionCbcs", "EnvelopeEncryption". :vartype type: str or ~azure.mgmt.media.models.StreamingLocatorContentKeyType - :param label_reference_in_streaming_policy: Label of Content Key as specified in the Streaming + :ivar label_reference_in_streaming_policy: Label of Content Key as specified in the Streaming Policy. - :type label_reference_in_streaming_policy: str - :param value: Value of Content Key. - :type value: str + :vartype label_reference_in_streaming_policy: str + :ivar value: Value of Content Key. + :vartype value: str :ivar policy_name: ContentKeyPolicy used by Content Key. :vartype policy_name: str :ivar tracks: Tracks which use this Content Key. @@ -7724,6 +10012,15 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword id: Required. ID of Content Key. + :paramtype id: str + :keyword label_reference_in_streaming_policy: Label of Content Key as specified in the + Streaming Policy. + :paramtype label_reference_in_streaming_policy: str + :keyword value: Value of Content Key. + :paramtype value: str + """ super(StreamingLocatorContentKey, self).__init__(**kwargs) self.id = id self.type = None @@ -7738,14 +10035,14 @@ class StreamingPath(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param streaming_protocol: Required. Streaming protocol. Possible values include: "Hls", - "Dash", "SmoothStreaming", "Download". - :type streaming_protocol: str or ~azure.mgmt.media.models.StreamingPolicyStreamingProtocol - :param encryption_scheme: Required. Encryption scheme. Possible values include: "NoEncryption", + :ivar streaming_protocol: Required. Streaming protocol. Possible values include: "Hls", "Dash", + "SmoothStreaming", "Download". + :vartype streaming_protocol: str or ~azure.mgmt.media.models.StreamingPolicyStreamingProtocol + :ivar encryption_scheme: Required. Encryption scheme. Possible values include: "NoEncryption", "EnvelopeEncryption", "CommonEncryptionCenc", "CommonEncryptionCbcs". - :type encryption_scheme: str or ~azure.mgmt.media.models.EncryptionScheme - :param paths: Streaming paths for each protocol and encryptionScheme pair. - :type paths: list[str] + :vartype encryption_scheme: str or ~azure.mgmt.media.models.EncryptionScheme + :ivar paths: Streaming paths for each protocol and encryptionScheme pair. + :vartype paths: list[str] """ _validation = { @@ -7767,6 +10064,16 @@ def __init__( paths: Optional[List[str]] = None, **kwargs ): + """ + :keyword streaming_protocol: Required. Streaming protocol. Possible values include: "Hls", + "Dash", "SmoothStreaming", "Download". + :paramtype streaming_protocol: str or ~azure.mgmt.media.models.StreamingPolicyStreamingProtocol + :keyword encryption_scheme: Required. Encryption scheme. Possible values include: + "NoEncryption", "EnvelopeEncryption", "CommonEncryptionCenc", "CommonEncryptionCbcs". + :paramtype encryption_scheme: str or ~azure.mgmt.media.models.EncryptionScheme + :keyword paths: Streaming paths for each protocol and encryptionScheme pair. + :paramtype paths: list[str] + """ super(StreamingPath, self).__init__(**kwargs) self.streaming_protocol = streaming_protocol self.encryption_scheme = encryption_scheme @@ -7790,16 +10097,16 @@ class StreamingPolicy(ProxyResource): :vartype system_data: ~azure.mgmt.media.models.SystemData :ivar created: Creation time of Streaming Policy. :vartype created: ~datetime.datetime - :param default_content_key_policy_name: Default ContentKey used by current Streaming Policy. - :type default_content_key_policy_name: str - :param envelope_encryption: Configuration of EnvelopeEncryption. - :type envelope_encryption: ~azure.mgmt.media.models.EnvelopeEncryption - :param common_encryption_cenc: Configuration of CommonEncryptionCenc. - :type common_encryption_cenc: ~azure.mgmt.media.models.CommonEncryptionCenc - :param common_encryption_cbcs: Configuration of CommonEncryptionCbcs. - :type common_encryption_cbcs: ~azure.mgmt.media.models.CommonEncryptionCbcs - :param no_encryption: Configurations of NoEncryption. - :type no_encryption: ~azure.mgmt.media.models.NoEncryption + :ivar default_content_key_policy_name: Default ContentKey used by current Streaming Policy. + :vartype default_content_key_policy_name: str + :ivar envelope_encryption: Configuration of EnvelopeEncryption. + :vartype envelope_encryption: ~azure.mgmt.media.models.EnvelopeEncryption + :ivar common_encryption_cenc: Configuration of CommonEncryptionCenc. + :vartype common_encryption_cenc: ~azure.mgmt.media.models.CommonEncryptionCenc + :ivar common_encryption_cbcs: Configuration of CommonEncryptionCbcs. + :vartype common_encryption_cbcs: ~azure.mgmt.media.models.CommonEncryptionCbcs + :ivar no_encryption: Configurations of NoEncryption. + :vartype no_encryption: ~azure.mgmt.media.models.NoEncryption """ _validation = { @@ -7833,6 +10140,18 @@ def __init__( no_encryption: Optional["NoEncryption"] = None, **kwargs ): + """ + :keyword default_content_key_policy_name: Default ContentKey used by current Streaming Policy. + :paramtype default_content_key_policy_name: str + :keyword envelope_encryption: Configuration of EnvelopeEncryption. + :paramtype envelope_encryption: ~azure.mgmt.media.models.EnvelopeEncryption + :keyword common_encryption_cenc: Configuration of CommonEncryptionCenc. + :paramtype common_encryption_cenc: ~azure.mgmt.media.models.CommonEncryptionCenc + :keyword common_encryption_cbcs: Configuration of CommonEncryptionCbcs. + :paramtype common_encryption_cbcs: ~azure.mgmt.media.models.CommonEncryptionCbcs + :keyword no_encryption: Configurations of NoEncryption. + :paramtype no_encryption: ~azure.mgmt.media.models.NoEncryption + """ super(StreamingPolicy, self).__init__(**kwargs) self.system_data = None self.created = None @@ -7846,11 +10165,11 @@ def __init__( class StreamingPolicyCollection(msrest.serialization.Model): """A collection of StreamingPolicy items. - :param value: A collection of StreamingPolicy items. - :type value: list[~azure.mgmt.media.models.StreamingPolicy] - :param odata_next_link: A link to the next page of the collection (when the collection contains + :ivar value: A collection of StreamingPolicy items. + :vartype value: list[~azure.mgmt.media.models.StreamingPolicy] + :ivar odata_next_link: A link to the next page of the collection (when the collection contains too many results to return in one response). - :type odata_next_link: str + :vartype odata_next_link: str """ _attribute_map = { @@ -7865,6 +10184,13 @@ def __init__( odata_next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: A collection of StreamingPolicy items. + :paramtype value: list[~azure.mgmt.media.models.StreamingPolicy] + :keyword odata_next_link: A link to the next page of the collection (when the collection + contains too many results to return in one response). + :paramtype odata_next_link: str + """ super(StreamingPolicyCollection, self).__init__(**kwargs) self.value = value self.odata_next_link = odata_next_link @@ -7873,12 +10199,12 @@ def __init__( class StreamingPolicyContentKey(msrest.serialization.Model): """Class to specify properties of content key. - :param label: Label can be used to specify Content Key when creating a Streaming Locator. - :type label: str - :param policy_name: Policy used by Content Key. - :type policy_name: str - :param tracks: Tracks which use this content key. - :type tracks: list[~azure.mgmt.media.models.TrackSelection] + :ivar label: Label can be used to specify Content Key when creating a Streaming Locator. + :vartype label: str + :ivar policy_name: Policy used by Content Key. + :vartype policy_name: str + :ivar tracks: Tracks which use this content key. + :vartype tracks: list[~azure.mgmt.media.models.TrackSelection] """ _attribute_map = { @@ -7895,6 +10221,14 @@ def __init__( tracks: Optional[List["TrackSelection"]] = None, **kwargs ): + """ + :keyword label: Label can be used to specify Content Key when creating a Streaming Locator. + :paramtype label: str + :keyword policy_name: Policy used by Content Key. + :paramtype policy_name: str + :keyword tracks: Tracks which use this content key. + :paramtype tracks: list[~azure.mgmt.media.models.TrackSelection] + """ super(StreamingPolicyContentKey, self).__init__(**kwargs) self.label = label self.policy_name = policy_name @@ -7904,10 +10238,10 @@ def __init__( class StreamingPolicyContentKeys(msrest.serialization.Model): """Class to specify properties of all content keys in Streaming Policy. - :param default_key: Default content key for an encryption scheme. - :type default_key: ~azure.mgmt.media.models.DefaultKey - :param key_to_track_mappings: Representing tracks needs separate content key. - :type key_to_track_mappings: list[~azure.mgmt.media.models.StreamingPolicyContentKey] + :ivar default_key: Default content key for an encryption scheme. + :vartype default_key: ~azure.mgmt.media.models.DefaultKey + :ivar key_to_track_mappings: Representing tracks needs separate content key. + :vartype key_to_track_mappings: list[~azure.mgmt.media.models.StreamingPolicyContentKey] """ _attribute_map = { @@ -7922,6 +10256,12 @@ def __init__( key_to_track_mappings: Optional[List["StreamingPolicyContentKey"]] = None, **kwargs ): + """ + :keyword default_key: Default content key for an encryption scheme. + :paramtype default_key: ~azure.mgmt.media.models.DefaultKey + :keyword key_to_track_mappings: Representing tracks needs separate content key. + :paramtype key_to_track_mappings: list[~azure.mgmt.media.models.StreamingPolicyContentKey] + """ super(StreamingPolicyContentKeys, self).__init__(**kwargs) self.default_key = default_key self.key_to_track_mappings = key_to_track_mappings @@ -7932,16 +10272,16 @@ class StreamingPolicyFairPlayConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param custom_license_acquisition_url_template: Template for the URL of the custom service + :ivar custom_license_acquisition_url_template: Template for the URL of the custom service delivering licenses to end user players. Not required when using Azure Media Services for issuing licenses. The template supports replaceable tokens that the service will update at runtime with the value specific to the request. The currently supported token values are {AlternativeMediaId}, which is replaced with the value of StreamingLocatorId.AlternativeMediaId, and {ContentKeyId}, which is replaced with the value of identifier of the key being requested. - :type custom_license_acquisition_url_template: str - :param allow_persistent_license: Required. All license to be persistent or not. - :type allow_persistent_license: bool + :vartype custom_license_acquisition_url_template: str + :ivar allow_persistent_license: Required. All license to be persistent or not. + :vartype allow_persistent_license: bool """ _validation = { @@ -7960,6 +10300,18 @@ def __init__( custom_license_acquisition_url_template: Optional[str] = None, **kwargs ): + """ + :keyword custom_license_acquisition_url_template: Template for the URL of the custom service + delivering licenses to end user players. Not required when using Azure Media Services for + issuing licenses. The template supports replaceable tokens that the service will update at + runtime with the value specific to the request. The currently supported token values are + {AlternativeMediaId}, which is replaced with the value of + StreamingLocatorId.AlternativeMediaId, and {ContentKeyId}, which is replaced with the value of + identifier of the key being requested. + :paramtype custom_license_acquisition_url_template: str + :keyword allow_persistent_license: Required. All license to be persistent or not. + :paramtype allow_persistent_license: bool + """ super(StreamingPolicyFairPlayConfiguration, self).__init__(**kwargs) self.custom_license_acquisition_url_template = custom_license_acquisition_url_template self.allow_persistent_license = allow_persistent_license @@ -7968,16 +10320,16 @@ def __init__( class StreamingPolicyPlayReadyConfiguration(msrest.serialization.Model): """Class to specify configurations of PlayReady in Streaming Policy. - :param custom_license_acquisition_url_template: Template for the URL of the custom service + :ivar custom_license_acquisition_url_template: Template for the URL of the custom service delivering licenses to end user players. Not required when using Azure Media Services for issuing licenses. The template supports replaceable tokens that the service will update at runtime with the value specific to the request. The currently supported token values are {AlternativeMediaId}, which is replaced with the value of StreamingLocatorId.AlternativeMediaId, and {ContentKeyId}, which is replaced with the value of identifier of the key being requested. - :type custom_license_acquisition_url_template: str - :param play_ready_custom_attributes: Custom attributes for PlayReady. - :type play_ready_custom_attributes: str + :vartype custom_license_acquisition_url_template: str + :ivar play_ready_custom_attributes: Custom attributes for PlayReady. + :vartype play_ready_custom_attributes: str """ _attribute_map = { @@ -7992,6 +10344,18 @@ def __init__( play_ready_custom_attributes: Optional[str] = None, **kwargs ): + """ + :keyword custom_license_acquisition_url_template: Template for the URL of the custom service + delivering licenses to end user players. Not required when using Azure Media Services for + issuing licenses. The template supports replaceable tokens that the service will update at + runtime with the value specific to the request. The currently supported token values are + {AlternativeMediaId}, which is replaced with the value of + StreamingLocatorId.AlternativeMediaId, and {ContentKeyId}, which is replaced with the value of + identifier of the key being requested. + :paramtype custom_license_acquisition_url_template: str + :keyword play_ready_custom_attributes: Custom attributes for PlayReady. + :paramtype play_ready_custom_attributes: str + """ super(StreamingPolicyPlayReadyConfiguration, self).__init__(**kwargs) self.custom_license_acquisition_url_template = custom_license_acquisition_url_template self.play_ready_custom_attributes = play_ready_custom_attributes @@ -8000,14 +10364,14 @@ def __init__( class StreamingPolicyWidevineConfiguration(msrest.serialization.Model): """Class to specify configurations of Widevine in Streaming Policy. - :param custom_license_acquisition_url_template: Template for the URL of the custom service + :ivar custom_license_acquisition_url_template: Template for the URL of the custom service delivering licenses to end user players. Not required when using Azure Media Services for issuing licenses. The template supports replaceable tokens that the service will update at runtime with the value specific to the request. The currently supported token values are {AlternativeMediaId}, which is replaced with the value of StreamingLocatorId.AlternativeMediaId, and {ContentKeyId}, which is replaced with the value of identifier of the key being requested. - :type custom_license_acquisition_url_template: str + :vartype custom_license_acquisition_url_template: str """ _attribute_map = { @@ -8020,6 +10384,16 @@ def __init__( custom_license_acquisition_url_template: Optional[str] = None, **kwargs ): + """ + :keyword custom_license_acquisition_url_template: Template for the URL of the custom service + delivering licenses to end user players. Not required when using Azure Media Services for + issuing licenses. The template supports replaceable tokens that the service will update at + runtime with the value specific to the request. The currently supported token values are + {AlternativeMediaId}, which is replaced with the value of + StreamingLocatorId.AlternativeMediaId, and {ContentKeyId}, which is replaced with the value of + identifier of the key being requested. + :paramtype custom_license_acquisition_url_template: str + """ super(StreamingPolicyWidevineConfiguration, self).__init__(**kwargs) self.custom_license_acquisition_url_template = custom_license_acquisition_url_template @@ -8027,8 +10401,8 @@ def __init__( class SyncStorageKeysInput(msrest.serialization.Model): """The input to the sync storage keys request. - :param id: The ID of the storage account resource. - :type id: str + :ivar id: The ID of the storage account resource. + :vartype id: str """ _attribute_map = { @@ -8041,6 +10415,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The ID of the storage account resource. + :paramtype id: str + """ super(SyncStorageKeysInput, self).__init__(**kwargs) self.id = id @@ -8048,20 +10426,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 ~azure.mgmt.media.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 ~azure.mgmt.media.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 ~azure.mgmt.media.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 ~azure.mgmt.media.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -8084,6 +10462,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 ~azure.mgmt.media.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 ~azure.mgmt.media.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 @@ -8093,18 +10487,91 @@ def __init__( self.last_modified_at = last_modified_at +class TextTrack(TrackBase): + """Represents a text track in an asset. A text track is usually used for sparse data related to the audio or video tracks. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar file_name: The file name to the source file. This file is located in the storage + container of the asset. + :vartype file_name: str + :ivar display_name: The display name of the text track on a video player. In HLS, this maps to + the NAME attribute of EXT-X-MEDIA. + :vartype display_name: str + :ivar language_code: The RFC5646 language code for the text track. + :vartype language_code: str + :ivar player_visibility: When PlayerVisibility is set to "Visible", the text track will be + present in the DASH manifest or HLS playlist when requested by a client. When the + PlayerVisibility is set to "Hidden", the text will not be available to the client. The default + value is "Visible". Possible values include: "Hidden", "Visible". + :vartype player_visibility: str or ~azure.mgmt.media.models.Visibility + :ivar hls_settings: The HLS specific setting for the text track. + :vartype hls_settings: ~azure.mgmt.media.models.HlsSettings + """ + + _validation = { + 'odata_type': {'required': True}, + 'language_code': {'readonly': True}, + } + + _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, + 'file_name': {'key': 'fileName', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'language_code': {'key': 'languageCode', 'type': 'str'}, + 'player_visibility': {'key': 'playerVisibility', 'type': 'str'}, + 'hls_settings': {'key': 'hlsSettings', 'type': 'HlsSettings'}, + } + + def __init__( + self, + *, + file_name: Optional[str] = None, + display_name: Optional[str] = None, + player_visibility: Optional[Union[str, "Visibility"]] = None, + hls_settings: Optional["HlsSettings"] = None, + **kwargs + ): + """ + :keyword file_name: The file name to the source file. This file is located in the storage + container of the asset. + :paramtype file_name: str + :keyword display_name: The display name of the text track on a video player. In HLS, this maps + to the NAME attribute of EXT-X-MEDIA. + :paramtype display_name: str + :keyword player_visibility: When PlayerVisibility is set to "Visible", the text track will be + present in the DASH manifest or HLS playlist when requested by a client. When the + PlayerVisibility is set to "Hidden", the text will not be available to the client. The default + value is "Visible". Possible values include: "Hidden", "Visible". + :paramtype player_visibility: str or ~azure.mgmt.media.models.Visibility + :keyword hls_settings: The HLS specific setting for the text track. + :paramtype hls_settings: ~azure.mgmt.media.models.HlsSettings + """ + super(TextTrack, self).__init__(**kwargs) + self.odata_type = '#Microsoft.Media.TextTrack' # type: str + self.file_name = file_name + self.display_name = display_name + self.language_code = None + self.player_visibility = player_visibility + self.hls_settings = hls_settings + + class TrackPropertyCondition(msrest.serialization.Model): """Class to specify one track property condition. All required parameters must be populated in order to send to Azure. - :param property: Required. Track property type. Possible values include: "Unknown", "FourCC". - :type property: str or ~azure.mgmt.media.models.TrackPropertyType - :param operation: Required. Track property condition operation. Possible values include: + :ivar property: Required. Track property type. Possible values include: "Unknown", "FourCC". + :vartype property: str or ~azure.mgmt.media.models.TrackPropertyType + :ivar operation: Required. Track property condition operation. Possible values include: "Unknown", "Equal". - :type operation: str or ~azure.mgmt.media.models.TrackPropertyCompareOperation - :param value: Track property value. - :type value: str + :vartype operation: str or ~azure.mgmt.media.models.TrackPropertyCompareOperation + :ivar value: Track property value. + :vartype value: str """ _validation = { @@ -8126,6 +10593,15 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword property: Required. Track property type. Possible values include: "Unknown", "FourCC". + :paramtype property: str or ~azure.mgmt.media.models.TrackPropertyType + :keyword operation: Required. Track property condition operation. Possible values include: + "Unknown", "Equal". + :paramtype operation: str or ~azure.mgmt.media.models.TrackPropertyCompareOperation + :keyword value: Track property value. + :paramtype value: str + """ super(TrackPropertyCondition, self).__init__(**kwargs) self.property = property self.operation = operation @@ -8135,9 +10611,9 @@ def __init__( class TrackSelection(msrest.serialization.Model): """Class to select a track. - :param track_selections: TrackSelections is a track property condition list which can specify + :ivar track_selections: TrackSelections is a track property condition list which can specify track(s). - :type track_selections: list[~azure.mgmt.media.models.TrackPropertyCondition] + :vartype track_selections: list[~azure.mgmt.media.models.TrackPropertyCondition] """ _attribute_map = { @@ -8150,6 +10626,11 @@ def __init__( track_selections: Optional[List["TrackPropertyCondition"]] = None, **kwargs ): + """ + :keyword track_selections: TrackSelections is a track property condition list which can specify + track(s). + :paramtype track_selections: list[~azure.mgmt.media.models.TrackPropertyCondition] + """ super(TrackSelection, self).__init__(**kwargs) self.track_selections = track_selections @@ -8172,13 +10653,13 @@ class Transform(ProxyResource): :ivar created: The UTC date and time when the Transform was created, in 'YYYY-MM-DDThh:mm:ssZ' format. :vartype created: ~datetime.datetime - :param description: An optional verbose description of the Transform. - :type description: str + :ivar description: An optional verbose description of the Transform. + :vartype description: str :ivar last_modified: The UTC date and time when the Transform was last updated, in 'YYYY-MM-DDThh:mm:ssZ' format. :vartype last_modified: ~datetime.datetime - :param outputs: An array of one or more TransformOutputs that the Transform should generate. - :type outputs: list[~azure.mgmt.media.models.TransformOutput] + :ivar outputs: An array of one or more TransformOutputs that the Transform should generate. + :vartype outputs: list[~azure.mgmt.media.models.TransformOutput] """ _validation = { @@ -8208,6 +10689,12 @@ def __init__( outputs: Optional[List["TransformOutput"]] = None, **kwargs ): + """ + :keyword description: An optional verbose description of the Transform. + :paramtype description: str + :keyword outputs: An array of one or more TransformOutputs that the Transform should generate. + :paramtype outputs: list[~azure.mgmt.media.models.TransformOutput] + """ super(Transform, self).__init__(**kwargs) self.system_data = None self.created = None @@ -8219,11 +10706,11 @@ def __init__( class TransformCollection(msrest.serialization.Model): """A collection of Transform items. - :param value: A collection of Transform items. - :type value: list[~azure.mgmt.media.models.Transform] - :param odata_next_link: A link to the next page of the collection (when the collection contains + :ivar value: A collection of Transform items. + :vartype value: list[~azure.mgmt.media.models.Transform] + :ivar odata_next_link: A link to the next page of the collection (when the collection contains too many results to return in one response). - :type odata_next_link: str + :vartype odata_next_link: str """ _attribute_map = { @@ -8238,6 +10725,13 @@ def __init__( odata_next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: A collection of Transform items. + :paramtype value: list[~azure.mgmt.media.models.Transform] + :keyword odata_next_link: A link to the next page of the collection (when the collection + contains too many results to return in one response). + :paramtype odata_next_link: str + """ super(TransformCollection, self).__init__(**kwargs) self.value = value self.odata_next_link = odata_next_link @@ -8248,19 +10742,19 @@ class TransformOutput(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param on_error: A Transform can define more than one outputs. This property defines what the + :ivar on_error: A Transform can define more than one outputs. This property defines what the service should do when one output fails - either continue to produce other outputs, or, stop the other outputs. The overall Job state will not reflect failures of outputs that are specified with 'ContinueJob'. The default is 'StopProcessingJob'. Possible values include: "StopProcessingJob", "ContinueJob". - :type on_error: str or ~azure.mgmt.media.models.OnErrorType - :param relative_priority: Sets the relative priority of the TransformOutputs within a - Transform. This sets the priority that the service uses for processing TransformOutputs. The - default priority is Normal. Possible values include: "Low", "Normal", "High". - :type relative_priority: str or ~azure.mgmt.media.models.Priority - :param preset: Required. Preset that describes the operations that will be used to modify, + :vartype on_error: str or ~azure.mgmt.media.models.OnErrorType + :ivar relative_priority: Sets the relative priority of the TransformOutputs within a Transform. + This sets the priority that the service uses for processing TransformOutputs. The default + priority is Normal. Possible values include: "Low", "Normal", "High". + :vartype relative_priority: str or ~azure.mgmt.media.models.Priority + :ivar preset: Required. Preset that describes the operations that will be used to modify, transcode, or extract insights from the source file to generate the output. - :type preset: ~azure.mgmt.media.models.Preset + :vartype preset: ~azure.mgmt.media.models.Preset """ _validation = { @@ -8281,6 +10775,21 @@ def __init__( relative_priority: Optional[Union[str, "Priority"]] = None, **kwargs ): + """ + :keyword on_error: A Transform can define more than one outputs. This property defines what the + service should do when one output fails - either continue to produce other outputs, or, stop + the other outputs. The overall Job state will not reflect failures of outputs that are + specified with 'ContinueJob'. The default is 'StopProcessingJob'. Possible values include: + "StopProcessingJob", "ContinueJob". + :paramtype on_error: str or ~azure.mgmt.media.models.OnErrorType + :keyword relative_priority: Sets the relative priority of the TransformOutputs within a + Transform. This sets the priority that the service uses for processing TransformOutputs. The + default priority is Normal. Possible values include: "Low", "Normal", "High". + :paramtype relative_priority: str or ~azure.mgmt.media.models.Priority + :keyword preset: Required. Preset that describes the operations that will be used to modify, + transcode, or extract insights from the source file to generate the output. + :paramtype preset: ~azure.mgmt.media.models.Preset + """ super(TransformOutput, self).__init__(**kwargs) self.on_error = on_error self.relative_priority = relative_priority @@ -8292,23 +10801,22 @@ class TransportStreamFormat(MultiBitrateFormat): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param filename_pattern: Required. The pattern of the file names for the generated output - files. The following macros are supported in the file name: {Basename} - An expansion macro - that will use the name of the input video file. If the base name(the file suffix is not - included) of the input video file is less than 32 characters long, the base name of input video - files will be used. If the length of base name of the input video file exceeds 32 characters, - the base name is truncated to the first 32 characters in total length. {Extension} - The - appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - - A unique index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video - bitrate. Not applicable to thumbnails. {Codec} - The type of the audio/video codec. - {Resolution} - The video resolution. Any unsubstituted macros will be collapsed and removed - from the filename. - :type filename_pattern: str - :param output_files: The list of output files to produce. Each entry in the list is a set of + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar filename_pattern: Required. The pattern of the file names for the generated output files. + The following macros are supported in the file name: {Basename} - An expansion macro that will + use the name of the input video file. If the base name(the file suffix is not included) of the + input video file is less than 32 characters long, the base name of input video files will be + used. If the length of base name of the input video file exceeds 32 characters, the base name + is truncated to the first 32 characters in total length. {Extension} - The appropriate + extension for this format. {Label} - The label assigned to the codec/layer. {Index} - A unique + index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video bitrate. Not + applicable to thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video + resolution. Any unsubstituted macros will be collapsed and removed from the filename. + :vartype filename_pattern: str + :ivar output_files: The list of output files to produce. Each entry in the list is a set of audio and video layer labels to be muxed together . - :type output_files: list[~azure.mgmt.media.models.OutputFile] + :vartype output_files: list[~azure.mgmt.media.models.OutputFile] """ _validation = { @@ -8329,6 +10837,23 @@ def __init__( output_files: Optional[List["OutputFile"]] = None, **kwargs ): + """ + :keyword filename_pattern: Required. The pattern of the file names for the generated output + files. The following macros are supported in the file name: {Basename} - An expansion macro + that will use the name of the input video file. If the base name(the file suffix is not + included) of the input video file is less than 32 characters long, the base name of input video + files will be used. If the length of base name of the input video file exceeds 32 characters, + the base name is truncated to the first 32 characters in total length. {Extension} - The + appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} + - A unique index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video + bitrate. Not applicable to thumbnails. {Codec} - The type of the audio/video codec. + {Resolution} - The video resolution. Any unsubstituted macros will be collapsed and removed + from the filename. + :paramtype filename_pattern: str + :keyword output_files: The list of output files to produce. Each entry in the list is a set of + audio and video layer labels to be muxed together . + :paramtype output_files: list[~azure.mgmt.media.models.OutputFile] + """ super(TransportStreamFormat, self).__init__(filename_pattern=filename_pattern, output_files=output_files, **kwargs) self.odata_type = '#Microsoft.Media.TransportStreamFormat' # type: str @@ -8358,6 +10883,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserAssignedManagedIdentity, self).__init__(**kwargs) self.client_id = None self.principal_id = None @@ -8368,10 +10895,10 @@ class UtcClipTime(ClipTime): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param time: Required. The time position on the timeline of the input media based on Utc time. - :type time: ~datetime.datetime + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar time: Required. The time position on the timeline of the input media based on Utc time. + :vartype time: ~datetime.datetime """ _validation = { @@ -8390,6 +10917,11 @@ def __init__( time: datetime.datetime, **kwargs ): + """ + :keyword time: Required. The time position on the timeline of the input media based on Utc + time. + :paramtype time: ~datetime.datetime + """ super(UtcClipTime, self).__init__(**kwargs) self.odata_type = '#Microsoft.Media.UtcClipTime' # type: str self.time = time @@ -8400,9 +10932,9 @@ class VideoAnalyzerPreset(AudioAnalyzerPreset): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param audio_language: The language for the audio payload in the input using the BCP-47 format + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar audio_language: The language for the audio payload in the input using the BCP-47 format of 'language tag-region' (e.g: 'en-US'). If you know the language of your content, it is recommended that you specify it. The language must be specified explicitly for AudioAnalysisMode::Basic, since automatic language detection is not included in basic mode. If @@ -8413,14 +10945,14 @@ class VideoAnalyzerPreset(AudioAnalyzerPreset): speech. If automatic detection fails to find the language, transcription would fallback to 'en-US'." The list of supported languages is available here: https://go.microsoft.com/fwlink/?linkid=2109463. - :type audio_language: str - :param mode: Determines the set of audio analysis operations to be performed. If unspecified, + :vartype audio_language: str + :ivar mode: Determines the set of audio analysis operations to be performed. If unspecified, the Standard AudioAnalysisMode would be chosen. Possible values include: "Standard", "Basic". - :type mode: str or ~azure.mgmt.media.models.AudioAnalysisMode - :param experimental_options: Dictionary containing key value pairs for parameters not exposed - in the preset itself. - :type experimental_options: dict[str, str] - :param insights_to_extract: Defines the type of insights that you want the service to generate. + :vartype mode: str or ~azure.mgmt.media.models.AudioAnalysisMode + :ivar experimental_options: Dictionary containing key value pairs for parameters not exposed in + the preset itself. + :vartype experimental_options: dict[str, str] + :ivar insights_to_extract: Defines the type of insights that you want the service to generate. The allowed values are 'AudioInsightsOnly', 'VideoInsightsOnly', and 'AllInsights'. The default is AllInsights. If you set this to AllInsights and the input is audio only, then only audio insights are generated. Similarly if the input is video only, then only video insights are @@ -8428,7 +10960,7 @@ class VideoAnalyzerPreset(AudioAnalyzerPreset): inputs to be video only; or use VideoInsightsOnly if you expect some of your inputs to be audio only. Your Jobs in such conditions would error out. Possible values include: "AudioInsightsOnly", "VideoInsightsOnly", "AllInsights". - :type insights_to_extract: str or ~azure.mgmt.media.models.InsightsType + :vartype insights_to_extract: str or ~azure.mgmt.media.models.InsightsType """ _validation = { @@ -8452,6 +10984,35 @@ def __init__( insights_to_extract: Optional[Union[str, "InsightsType"]] = None, **kwargs ): + """ + :keyword audio_language: The language for the audio payload in the input using the BCP-47 + format of 'language tag-region' (e.g: 'en-US'). If you know the language of your content, it + is recommended that you specify it. The language must be specified explicitly for + AudioAnalysisMode::Basic, since automatic language detection is not included in basic mode. If + the language isn't specified or set to null, automatic language detection will choose the first + language detected and process with the selected language for the duration of the file. It does + not currently support dynamically switching between languages after the first language is + detected. The automatic detection works best with audio recordings with clearly discernable + speech. If automatic detection fails to find the language, transcription would fallback to + 'en-US'." The list of supported languages is available here: + https://go.microsoft.com/fwlink/?linkid=2109463. + :paramtype audio_language: str + :keyword mode: Determines the set of audio analysis operations to be performed. If unspecified, + the Standard AudioAnalysisMode would be chosen. Possible values include: "Standard", "Basic". + :paramtype mode: str or ~azure.mgmt.media.models.AudioAnalysisMode + :keyword experimental_options: Dictionary containing key value pairs for parameters not exposed + in the preset itself. + :paramtype experimental_options: dict[str, str] + :keyword insights_to_extract: Defines the type of insights that you want the service to + generate. The allowed values are 'AudioInsightsOnly', 'VideoInsightsOnly', and 'AllInsights'. + The default is AllInsights. If you set this to AllInsights and the input is audio only, then + only audio insights are generated. Similarly if the input is video only, then only video + insights are generated. It is recommended that you not use AudioInsightsOnly if you expect some + of your inputs to be video only; or use VideoInsightsOnly if you expect some of your inputs to + be audio only. Your Jobs in such conditions would error out. Possible values include: + "AudioInsightsOnly", "VideoInsightsOnly", "AllInsights". + :paramtype insights_to_extract: str or ~azure.mgmt.media.models.InsightsType + """ super(VideoAnalyzerPreset, self).__init__(audio_language=audio_language, mode=mode, experimental_options=experimental_options, **kwargs) self.odata_type = '#Microsoft.Media.VideoAnalyzerPreset' # type: str self.insights_to_extract = insights_to_extract @@ -8462,43 +11023,43 @@ class VideoOverlay(Overlay): All required parameters must be populated in order to send to Azure. - :param odata_type: Required. The discriminator for derived types.Constant filled by server. - :type odata_type: str - :param input_label: Required. The label of the job input which is to be used as an overlay. The + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + :ivar input_label: Required. The label of the job input which is to be used as an overlay. The Input must specify exactly one file. You can specify an image file in JPG, PNG, GIF or BMP format, or an audio file (such as a WAV, MP3, WMA or M4A file), or a video file. See https://aka.ms/mesformats for the complete list of supported audio and video file formats. - :type input_label: str - :param start: The start position, with reference to the input video, at which the overlay + :vartype input_label: str + :ivar start: The start position, with reference to the input video, at which the overlay starts. The value should be in ISO 8601 format. For example, PT05S to start the overlay at 5 seconds into the input video. If not specified the overlay starts from the beginning of the input video. - :type start: ~datetime.timedelta - :param end: The end position, with reference to the input video, at which the overlay ends. The + :vartype start: ~datetime.timedelta + :ivar end: The end position, with reference to the input video, at which the overlay ends. The value should be in ISO 8601 format. For example, PT30S to end the overlay at 30 seconds into the input video. If not specified or the value is greater than the input video duration, the overlay will be applied until the end of the input video if the overlay media duration is greater than the input video duration, else the overlay will last as long as the overlay media duration. - :type end: ~datetime.timedelta - :param fade_in_duration: The duration over which the overlay fades in onto the input video. The + :vartype end: ~datetime.timedelta + :ivar fade_in_duration: The duration over which the overlay fades in onto the input video. The value should be in ISO 8601 duration format. If not specified the default behavior is to have no fade in (same as PT0S). - :type fade_in_duration: ~datetime.timedelta - :param fade_out_duration: The duration over which the overlay fades out of the input video. The + :vartype fade_in_duration: ~datetime.timedelta + :ivar fade_out_duration: The duration over which the overlay fades out of the input video. The value should be in ISO 8601 duration format. If not specified the default behavior is to have no fade out (same as PT0S). - :type fade_out_duration: ~datetime.timedelta - :param audio_gain_level: The gain level of audio in the overlay. The value should be in the + :vartype fade_out_duration: ~datetime.timedelta + :ivar audio_gain_level: The gain level of audio in the overlay. The value should be in the range [0, 1.0]. The default is 1.0. - :type audio_gain_level: float - :param position: The location in the input video where the overlay is applied. - :type position: ~azure.mgmt.media.models.Rectangle - :param opacity: The opacity of the overlay. This is a value in the range [0 - 1.0]. Default is + :vartype audio_gain_level: float + :ivar position: The location in the input video where the overlay is applied. + :vartype position: ~azure.mgmt.media.models.Rectangle + :ivar opacity: The opacity of the overlay. This is a value in the range [0 - 1.0]. Default is 1.0 which mean the overlay is opaque. - :type opacity: float - :param crop_rectangle: An optional rectangular window used to crop the overlay image or video. - :type crop_rectangle: ~azure.mgmt.media.models.Rectangle + :vartype opacity: float + :ivar crop_rectangle: An optional rectangular window used to crop the overlay image or video. + :vartype crop_rectangle: ~azure.mgmt.media.models.Rectangle """ _validation = { @@ -8533,8 +11094,73 @@ def __init__( crop_rectangle: Optional["Rectangle"] = None, **kwargs ): + """ + :keyword input_label: Required. The label of the job input which is to be used as an overlay. + The Input must specify exactly one file. You can specify an image file in JPG, PNG, GIF or BMP + format, or an audio file (such as a WAV, MP3, WMA or M4A file), or a video file. See + https://aka.ms/mesformats for the complete list of supported audio and video file formats. + :paramtype input_label: str + :keyword start: The start position, with reference to the input video, at which the overlay + starts. The value should be in ISO 8601 format. For example, PT05S to start the overlay at 5 + seconds into the input video. If not specified the overlay starts from the beginning of the + input video. + :paramtype start: ~datetime.timedelta + :keyword end: The end position, with reference to the input video, at which the overlay ends. + The value should be in ISO 8601 format. For example, PT30S to end the overlay at 30 seconds + into the input video. If not specified or the value is greater than the input video duration, + the overlay will be applied until the end of the input video if the overlay media duration is + greater than the input video duration, else the overlay will last as long as the overlay media + duration. + :paramtype end: ~datetime.timedelta + :keyword fade_in_duration: The duration over which the overlay fades in onto the input video. + The value should be in ISO 8601 duration format. If not specified the default behavior is to + have no fade in (same as PT0S). + :paramtype fade_in_duration: ~datetime.timedelta + :keyword fade_out_duration: The duration over which the overlay fades out of the input video. + The value should be in ISO 8601 duration format. If not specified the default behavior is to + have no fade out (same as PT0S). + :paramtype fade_out_duration: ~datetime.timedelta + :keyword audio_gain_level: The gain level of audio in the overlay. The value should be in the + range [0, 1.0]. The default is 1.0. + :paramtype audio_gain_level: float + :keyword position: The location in the input video where the overlay is applied. + :paramtype position: ~azure.mgmt.media.models.Rectangle + :keyword opacity: The opacity of the overlay. This is a value in the range [0 - 1.0]. Default + is 1.0 which mean the overlay is opaque. + :paramtype opacity: float + :keyword crop_rectangle: An optional rectangular window used to crop the overlay image or + video. + :paramtype crop_rectangle: ~azure.mgmt.media.models.Rectangle + """ super(VideoOverlay, self).__init__(input_label=input_label, start=start, end=end, fade_in_duration=fade_in_duration, fade_out_duration=fade_out_duration, audio_gain_level=audio_gain_level, **kwargs) self.odata_type = '#Microsoft.Media.VideoOverlay' # type: str self.position = position self.opacity = opacity self.crop_rectangle = crop_rectangle + + +class VideoTrack(TrackBase): + """Represents a video track in the asset. + + All required parameters must be populated in order to send to Azure. + + :ivar odata_type: Required. The discriminator for derived types.Constant filled by server. + :vartype odata_type: str + """ + + _validation = { + 'odata_type': {'required': True}, + } + + _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(VideoTrack, self).__init__(**kwargs) + self.odata_type = '#Microsoft.Media.VideoTrack' # type: str diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/__init__.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/__init__.py index c6099c10f9ba..b5525401d45e 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/__init__.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/__init__.py @@ -6,14 +6,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._account_filters_operations import AccountFiltersOperations from ._operations import Operations from ._mediaservices_operations import MediaservicesOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._locations_operations import LocationsOperations -from ._account_filters_operations import AccountFiltersOperations from ._assets_operations import AssetsOperations from ._asset_filters_operations import AssetFiltersOperations +from ._tracks_operations import TracksOperations +from ._operation_statuses_operations import OperationStatusesOperations +from ._operation_results_operations import OperationResultsOperations from ._content_key_policies_operations import ContentKeyPoliciesOperations from ._transforms_operations import TransformsOperations from ._jobs_operations import JobsOperations @@ -24,14 +27,17 @@ from ._streaming_endpoints_operations import StreamingEndpointsOperations __all__ = [ + 'AccountFiltersOperations', 'Operations', 'MediaservicesOperations', 'PrivateLinkResourcesOperations', 'PrivateEndpointConnectionsOperations', 'LocationsOperations', - 'AccountFiltersOperations', 'AssetsOperations', 'AssetFiltersOperations', + 'TracksOperations', + 'OperationStatusesOperations', + 'OperationResultsOperations', 'ContentKeyPoliciesOperations', 'TransformsOperations', 'JobsOperations', diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_account_filters_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_account_filters_operations.py index 83a6b637d2ae..625a36421a40 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_account_filters_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_account_filters_operations.py @@ -5,23 +5,227 @@ # 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, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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, + filter_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "filterName": _SERIALIZER.url("filter_name", filter_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, + filter_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" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "filterName": _SERIALIZER.url("filter_name", filter_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, + filter_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "filterName": _SERIALIZER.url("filter_name", filter_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, + filter_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" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "filterName": _SERIALIZER.url("filter_name", filter_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 AccountFiltersOperations(object): """AccountFiltersOperations operations. @@ -45,13 +249,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: (...) -> Iterable["_models.AccountFilterCollection"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.AccountFilterCollection"]: """List Account Filters. List Account Filters in the Media Services account. @@ -61,7 +265,8 @@ def list( :param account_name: The Media Services account name. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AccountFilterCollection or the result of cls(response) + :return: An iterator like instance of either AccountFilterCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.media.models.AccountFilterCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -70,36 +275,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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 = 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, + 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, + 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('AccountFilterCollection', pipeline_response) + deserialized = self._deserialize("AccountFilterCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,25 +314,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/mediaServices/{accountName}/accountFilters'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - filter_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AccountFilter" + resource_group_name: str, + account_name: str, + filter_name: str, + **kwargs: Any + ) -> "_models.AccountFilter": """Get an Account Filter. Get the details of an Account Filter in the Media Services account. @@ -151,34 +354,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'filterName': self._serialize.url("filter_name", filter_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, + filter_name=filter_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('AccountFilter', pipeline_response) @@ -187,17 +380,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - filter_name, # type: str - parameters, # type: "_models.AccountFilter" - **kwargs # type: Any - ): - # type: (...) -> "_models.AccountFilter" + resource_group_name: str, + account_name: str, + filter_name: str, + parameters: "_models.AccountFilter", + **kwargs: Any + ) -> "_models.AccountFilter": """Create or update an Account Filter. Creates or updates an Account Filter in the Media Services account. @@ -220,39 +415,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'filterName': self._serialize.url("filter_name", filter_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, 'AccountFilter') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + filter_name=filter_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, 'AccountFilter') - 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: @@ -265,16 +450,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - filter_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + filter_name: str, + **kwargs: Any + ) -> None: """Delete an Account Filter. Deletes an Account Filter in the Media Services account. @@ -295,34 +482,24 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'filterName': self._serialize.url("filter_name", filter_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, + filter_name=filter_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: @@ -330,15 +507,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - filter_name, # type: str - parameters, # type: "_models.AccountFilter" - **kwargs # type: Any - ): - # type: (...) -> "_models.AccountFilter" + resource_group_name: str, + account_name: str, + filter_name: str, + parameters: "_models.AccountFilter", + **kwargs: Any + ) -> "_models.AccountFilter": """Update an Account Filter. Updates an existing Account Filter in the Media Services account. @@ -361,39 +539,29 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'filterName': self._serialize.url("filter_name", filter_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, 'AccountFilter') - # 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, + filter_name=filter_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, 'AccountFilter') - 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('AccountFilter', pipeline_response) @@ -402,4 +570,6 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}'} # type: ignore + diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_asset_filters_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_asset_filters_operations.py index 4d8ba875adc5..0420d0c74ebb 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_asset_filters_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_asset_filters_operations.py @@ -5,23 +5,237 @@ # 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, + asset_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "assetName": _SERIALIZER.url("asset_name", asset_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, + asset_name: str, + filter_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "assetName": _SERIALIZER.url("asset_name", asset_name, 'str'), + "filterName": _SERIALIZER.url("filter_name", filter_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, + asset_name: str, + filter_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" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "assetName": _SERIALIZER.url("asset_name", asset_name, 'str'), + "filterName": _SERIALIZER.url("filter_name", filter_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, + asset_name: str, + filter_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "assetName": _SERIALIZER.url("asset_name", asset_name, 'str'), + "filterName": _SERIALIZER.url("filter_name", filter_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, + asset_name: str, + filter_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" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "assetName": _SERIALIZER.url("asset_name", asset_name, 'str'), + "filterName": _SERIALIZER.url("filter_name", filter_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 AssetFiltersOperations(object): """AssetFiltersOperations operations. @@ -45,14 +259,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 - asset_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AssetFilterCollection"] + resource_group_name: str, + account_name: str, + asset_name: str, + **kwargs: Any + ) -> Iterable["_models.AssetFilterCollection"]: """List Asset Filters. List Asset Filters associated with the specified Asset. @@ -64,7 +278,8 @@ def list( :param asset_name: The Asset name. :type asset_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AssetFilterCollection or the result of cls(response) + :return: An iterator like instance of either AssetFilterCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.media.models.AssetFilterCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -73,37 +288,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'assetName': self._serialize.url("asset_name", asset_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 = 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, + asset_name=asset_name, + 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, + asset_name=asset_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AssetFilterCollection', pipeline_response) + deserialized = self._deserialize("AssetFilterCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -116,26 +329,27 @@ 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/mediaServices/{accountName}/assets/{assetName}/assetFilters'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - asset_name, # type: str - filter_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AssetFilter" + resource_group_name: str, + account_name: str, + asset_name: str, + filter_name: str, + **kwargs: Any + ) -> "_models.AssetFilter": """Get an Asset Filter. Get the details of an Asset Filter associated with the specified Asset. @@ -158,35 +372,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'assetName': self._serialize.url("asset_name", asset_name, 'str'), - 'filterName': self._serialize.url("filter_name", filter_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, + asset_name=asset_name, + filter_name=filter_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('AssetFilter', pipeline_response) @@ -195,18 +399,20 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - asset_name, # type: str - filter_name, # type: str - parameters, # type: "_models.AssetFilter" - **kwargs # type: Any - ): - # type: (...) -> "_models.AssetFilter" + resource_group_name: str, + account_name: str, + asset_name: str, + filter_name: str, + parameters: "_models.AssetFilter", + **kwargs: Any + ) -> "_models.AssetFilter": """Create or update an Asset Filter. Creates or updates an Asset Filter associated with the specified Asset. @@ -231,40 +437,30 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'assetName': self._serialize.url("asset_name", asset_name, 'str'), - 'filterName': self._serialize.url("filter_name", filter_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, 'AssetFilter') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + filter_name=filter_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, 'AssetFilter') - 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: @@ -277,17 +473,19 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - asset_name, # type: str - filter_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + asset_name: str, + filter_name: str, + **kwargs: Any + ) -> None: """Delete an Asset Filter. Deletes an Asset Filter associated with the specified Asset. @@ -310,35 +508,25 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'assetName': self._serialize.url("asset_name", asset_name, 'str'), - 'filterName': self._serialize.url("filter_name", filter_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, + asset_name=asset_name, + filter_name=filter_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,16 +534,17 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - asset_name, # type: str - filter_name, # type: str - parameters, # type: "_models.AssetFilter" - **kwargs # type: Any - ): - # type: (...) -> "_models.AssetFilter" + resource_group_name: str, + account_name: str, + asset_name: str, + filter_name: str, + parameters: "_models.AssetFilter", + **kwargs: Any + ) -> "_models.AssetFilter": """Update an Asset Filter. Updates an existing Asset Filter associated with the specified Asset. @@ -380,40 +569,30 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'assetName': self._serialize.url("asset_name", asset_name, 'str'), - 'filterName': self._serialize.url("filter_name", filter_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, 'AssetFilter') - # 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, + asset_name=asset_name, + filter_name=filter_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, 'AssetFilter') - 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('AssetFilter', pipeline_response) @@ -422,4 +601,6 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}'} # type: ignore + diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_assets_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_assets_operations.py index b381f096fcf2..f39967741cf8 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_assets_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_assets_operations.py @@ -5,23 +5,357 @@ # 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, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, '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, + asset_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "assetName": _SERIALIZER.url("asset_name", asset_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, + asset_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" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "assetName": _SERIALIZER.url("asset_name", asset_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, + asset_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "assetName": _SERIALIZER.url("asset_name", asset_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, + asset_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" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "assetName": _SERIALIZER.url("asset_name", asset_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_container_sas_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + asset_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" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/listContainerSas') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "assetName": _SERIALIZER.url("asset_name", asset_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 + ) + + +def build_get_encryption_key_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + asset_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/getEncryptionKey') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "assetName": _SERIALIZER.url("asset_name", asset_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_list_streaming_locators_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + asset_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/listStreamingLocators') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "assetName": _SERIALIZER.url("asset_name", asset_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 AssetsOperations(object): """AssetsOperations operations. @@ -45,16 +379,16 @@ 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] - orderby=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AssetCollection"] + resource_group_name: str, + account_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.AssetCollection"]: """List Assets. List Assets in the Media Services account with optional filtering and ordering. @@ -81,42 +415,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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') - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - - 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, + orderby=orderby, + 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, + orderby=orderby, + 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('AssetCollection', pipeline_response) + deserialized = self._deserialize("AssetCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -129,25 +460,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/mediaServices/{accountName}/assets'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - asset_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Asset" + resource_group_name: str, + account_name: str, + asset_name: str, + **kwargs: Any + ) -> "_models.Asset": """Get an Asset. Get the details of an Asset in the Media Services account. @@ -168,34 +500,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'assetName': self._serialize.url("asset_name", asset_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, + asset_name=asset_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('Asset', pipeline_response) @@ -204,17 +526,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - asset_name, # type: str - parameters, # type: "_models.Asset" - **kwargs # type: Any - ): - # type: (...) -> "_models.Asset" + resource_group_name: str, + account_name: str, + asset_name: str, + parameters: "_models.Asset", + **kwargs: Any + ) -> "_models.Asset": """Create or update an Asset. Creates or updates an Asset in the Media Services account. @@ -237,39 +561,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'assetName': self._serialize.url("asset_name", asset_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, 'Asset') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_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, 'Asset') - 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 +596,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - asset_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + asset_name: str, + **kwargs: Any + ) -> None: """Delete an Asset. Deletes an Asset in the Media Services account. @@ -312,34 +628,24 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'assetName': self._serialize.url("asset_name", asset_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, + asset_name=asset_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: @@ -347,15 +653,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - asset_name, # type: str - parameters, # type: "_models.Asset" - **kwargs # type: Any - ): - # type: (...) -> "_models.Asset" + resource_group_name: str, + account_name: str, + asset_name: str, + parameters: "_models.Asset", + **kwargs: Any + ) -> "_models.Asset": """Update an Asset. Updates an existing Asset in the Media Services account. @@ -378,39 +685,29 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'assetName': self._serialize.url("asset_name", asset_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, 'Asset') - # 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, + asset_name=asset_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, 'Asset') - 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('Asset', pipeline_response) @@ -419,17 +716,19 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}'} # type: ignore + + @distributed_trace def list_container_sas( self, - resource_group_name, # type: str - account_name, # type: str - asset_name, # type: str - parameters, # type: "_models.ListContainerSasInput" - **kwargs # type: Any - ): - # type: (...) -> "_models.AssetContainerSas" + resource_group_name: str, + account_name: str, + asset_name: str, + parameters: "_models.ListContainerSasInput", + **kwargs: Any + ) -> "_models.AssetContainerSas": """List the Asset URLs. Lists storage container URLs with shared access signatures (SAS) for uploading and downloading @@ -453,39 +752,29 @@ def list_container_sas( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_container_sas.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'assetName': self._serialize.url("asset_name", asset_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, 'ListContainerSasInput') - # 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_container_sas_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + content_type=content_type, + json=_json, + template_url=self.list_container_sas.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, 'ListContainerSasInput') - 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('AssetContainerSas', pipeline_response) @@ -494,16 +783,18 @@ def list_container_sas( return cls(pipeline_response, deserialized, {}) return deserialized + list_container_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/listContainerSas'} # type: ignore + + @distributed_trace def get_encryption_key( self, - resource_group_name, # type: str - account_name, # type: str - asset_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageEncryptedAssetDecryptionData" + resource_group_name: str, + account_name: str, + asset_name: str, + **kwargs: Any + ) -> "_models.StorageEncryptedAssetDecryptionData": """Gets the Asset storage key. Gets the Asset storage encryption keys used to decrypt content created by version 2 of the @@ -525,34 +816,24 @@ def get_encryption_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_encryption_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'assetName': self._serialize.url("asset_name", asset_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_encryption_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + template_url=self.get_encryption_key.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('StorageEncryptedAssetDecryptionData', pipeline_response) @@ -561,16 +842,18 @@ def get_encryption_key( return cls(pipeline_response, deserialized, {}) return deserialized + get_encryption_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/getEncryptionKey'} # type: ignore + + @distributed_trace def list_streaming_locators( self, - resource_group_name, # type: str - account_name, # type: str - asset_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ListStreamingLocatorsResponse" + resource_group_name: str, + account_name: str, + asset_name: str, + **kwargs: Any + ) -> "_models.ListStreamingLocatorsResponse": """List Streaming Locators. Lists Streaming Locators which are associated with this asset. @@ -591,34 +874,24 @@ def list_streaming_locators( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list_streaming_locators.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'assetName': self._serialize.url("asset_name", asset_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_streaming_locators_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + template_url=self.list_streaming_locators.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('ListStreamingLocatorsResponse', pipeline_response) @@ -627,4 +900,6 @@ def list_streaming_locators( return cls(pipeline_response, deserialized, {}) return deserialized + list_streaming_locators.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/listStreamingLocators'} # type: ignore + diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_content_key_policies_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_content_key_policies_operations.py index 0dc0b0589734..14c94947fa67 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_content_key_policies_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_content_key_policies_operations.py @@ -5,23 +5,274 @@ # 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, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, '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, + content_key_policy_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "contentKeyPolicyName": _SERIALIZER.url("content_key_policy_name", content_key_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, + content_key_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" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "contentKeyPolicyName": _SERIALIZER.url("content_key_policy_name", content_key_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, + content_key_policy_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "contentKeyPolicyName": _SERIALIZER.url("content_key_policy_name", content_key_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, + content_key_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" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "contentKeyPolicyName": _SERIALIZER.url("content_key_policy_name", content_key_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 + ) + + +def build_get_policy_properties_with_secrets_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + content_key_policy_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}/getPolicyPropertiesWithSecrets') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "contentKeyPolicyName": _SERIALIZER.url("content_key_policy_name", content_key_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="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ContentKeyPoliciesOperations(object): """ContentKeyPoliciesOperations operations. @@ -45,16 +296,16 @@ 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] - orderby=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ContentKeyPolicyCollection"] + resource_group_name: str, + account_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ContentKeyPolicyCollection"]: """List Content Key Policies. Lists the Content Key Policies in the account. @@ -72,7 +323,8 @@ def list( :param orderby: Specifies the key by which the result collection should be ordered. :type orderby: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ContentKeyPolicyCollection or the result of cls(response) + :return: An iterator like instance of either ContentKeyPolicyCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.media.models.ContentKeyPolicyCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -81,42 +333,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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') - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - - 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, + orderby=orderby, + 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, + orderby=orderby, + 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('ContentKeyPolicyCollection', pipeline_response) + deserialized = self._deserialize("ContentKeyPolicyCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -129,25 +378,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/mediaServices/{accountName}/contentKeyPolicies'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - content_key_policy_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ContentKeyPolicy" + resource_group_name: str, + account_name: str, + content_key_policy_name: str, + **kwargs: Any + ) -> "_models.ContentKeyPolicy": """Get a Content Key Policy. Get the details of a Content Key Policy in the Media Services account. @@ -168,34 +418,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'contentKeyPolicyName': self._serialize.url("content_key_policy_name", content_key_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, + content_key_policy_name=content_key_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('ContentKeyPolicy', pipeline_response) @@ -204,17 +444,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - content_key_policy_name, # type: str - parameters, # type: "_models.ContentKeyPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.ContentKeyPolicy" + resource_group_name: str, + account_name: str, + content_key_policy_name: str, + parameters: "_models.ContentKeyPolicy", + **kwargs: Any + ) -> "_models.ContentKeyPolicy": """Create or update an Content Key Policy. Create or update a Content Key Policy in the Media Services account. @@ -237,39 +479,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'contentKeyPolicyName': self._serialize.url("content_key_policy_name", content_key_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, 'ContentKeyPolicy') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + content_key_policy_name=content_key_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, 'ContentKeyPolicy') - 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 +514,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - content_key_policy_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + content_key_policy_name: str, + **kwargs: Any + ) -> None: """Delete a Content Key Policy. Deletes a Content Key Policy in the Media Services account. @@ -312,34 +546,24 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'contentKeyPolicyName': self._serialize.url("content_key_policy_name", content_key_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, + content_key_policy_name=content_key_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: @@ -347,15 +571,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - content_key_policy_name, # type: str - parameters, # type: "_models.ContentKeyPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.ContentKeyPolicy" + resource_group_name: str, + account_name: str, + content_key_policy_name: str, + parameters: "_models.ContentKeyPolicy", + **kwargs: Any + ) -> "_models.ContentKeyPolicy": """Update a Content Key Policy. Updates an existing Content Key Policy in the Media Services account. @@ -378,39 +603,29 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'contentKeyPolicyName': self._serialize.url("content_key_policy_name", content_key_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, 'ContentKeyPolicy') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + content_key_policy_name=content_key_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, 'ContentKeyPolicy') - 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('ContentKeyPolicy', pipeline_response) @@ -419,16 +634,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}'} # type: ignore + + @distributed_trace def get_policy_properties_with_secrets( self, - resource_group_name, # type: str - account_name, # type: str - content_key_policy_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ContentKeyPolicyProperties" + resource_group_name: str, + account_name: str, + content_key_policy_name: str, + **kwargs: Any + ) -> "_models.ContentKeyPolicyProperties": """Get a Content Key Policy with secrets. Get a Content Key Policy including secret values. @@ -449,34 +666,24 @@ def get_policy_properties_with_secrets( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_policy_properties_with_secrets.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'contentKeyPolicyName': self._serialize.url("content_key_policy_name", content_key_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_policy_properties_with_secrets_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + content_key_policy_name=content_key_policy_name, + template_url=self.get_policy_properties_with_secrets.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('ContentKeyPolicyProperties', pipeline_response) @@ -485,4 +692,6 @@ def get_policy_properties_with_secrets( return cls(pipeline_response, deserialized, {}) return deserialized + get_policy_properties_with_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}/getPolicyPropertiesWithSecrets'} # type: ignore + diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_jobs_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_jobs_operations.py index 401019c6bf44..0ec4773a55e4 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_jobs_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_jobs_operations.py @@ -5,23 +5,283 @@ # 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 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 - - 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, + transform_name: str, + *, + filter: Optional[str] = None, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "transformName": _SERIALIZER.url("transform_name", transform_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 orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, '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, + transform_name: str, + job_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "transformName": _SERIALIZER.url("transform_name", transform_name, 'str'), + "jobName": _SERIALIZER.url("job_name", 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_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + transform_name: str, + 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" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "transformName": _SERIALIZER.url("transform_name", transform_name, 'str'), + "jobName": _SERIALIZER.url("job_name", 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, + transform_name: str, + job_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "transformName": _SERIALIZER.url("transform_name", transform_name, 'str'), + "jobName": _SERIALIZER.url("job_name", 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, + transform_name: str, + 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" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "transformName": _SERIALIZER.url("transform_name", transform_name, 'str'), + "jobName": _SERIALIZER.url("job_name", 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_job_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + transform_name: str, + job_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}/cancelJob') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "transformName": _SERIALIZER.url("transform_name", transform_name, 'str'), + "jobName": _SERIALIZER.url("job_name", 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 JobsOperations(object): """JobsOperations operations. @@ -45,16 +305,16 @@ 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 - transform_name, # type: str - filter=None, # type: Optional[str] - orderby=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.JobCollection"] + resource_group_name: str, + account_name: str, + transform_name: str, + filter: Optional[str] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.JobCollection"]: """List Jobs. Lists all of the Jobs for the Transform. @@ -79,41 +339,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'transformName': self._serialize.url("transform_name", transform_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 orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - - 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, + transform_name=transform_name, + filter=filter, + orderby=orderby, + 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, + transform_name=transform_name, + filter=filter, + orderby=orderby, + 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('JobCollection', pipeline_response) + deserialized = self._deserialize("JobCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -126,26 +384,27 @@ 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/mediaServices/{accountName}/transforms/{transformName}/jobs'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - transform_name, # type: str - job_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Job" + resource_group_name: str, + account_name: str, + transform_name: str, + job_name: str, + **kwargs: Any + ) -> "_models.Job": """Get Job. Gets a Job. @@ -168,35 +427,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'transformName': self._serialize.url("transform_name", transform_name, 'str'), - 'jobName': self._serialize.url("job_name", 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, + transform_name=transform_name, + job_name=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('Job', pipeline_response) @@ -205,18 +454,20 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}'} # type: ignore + + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - transform_name, # type: str - job_name, # type: str - parameters, # type: "_models.Job" - **kwargs # type: Any - ): - # type: (...) -> "_models.Job" + resource_group_name: str, + account_name: str, + transform_name: str, + job_name: str, + parameters: "_models.Job", + **kwargs: Any + ) -> "_models.Job": """Create Job. Creates a Job. @@ -241,40 +492,30 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'transformName': self._serialize.url("transform_name", transform_name, 'str'), - 'jobName': self._serialize.url("job_name", 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, 'Job') + + request = build_create_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + transform_name=transform_name, + job_name=job_name, + content_type=content_type, + json=_json, + template_url=self.create.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, 'Job') - 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) deserialized = self._deserialize('Job', pipeline_response) @@ -283,17 +524,19 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - transform_name, # type: str - job_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + transform_name: str, + job_name: str, + **kwargs: Any + ) -> None: """Delete Job. Deletes a Job. @@ -316,35 +559,25 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'transformName': self._serialize.url("transform_name", transform_name, 'str'), - 'jobName': self._serialize.url("job_name", 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, + transform_name=transform_name, + job_name=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: @@ -352,16 +585,17 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - transform_name, # type: str - job_name, # type: str - parameters, # type: "_models.Job" - **kwargs # type: Any - ): - # type: (...) -> "_models.Job" + resource_group_name: str, + account_name: str, + transform_name: str, + job_name: str, + parameters: "_models.Job", + **kwargs: Any + ) -> "_models.Job": """Update Job. Update is only supported for description and priority. Updating Priority will take effect when @@ -388,40 +622,30 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'transformName': self._serialize.url("transform_name", transform_name, 'str'), - 'jobName': self._serialize.url("job_name", 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, 'Job') - # 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, + transform_name=transform_name, + job_name=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, 'Job') - 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('Job', pipeline_response) @@ -430,17 +654,19 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}'} # type: ignore + + @distributed_trace def cancel_job( self, - resource_group_name, # type: str - account_name, # type: str - transform_name, # type: str - job_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + transform_name: str, + job_name: str, + **kwargs: Any + ) -> None: """Cancel Job. Cancel a Job. @@ -463,38 +689,29 @@ def cancel_job( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.cancel_job.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'transformName': self._serialize.url("transform_name", transform_name, 'str'), - 'jobName': self._serialize.url("job_name", 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_job_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + transform_name=transform_name, + job_name=job_name, + template_url=self.cancel_job.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) if cls: return cls(pipeline_response, None, {}) cancel_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}/cancelJob'} # type: ignore + diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_live_events_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_live_events_operations.py index d8405a2d24ad..9050b37f4da0 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_live_events_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_live_events_operations.py @@ -5,25 +5,389 @@ # 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, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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, + live_event_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "liveEventName": _SERIALIZER.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + live_event_name: str, + *, + json: JSONType = None, + content: Any = None, + auto_start: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "liveEventName": _SERIALIZER.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if auto_start is not None: + query_parameters['autoStart'] = _SERIALIZER.query("auto_start", auto_start, 'bool') + + # 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_update_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + live_event_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" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "liveEventName": _SERIALIZER.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + live_event_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "liveEventName": _SERIALIZER.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_allocate_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + live_event_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/allocate') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "liveEventName": _SERIALIZER.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_start_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + live_event_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/start') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "liveEventName": _SERIALIZER.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_stop_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + live_event_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" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/stop') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "liveEventName": _SERIALIZER.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reset_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + live_event_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/reset') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "liveEventName": _SERIALIZER.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class LiveEventsOperations(object): """LiveEventsOperations operations. @@ -47,13 +411,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: (...) -> Iterable["_models.LiveEventListResult"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.LiveEventListResult"]: """List live events. Lists all the live events in the account. @@ -72,36 +436,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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 = 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, + 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, + 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('LiveEventListResult', pipeline_response) + deserialized = self._deserialize("LiveEventListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,25 +475,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/mediaservices/{accountName}/liveEvents'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - live_event_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.LiveEvent" + resource_group_name: str, + account_name: str, + live_event_name: str, + **kwargs: Any + ) -> "_models.LiveEvent": """Get Live Event. Gets properties of a live event. @@ -153,34 +515,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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_event_name=live_event_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('LiveEvent', pipeline_response) @@ -189,59 +541,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - account_name, # type: str - live_event_name, # type: str - parameters, # type: "_models.LiveEvent" - auto_start=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> "_models.LiveEvent" + resource_group_name: str, + account_name: str, + live_event_name: str, + parameters: "_models.LiveEvent", + auto_start: Optional[bool] = None, + **kwargs: Any + ) -> "_models.LiveEvent": cls = kwargs.pop('cls', None) # type: ClsType["_models.LiveEvent"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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 auto_start is not None: - query_parameters['autoStart'] = self._serialize.query("auto_start", auto_start, 'bool') - - # 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') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'LiveEvent') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'LiveEvent') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_event_name=live_event_name, + content_type=content_type, + json=_json, + auto_start=auto_start, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 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) if response.status_code == 200: deserialized = self._deserialize('LiveEvent', pipeline_response) @@ -253,18 +594,20 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - account_name, # type: str - live_event_name, # type: str - parameters, # type: "_models.LiveEvent" - auto_start=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.LiveEvent"] + resource_group_name: str, + account_name: str, + live_event_name: str, + parameters: "_models.LiveEvent", + auto_start: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller["_models.LiveEvent"]: """Create Live Event. Creates a new live event. @@ -282,15 +625,18 @@ def begin_create( :type auto_start: bool :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 LiveEvent or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.media.models.LiveEvent] - :raises ~azure.core.exceptions.HttpResponseError: + :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.LiveEvent"] lro_delay = kwargs.pop( 'polling_interval', @@ -304,28 +650,21 @@ def begin_create( live_event_name=live_event_name, parameters=parameters, auto_start=auto_start, + 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('LiveEvent', 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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: @@ -337,56 +676,45 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - account_name, # type: str - live_event_name, # type: str - parameters, # type: "_models.LiveEvent" - **kwargs # type: Any - ): - # type: (...) -> "_models.LiveEvent" + resource_group_name: str, + account_name: str, + live_event_name: str, + parameters: "_models.LiveEvent", + **kwargs: Any + ) -> "_models.LiveEvent": cls = kwargs.pop('cls', None) # type: ClsType["_models.LiveEvent"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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, 'LiveEvent') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_event_name=live_event_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, 'LiveEvent') - 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, 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 response.status_code == 200: deserialized = self._deserialize('LiveEvent', pipeline_response) @@ -398,17 +726,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - account_name, # type: str - live_event_name, # type: str - parameters, # type: "_models.LiveEvent" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.LiveEvent"] + resource_group_name: str, + account_name: str, + live_event_name: str, + parameters: "_models.LiveEvent", + **kwargs: Any + ) -> LROPoller["_models.LiveEvent"]: """Updates settings on an existing live event. :param resource_group_name: The name of the resource group within the Azure subscription. @@ -421,15 +751,18 @@ def begin_update( :type parameters: ~azure.mgmt.media.models.LiveEvent :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 LiveEvent or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.media.models.LiveEvent] - :raises ~azure.core.exceptions.HttpResponseError: + :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.LiveEvent"] lro_delay = kwargs.pop( 'polling_interval', @@ -442,28 +775,21 @@ def begin_update( account_name=account_name, live_event_name=live_event_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('LiveEvent', 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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: @@ -475,64 +801,54 @@ 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/mediaservices/{accountName}/liveEvents/{liveEventName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - account_name, # type: str - live_event_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + live_event_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-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_event_name=live_event_name, + template_url=self._delete_initial.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, 202, 204]: 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, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - account_name, # type: str - live_event_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + live_event_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete Live Event. Deletes a live event. @@ -545,15 +861,17 @@ def begin_delete( :type live_event_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', @@ -568,22 +886,14 @@ def begin_delete( 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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: @@ -595,64 +905,54 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}'} # type: ignore def _allocate_initial( self, - resource_group_name, # type: str - account_name, # type: str - live_event_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + live_event_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-06-01" - accept = "application/json" - - # Construct URL - url = self._allocate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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_allocate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_event_name=live_event_name, + template_url=self._allocate_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, {}) _allocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/allocate'} # type: ignore + + @distributed_trace def begin_allocate( self, - resource_group_name, # type: str - account_name, # type: str - live_event_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + live_event_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Allocate resources for a live event. A live event is in StandBy state after allocation completes, and is ready to start. @@ -665,15 +965,17 @@ def begin_allocate( :type live_event_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', @@ -688,22 +990,14 @@ def begin_allocate( 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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: @@ -715,64 +1009,54 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_allocate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/allocate'} # type: ignore def _start_initial( self, - resource_group_name, # type: str - account_name, # type: str - live_event_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + live_event_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-06-01" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_event_name=live_event_name, + template_url=self._start_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, {}) _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/start'} # type: ignore + + @distributed_trace def begin_start( self, - resource_group_name, # type: str - account_name, # type: str - live_event_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + live_event_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Start Live Event. A live event in Stopped or StandBy state will be in Running state after the start operation @@ -786,15 +1070,17 @@ def begin_start( :type live_event_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', @@ -809,22 +1095,14 @@ def begin_start( 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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: @@ -836,71 +1114,61 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/start'} # type: ignore def _stop_initial( self, - resource_group_name, # type: str - account_name, # type: str - live_event_name, # type: str - parameters, # type: "_models.LiveEventActionInput" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + live_event_name: str, + parameters: "_models.LiveEventActionInput", + **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-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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, 'LiveEventActionInput') + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_event_name=live_event_name, + content_type=content_type, + json=_json, + template_url=self._stop_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, 'LiveEventActionInput') - 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, 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, {}) _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/stop'} # type: ignore + + @distributed_trace def begin_stop( self, - resource_group_name, # type: str - account_name, # type: str - live_event_name, # type: str - parameters, # type: "_models.LiveEventActionInput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + live_event_name: str, + parameters: "_models.LiveEventActionInput", + **kwargs: Any + ) -> LROPoller[None]: """Stop Live Event. Stops a running live event. @@ -915,15 +1183,18 @@ def begin_stop( :type parameters: ~azure.mgmt.media.models.LiveEventActionInput :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] + 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[None] lro_delay = kwargs.pop( 'polling_interval', @@ -936,25 +1207,18 @@ def begin_stop( account_name=account_name, live_event_name=live_event_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): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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: @@ -966,64 +1230,54 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/stop'} # type: ignore def _reset_initial( self, - resource_group_name, # type: str - account_name, # type: str - live_event_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + live_event_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-06-01" - accept = "application/json" - - # Construct URL - url = self._reset_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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_reset_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_event_name=live_event_name, + template_url=self._reset_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, {}) _reset_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/reset'} # type: ignore + + @distributed_trace def begin_reset( self, - resource_group_name, # type: str - account_name, # type: str - live_event_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + live_event_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Reset Live Event. Resets an existing live event. All live outputs for the live event are deleted and the live @@ -1038,15 +1292,17 @@ def begin_reset( :type live_event_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', @@ -1061,22 +1317,14 @@ def begin_reset( 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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: @@ -1088,4 +1336,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reset.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/reset'} # type: ignore diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_live_outputs_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_live_outputs_operations.py index cbfc02ec8b7f..5b93e68d0cdf 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_live_outputs_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_live_outputs_operations.py @@ -5,25 +5,191 @@ # 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, + live_event_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "liveEventName": _SERIALIZER.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + live_event_name: str, + live_output_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "liveEventName": _SERIALIZER.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), + "liveOutputName": _SERIALIZER.url("live_output_name", live_output_name, 'str', max_length=256, min_length=1, pattern=r'^([a-zA-Z0-9])+(-*[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + live_event_name: str, + live_output_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" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "liveEventName": _SERIALIZER.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), + "liveOutputName": _SERIALIZER.url("live_output_name", live_output_name, 'str', max_length=256, min_length=1, pattern=r'^([a-zA-Z0-9])+(-*[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + live_event_name: str, + live_output_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "liveEventName": _SERIALIZER.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), + "liveOutputName": _SERIALIZER.url("live_output_name", live_output_name, 'str', max_length=256, min_length=1, pattern=r'^([a-zA-Z0-9])+(-*[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class LiveOutputsOperations(object): """LiveOutputsOperations operations. @@ -47,14 +213,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 - live_event_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.LiveOutputListResult"] + resource_group_name: str, + account_name: str, + live_event_name: str, + **kwargs: Any + ) -> Iterable["_models.LiveOutputListResult"]: """List Live Outputs. Lists the live outputs of a live event. @@ -66,7 +232,8 @@ def list( :param live_event_name: The name of the live event, maximum length is 32. :type live_event_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either LiveOutputListResult or the result of cls(response) + :return: An iterator like instance of either LiveOutputListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.media.models.LiveOutputListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -75,37 +242,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_event_name=live_event_name, + 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, + live_event_name=live_event_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('LiveOutputListResult', pipeline_response) + deserialized = self._deserialize("LiveOutputListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,26 +283,27 @@ 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/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - live_event_name, # type: str - live_output_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.LiveOutput" + resource_group_name: str, + account_name: str, + live_event_name: str, + live_output_name: str, + **kwargs: Any + ) -> "_models.LiveOutput": """Get Live Output. Gets a live output. @@ -160,35 +326,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - 'liveOutputName': self._serialize.url("live_output_name", live_output_name, 'str', max_length=256, min_length=1, pattern=r'^([a-zA-Z0-9])+(-*[a-zA-Z0-9])*$'), - } - 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_event_name=live_event_name, + live_output_name=live_output_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('LiveOutput', pipeline_response) @@ -197,58 +353,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - account_name, # type: str - live_event_name, # type: str - live_output_name, # type: str - parameters, # type: "_models.LiveOutput" - **kwargs # type: Any - ): - # type: (...) -> "_models.LiveOutput" + resource_group_name: str, + account_name: str, + live_event_name: str, + live_output_name: str, + parameters: "_models.LiveOutput", + **kwargs: Any + ) -> "_models.LiveOutput": cls = kwargs.pop('cls', None) # type: ClsType["_models.LiveOutput"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - 'liveOutputName': self._serialize.url("live_output_name", live_output_name, 'str', max_length=256, min_length=1, pattern=r'^([a-zA-Z0-9])+(-*[a-zA-Z0-9])*$'), - } - 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, 'LiveOutput') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_event_name=live_event_name, + live_output_name=live_output_name, + content_type=content_type, + json=_json, + template_url=self._create_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, 'LiveOutput') - 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) if response.status_code == 200: deserialized = self._deserialize('LiveOutput', pipeline_response) @@ -260,18 +406,20 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - account_name, # type: str - live_event_name, # type: str - live_output_name, # type: str - parameters, # type: "_models.LiveOutput" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.LiveOutput"] + resource_group_name: str, + account_name: str, + live_event_name: str, + live_output_name: str, + parameters: "_models.LiveOutput", + **kwargs: Any + ) -> LROPoller["_models.LiveOutput"]: """Create Live Output. Creates a new live output. @@ -288,15 +436,18 @@ def begin_create( :type parameters: ~azure.mgmt.media.models.LiveOutput :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 LiveOutput or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.media.models.LiveOutput] - :raises ~azure.core.exceptions.HttpResponseError: + :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.LiveOutput"] lro_delay = kwargs.pop( 'polling_interval', @@ -310,29 +461,21 @@ def begin_create( live_event_name=live_event_name, live_output_name=live_output_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('LiveOutput', 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - 'liveOutputName': self._serialize.url("live_output_name", live_output_name, 'str', max_length=256, min_length=1, pattern=r'^([a-zA-Z0-9])+(-*[a-zA-Z0-9])*$'), - } - 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: @@ -344,67 +487,57 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - account_name, # type: str - live_event_name, # type: str - live_output_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + live_event_name: str, + live_output_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-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - 'liveOutputName': self._serialize.url("live_output_name", live_output_name, 'str', max_length=256, min_length=1, pattern=r'^([a-zA-Z0-9])+(-*[a-zA-Z0-9])*$'), - } - 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_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + live_event_name=live_event_name, + live_output_name=live_output_name, + template_url=self._delete_initial.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, 202, 204]: 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, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - account_name, # type: str - live_event_name, # type: str - live_output_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + live_event_name: str, + live_output_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete Live Output. Deletes a live output. Deleting a live output does not delete the asset the live output is @@ -420,15 +553,17 @@ def begin_delete( :type live_output_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', @@ -444,23 +579,14 @@ def begin_delete( 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'liveEventName': self._serialize.url("live_event_name", live_event_name, 'str', max_length=32, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - 'liveOutputName': self._serialize.url("live_output_name", live_output_name, 'str', max_length=256, min_length=1, pattern=r'^([a-zA-Z0-9])+(-*[a-zA-Z0-9])*$'), - } - 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: @@ -472,4 +598,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}'} # type: ignore diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_locations_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_locations_operations.py index 73e7530fe78e..fa7b0da91be7 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_locations_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/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-06-01" + 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'), + "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. @@ -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.CheckNameAvailabilityInput" - **kwargs # type: Any - ): - # type: (...) -> "_models.EntityNameAvailabilityCheckOutput" + location_name: str, + parameters: "_models.CheckNameAvailabilityInput", + **kwargs: Any + ) -> "_models.EntityNameAvailabilityCheckOutput": """Check Name Availability. Checks whether the Media Service resource name is available. @@ -69,37 +114,27 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - '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, 'CheckNameAvailabilityInput') + + 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, 'CheckNameAvailabilityInput') - 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('EntityNameAvailabilityCheckOutput', 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/media/azure-mgmt-media/azure/mgmt/media/operations/_mediaservices_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_mediaservices_operations.py index cb39387ec353..3a324a25fdf6 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_mediaservices_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_mediaservices_operations.py @@ -5,23 +5,336 @@ # 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, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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( + 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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( + 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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_sync_storage_keys_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/syncStorageKeys') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_edge_policies_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/listEdgePolicies') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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="POST", + 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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Media/mediaservices') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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 MediaservicesOperations(object): """MediaservicesOperations operations. @@ -45,12 +358,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: (...) -> Iterable["_models.MediaServiceCollection"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.MediaServiceCollection"]: """List Media Services accounts. List Media Services accounts in the resource group. @@ -58,7 +371,8 @@ def list( :param resource_group_name: The name of the resource group within the Azure subscription. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MediaServiceCollection or the result of cls(response) + :return: An iterator like instance of either MediaServiceCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.media.models.MediaServiceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -67,35 +381,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_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 = self._client.get(url, query_parameters, header_parameters) + + 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) + 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, + 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('MediaServiceCollection', pipeline_response) + deserialized = self._deserialize("MediaServiceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,24 +418,25 @@ 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/mediaservices'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.MediaService" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.MediaService": """Get a Media Services account. Get the details of a Media Services account. @@ -144,33 +455,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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('MediaService', pipeline_response) @@ -179,16 +480,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.MediaService" - **kwargs # type: Any - ): - # type: (...) -> "_models.MediaService" + resource_group_name: str, + account_name: str, + parameters: "_models.MediaService", + **kwargs: Any + ) -> "_models.MediaService": """Create or update a Media Services account. Creates or updates a Media Services account. @@ -209,38 +512,28 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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, 'MediaService') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'MediaService') - 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: @@ -253,15 +546,17 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{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 Media Services account. Deletes a Media Services account. @@ -280,33 +575,23 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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: @@ -314,14 +599,15 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.MediaServiceUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.MediaService" + resource_group_name: str, + account_name: str, + parameters: "_models.MediaServiceUpdate", + **kwargs: Any + ) -> "_models.MediaService": """Update a Media Services account. Updates an existing Media Services account. @@ -342,38 +628,28 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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, 'MediaServiceUpdate') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'MediaServiceUpdate') - 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('MediaService', pipeline_response) @@ -382,16 +658,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}'} # type: ignore + + @distributed_trace def sync_storage_keys( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.SyncStorageKeysInput" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + parameters: "_models.SyncStorageKeysInput", + **kwargs: Any + ) -> None: """Synchronizes Storage Account Keys. Synchronizes storage account keys for a storage account associated with the Media Service @@ -413,38 +691,28 @@ def sync_storage_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.sync_storage_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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, 'SyncStorageKeysInput') + + request = build_sync_storage_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + content_type=content_type, + json=_json, + template_url=self.sync_storage_keys.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, 'SyncStorageKeysInput') - 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) if cls: @@ -452,14 +720,15 @@ def sync_storage_keys( sync_storage_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/syncStorageKeys'} # type: ignore + + @distributed_trace def list_edge_policies( self, - resource_group_name, # type: str - account_name, # type: str - parameters, # type: "_models.ListEdgePoliciesInput" - **kwargs # type: Any - ): - # type: (...) -> "_models.EdgePolicies" + resource_group_name: str, + account_name: str, + parameters: "_models.ListEdgePoliciesInput", + **kwargs: Any + ) -> "_models.EdgePolicies": """List the media edge policies associated with the Media Services account. List the media edge policies associated with the Media Services account. @@ -480,38 +749,28 @@ def list_edge_policies( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_edge_policies.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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, 'ListEdgePoliciesInput') - # 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_edge_policies_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + content_type=content_type, + json=_json, + template_url=self.list_edge_policies.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, 'ListEdgePoliciesInput') - 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('EdgePolicies', pipeline_response) @@ -520,19 +779,22 @@ def list_edge_policies( return cls(pipeline_response, deserialized, {}) return deserialized + list_edge_policies.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/listEdgePolicies'} # type: ignore + + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.MediaServiceCollection"] + **kwargs: Any + ) -> Iterable["_models.MediaServiceCollection"]: """List Media Services accounts. List Media Services accounts in the subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MediaServiceCollection or the result of cls(response) + :return: An iterator like instance of either MediaServiceCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.media.models.MediaServiceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -541,34 +803,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + 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) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('MediaServiceCollection', pipeline_response) + deserialized = self._deserialize("MediaServiceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -581,12 +838,13 @@ 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 ) diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_operation_results_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_operation_results_operations.py new file mode 100644 index 000000000000..7f44d02f2bb2 --- /dev/null +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_operation_results_operations.py @@ -0,0 +1,163 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + asset_name: str, + track_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}/operationResults/{operationId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "assetName": _SERIALIZER.url("asset_name", asset_name, 'str'), + "trackName": _SERIALIZER.url("track_name", track_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. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.media.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + track_name: str, + operation_id: str, + **kwargs: Any + ) -> Optional["_models.AssetTrack"]: + """Get operation result. + + Get asset track operation result. + + :param resource_group_name: The name of the resource group within the Azure subscription. + :type resource_group_name: str + :param account_name: The Media Services account name. + :type account_name: str + :param asset_name: The Asset name. + :type asset_name: str + :param track_name: The Asset Track name. + :type track_name: str + :param operation_id: Operation Id. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AssetTrack, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.AssetTrack or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AssetTrack"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + track_name=track_name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize('AssetTrack', pipeline_response) + + if response.status_code == 202: + 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')) + + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}/operationResults/{operationId}'} # type: ignore + diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_operation_statuses_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_operation_statuses_operations.py new file mode 100644 index 000000000000..809944fa9811 --- /dev/null +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_operation_statuses_operations.py @@ -0,0 +1,154 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + asset_name: str, + track_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}/operationStatuses/{operationId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "assetName": _SERIALIZER.url("asset_name", asset_name, 'str'), + "trackName": _SERIALIZER.url("track_name", track_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. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.media.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + track_name: str, + operation_id: str, + **kwargs: Any + ) -> "_models.AssetTrackOperationStatus": + """Get operation status. + + Get asset track operation status. + + :param resource_group_name: The name of the resource group within the Azure subscription. + :type resource_group_name: str + :param account_name: The Media Services account name. + :type account_name: str + :param asset_name: The Asset name. + :type asset_name: str + :param track_name: The Asset Track name. + :type track_name: str + :param operation_id: Operation Id. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AssetTrackOperationStatus, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.AssetTrackOperationStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AssetTrackOperationStatus"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + track_name=track_name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AssetTrackOperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}/operationStatuses/{operationId}'} # type: ignore + diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_operations.py index 60140de26a25..9af75ecc75f9 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/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-06-01" + 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. @@ -44,11 +71,11 @@ 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 Services operations. @@ -63,27 +90,20 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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/media/azure-mgmt-media/azure/mgmt/media/operations/_private_endpoint_connections_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_private_endpoint_connections_operations.py index dd6637558e63..afebcbe2fadf 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_private_endpoint_connections_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections/{name}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections/{name}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections/{name}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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. @@ -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. @@ -69,33 +227,23 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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/mediaservices/{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. @@ -134,34 +284,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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/mediaservices/{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. @@ -203,39 +345,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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] - # 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, 'PrivateEndpointConnection') + + 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 [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) @@ -244,16 +376,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{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. @@ -274,37 +408,28 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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/mediaservices/{accountName}/privateEndpointConnections/{name}'} # type: ignore + diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_private_link_resources_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_private_link_resources_operations.py index 4eb842f31b6f..c1aa47e5e901 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_private_link_resources_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateLinkResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateLinkResources/{name}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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. @@ -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. @@ -69,33 +143,23 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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/mediaservices/{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. @@ -134,34 +200,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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/mediaservices/{accountName}/privateLinkResources/{name}'} # type: ignore + diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_streaming_endpoints_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_streaming_endpoints_operations.py index 2d4b4f8bb7d5..965cda79e209 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_streaming_endpoints_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_streaming_endpoints_operations.py @@ -5,25 +5,389 @@ # 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, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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, + streaming_endpoint_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "streamingEndpointName": _SERIALIZER.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + streaming_endpoint_name: str, + *, + json: JSONType = None, + content: Any = None, + auto_start: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "streamingEndpointName": _SERIALIZER.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if auto_start is not None: + query_parameters['autoStart'] = _SERIALIZER.query("auto_start", auto_start, 'bool') + + # 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_update_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + streaming_endpoint_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" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "streamingEndpointName": _SERIALIZER.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + streaming_endpoint_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "streamingEndpointName": _SERIALIZER.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_skus_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + streaming_endpoint_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/skus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "streamingEndpointName": _SERIALIZER.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_start_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + streaming_endpoint_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/start') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "streamingEndpointName": _SERIALIZER.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_stop_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + streaming_endpoint_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/stop') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "streamingEndpointName": _SERIALIZER.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_scale_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + streaming_endpoint_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" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/scale') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "streamingEndpointName": _SERIALIZER.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class StreamingEndpointsOperations(object): """StreamingEndpointsOperations operations. @@ -47,13 +411,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: (...) -> Iterable["_models.StreamingEndpointListResult"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.StreamingEndpointListResult"]: """List StreamingEndpoints. Lists the streaming endpoints in the account. @@ -63,7 +427,8 @@ def list( :param account_name: The Media Services account name. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StreamingEndpointListResult or the result of cls(response) + :return: An iterator like instance of either StreamingEndpointListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.media.models.StreamingEndpointListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -72,36 +437,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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 = 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, + 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, + 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('StreamingEndpointListResult', pipeline_response) + deserialized = self._deserialize("StreamingEndpointListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,25 +476,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/mediaservices/{accountName}/streamingEndpoints'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - streaming_endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StreamingEndpoint" + resource_group_name: str, + account_name: str, + streaming_endpoint_name: str, + **kwargs: Any + ) -> "_models.StreamingEndpoint": """Get StreamingEndpoint. Gets a streaming endpoint. @@ -153,34 +516,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingEndpointName': self._serialize.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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, + streaming_endpoint_name=streaming_endpoint_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('StreamingEndpoint', pipeline_response) @@ -189,59 +542,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - account_name, # type: str - streaming_endpoint_name, # type: str - parameters, # type: "_models.StreamingEndpoint" - auto_start=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> "_models.StreamingEndpoint" + resource_group_name: str, + account_name: str, + streaming_endpoint_name: str, + parameters: "_models.StreamingEndpoint", + auto_start: Optional[bool] = None, + **kwargs: Any + ) -> "_models.StreamingEndpoint": cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingEndpoint"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingEndpointName': self._serialize.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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 auto_start is not None: - query_parameters['autoStart'] = self._serialize.query("auto_start", auto_start, 'bool') - - # 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') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'StreamingEndpoint') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'StreamingEndpoint') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + streaming_endpoint_name=streaming_endpoint_name, + content_type=content_type, + json=_json, + auto_start=auto_start, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 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) if response.status_code == 200: deserialized = self._deserialize('StreamingEndpoint', pipeline_response) @@ -253,18 +595,20 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - account_name, # type: str - streaming_endpoint_name, # type: str - parameters, # type: "_models.StreamingEndpoint" - auto_start=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StreamingEndpoint"] + resource_group_name: str, + account_name: str, + streaming_endpoint_name: str, + parameters: "_models.StreamingEndpoint", + auto_start: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller["_models.StreamingEndpoint"]: """Create StreamingEndpoint. Creates a streaming endpoint. @@ -282,15 +626,19 @@ def begin_create( :type auto_start: bool :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 StreamingEndpoint or the result of cls(response) + :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 StreamingEndpoint or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.media.models.StreamingEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: + :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.StreamingEndpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -304,28 +652,21 @@ def begin_create( streaming_endpoint_name=streaming_endpoint_name, parameters=parameters, auto_start=auto_start, + 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('StreamingEndpoint', 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingEndpointName': self._serialize.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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: @@ -337,56 +678,45 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - account_name, # type: str - streaming_endpoint_name, # type: str - parameters, # type: "_models.StreamingEndpoint" - **kwargs # type: Any - ): - # type: (...) -> "_models.StreamingEndpoint" + resource_group_name: str, + account_name: str, + streaming_endpoint_name: str, + parameters: "_models.StreamingEndpoint", + **kwargs: Any + ) -> "_models.StreamingEndpoint": cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingEndpoint"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingEndpointName': self._serialize.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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, 'StreamingEndpoint') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + streaming_endpoint_name=streaming_endpoint_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, 'StreamingEndpoint') - 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, 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 response.status_code == 200: deserialized = self._deserialize('StreamingEndpoint', pipeline_response) @@ -398,17 +728,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - account_name, # type: str - streaming_endpoint_name, # type: str - parameters, # type: "_models.StreamingEndpoint" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StreamingEndpoint"] + resource_group_name: str, + account_name: str, + streaming_endpoint_name: str, + parameters: "_models.StreamingEndpoint", + **kwargs: Any + ) -> LROPoller["_models.StreamingEndpoint"]: """Update StreamingEndpoint. Updates a existing streaming endpoint. @@ -423,15 +755,19 @@ def begin_update( :type parameters: ~azure.mgmt.media.models.StreamingEndpoint :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 StreamingEndpoint or the result of cls(response) + :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 StreamingEndpoint or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.media.models.StreamingEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: + :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.StreamingEndpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -444,28 +780,21 @@ def begin_update( account_name=account_name, streaming_endpoint_name=streaming_endpoint_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('StreamingEndpoint', 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingEndpointName': self._serialize.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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: @@ -477,64 +806,54 @@ 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/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - account_name, # type: str - streaming_endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + streaming_endpoint_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-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingEndpointName': self._serialize.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + streaming_endpoint_name=streaming_endpoint_name, + template_url=self._delete_initial.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, 202, 204]: 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, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - account_name, # type: str - streaming_endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + streaming_endpoint_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete StreamingEndpoint. Deletes a streaming endpoint. @@ -547,15 +866,17 @@ def begin_delete( :type streaming_endpoint_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', @@ -570,22 +891,14 @@ def begin_delete( 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingEndpointName': self._serialize.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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: @@ -597,64 +910,112 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}'} # type: ignore + @distributed_trace + def skus( + self, + resource_group_name: str, + account_name: str, + streaming_endpoint_name: str, + **kwargs: Any + ) -> "_models.StreamingEndpointSkuInfoListResult": + """List StreamingEndpoint skus. + + List streaming endpoint supported skus. + + :param resource_group_name: The name of the resource group within the Azure subscription. + :type resource_group_name: str + :param account_name: The Media Services account name. + :type account_name: str + :param streaming_endpoint_name: The name of the streaming endpoint, maximum length is 24. + :type streaming_endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StreamingEndpointSkuInfoListResult, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.StreamingEndpointSkuInfoListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingEndpointSkuInfoListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_skus_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + streaming_endpoint_name=streaming_endpoint_name, + template_url=self.skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StreamingEndpointSkuInfoListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/skus'} # type: ignore + + def _start_initial( self, - resource_group_name, # type: str - account_name, # type: str - streaming_endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + streaming_endpoint_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-06-01" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingEndpointName': self._serialize.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + streaming_endpoint_name=streaming_endpoint_name, + template_url=self._start_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, {}) _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/start'} # type: ignore + + @distributed_trace def begin_start( self, - resource_group_name, # type: str - account_name, # type: str - streaming_endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + streaming_endpoint_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Start StreamingEndpoint. Starts an existing streaming endpoint. @@ -667,15 +1028,17 @@ def begin_start( :type streaming_endpoint_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', @@ -690,22 +1053,14 @@ def begin_start( 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingEndpointName': self._serialize.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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: @@ -717,64 +1072,54 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/start'} # type: ignore def _stop_initial( self, - resource_group_name, # type: str - account_name, # type: str - streaming_endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + streaming_endpoint_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-06-01" - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingEndpointName': self._serialize.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + streaming_endpoint_name=streaming_endpoint_name, + template_url=self._stop_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, {}) _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/stop'} # type: ignore + + @distributed_trace def begin_stop( self, - resource_group_name, # type: str - account_name, # type: str - streaming_endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + streaming_endpoint_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Stop StreamingEndpoint. Stops an existing streaming endpoint. @@ -787,15 +1132,17 @@ def begin_stop( :type streaming_endpoint_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', @@ -810,22 +1157,14 @@ def begin_stop( 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingEndpointName': self._serialize.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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: @@ -837,71 +1176,61 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/stop'} # type: ignore def _scale_initial( self, - resource_group_name, # type: str - account_name, # type: str - streaming_endpoint_name, # type: str - parameters, # type: "_models.StreamingEntityScaleUnit" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + streaming_endpoint_name: str, + parameters: "_models.StreamingEntityScaleUnit", + **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-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._scale_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingEndpointName': self._serialize.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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, 'StreamingEntityScaleUnit') - # 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_scale_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + streaming_endpoint_name=streaming_endpoint_name, + content_type=content_type, + json=_json, + template_url=self._scale_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, 'StreamingEntityScaleUnit') - 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, 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, {}) _scale_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/scale'} # type: ignore + + @distributed_trace def begin_scale( self, - resource_group_name, # type: str - account_name, # type: str - streaming_endpoint_name, # type: str - parameters, # type: "_models.StreamingEntityScaleUnit" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + streaming_endpoint_name: str, + parameters: "_models.StreamingEntityScaleUnit", + **kwargs: Any + ) -> LROPoller[None]: """Scale StreamingEndpoint. Scales an existing streaming endpoint. @@ -916,15 +1245,18 @@ def begin_scale( :type parameters: ~azure.mgmt.media.models.StreamingEntityScaleUnit :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] + 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[None] lro_delay = kwargs.pop( 'polling_interval', @@ -937,25 +1269,18 @@ def begin_scale( account_name=account_name, streaming_endpoint_name=streaming_endpoint_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): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingEndpointName': self._serialize.url("streaming_endpoint_name", streaming_endpoint_name, 'str', max_length=24, min_length=1, pattern=r'^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$'), - } - 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: @@ -967,4 +1292,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_scale.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/scale'} # type: ignore diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_streaming_locators_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_streaming_locators_operations.py index 9b4bcc238e2e..a747b326773e 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_streaming_locators_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_streaming_locators_operations.py @@ -5,23 +5,265 @@ # 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 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 - - 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, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, '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, + streaming_locator_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "streamingLocatorName": _SERIALIZER.url("streaming_locator_name", streaming_locator_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_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + streaming_locator_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" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "streamingLocatorName": _SERIALIZER.url("streaming_locator_name", streaming_locator_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, + streaming_locator_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "streamingLocatorName": _SERIALIZER.url("streaming_locator_name", streaming_locator_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_content_keys_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + streaming_locator_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}/listContentKeys') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "streamingLocatorName": _SERIALIZER.url("streaming_locator_name", streaming_locator_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_list_paths_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + streaming_locator_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}/listPaths') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "streamingLocatorName": _SERIALIZER.url("streaming_locator_name", streaming_locator_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 StreamingLocatorsOperations(object): """StreamingLocatorsOperations operations. @@ -45,16 +287,16 @@ 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] - orderby=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StreamingLocatorCollection"] + resource_group_name: str, + account_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.StreamingLocatorCollection"]: """List Streaming Locators. Lists the Streaming Locators in the account. @@ -72,7 +314,8 @@ def list( :param orderby: Specifies the key by which the result collection should be ordered. :type orderby: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StreamingLocatorCollection or the result of cls(response) + :return: An iterator like instance of either StreamingLocatorCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.media.models.StreamingLocatorCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -81,42 +324,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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') - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - - 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, + orderby=orderby, + 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, + orderby=orderby, + 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('StreamingLocatorCollection', pipeline_response) + deserialized = self._deserialize("StreamingLocatorCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -129,25 +369,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/mediaServices/{accountName}/streamingLocators'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - streaming_locator_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StreamingLocator" + resource_group_name: str, + account_name: str, + streaming_locator_name: str, + **kwargs: Any + ) -> "_models.StreamingLocator": """Get a Streaming Locator. Get the details of a Streaming Locator in the Media Services account. @@ -168,34 +409,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingLocatorName': self._serialize.url("streaming_locator_name", streaming_locator_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, + streaming_locator_name=streaming_locator_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('StreamingLocator', pipeline_response) @@ -204,17 +435,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}'} # type: ignore + + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - streaming_locator_name, # type: str - parameters, # type: "_models.StreamingLocator" - **kwargs # type: Any - ): - # type: (...) -> "_models.StreamingLocator" + resource_group_name: str, + account_name: str, + streaming_locator_name: str, + parameters: "_models.StreamingLocator", + **kwargs: Any + ) -> "_models.StreamingLocator": """Create a Streaming Locator. Create a Streaming Locator in the Media Services account. @@ -237,39 +470,29 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingLocatorName': self._serialize.url("streaming_locator_name", streaming_locator_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, 'StreamingLocator') + + request = build_create_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + streaming_locator_name=streaming_locator_name, + content_type=content_type, + json=_json, + template_url=self.create.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, 'StreamingLocator') - 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) deserialized = self._deserialize('StreamingLocator', pipeline_response) @@ -278,16 +501,18 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - streaming_locator_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + streaming_locator_name: str, + **kwargs: Any + ) -> None: """Delete a Streaming Locator. Deletes a Streaming Locator in the Media Services account. @@ -308,34 +533,24 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingLocatorName': self._serialize.url("streaming_locator_name", streaming_locator_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, + streaming_locator_name=streaming_locator_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: @@ -343,14 +558,15 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}'} # type: ignore + + @distributed_trace def list_content_keys( self, - resource_group_name, # type: str - account_name, # type: str - streaming_locator_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ListContentKeysResponse" + resource_group_name: str, + account_name: str, + streaming_locator_name: str, + **kwargs: Any + ) -> "_models.ListContentKeysResponse": """List Content Keys. List Content Keys used by this Streaming Locator. @@ -371,34 +587,24 @@ def list_content_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list_content_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingLocatorName': self._serialize.url("streaming_locator_name", streaming_locator_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_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + streaming_locator_name=streaming_locator_name, + template_url=self.list_content_keys.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('ListContentKeysResponse', pipeline_response) @@ -407,16 +613,18 @@ def list_content_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_content_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}/listContentKeys'} # type: ignore + + @distributed_trace def list_paths( self, - resource_group_name, # type: str - account_name, # type: str - streaming_locator_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ListPathsResponse" + resource_group_name: str, + account_name: str, + streaming_locator_name: str, + **kwargs: Any + ) -> "_models.ListPathsResponse": """List Paths. List Paths supported by this Streaming Locator. @@ -437,34 +645,24 @@ def list_paths( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list_paths.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingLocatorName': self._serialize.url("streaming_locator_name", streaming_locator_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_paths_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + streaming_locator_name=streaming_locator_name, + template_url=self.list_paths.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('ListPathsResponse', pipeline_response) @@ -473,4 +671,6 @@ def list_paths( return cls(pipeline_response, deserialized, {}) return deserialized + list_paths.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}/listPaths'} # type: ignore + diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_streaming_policies_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_streaming_policies_operations.py index af9fee745a8e..721e4aee85d2 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_streaming_policies_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_streaming_policies_operations.py @@ -5,23 +5,191 @@ # 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 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 - - 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, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, '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, + streaming_policy_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "streamingPolicyName": _SERIALIZER.url("streaming_policy_name", streaming_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_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + streaming_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" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "streamingPolicyName": _SERIALIZER.url("streaming_policy_name", streaming_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, + streaming_policy_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "streamingPolicyName": _SERIALIZER.url("streaming_policy_name", streaming_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 + ) class StreamingPoliciesOperations(object): """StreamingPoliciesOperations operations. @@ -45,16 +213,16 @@ 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] - orderby=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StreamingPolicyCollection"] + resource_group_name: str, + account_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.StreamingPolicyCollection"]: """List Streaming Policies. Lists the Streaming Policies in the account. @@ -72,7 +240,8 @@ def list( :param orderby: Specifies the key by which the result collection should be ordered. :type orderby: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StreamingPolicyCollection or the result of cls(response) + :return: An iterator like instance of either StreamingPolicyCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.media.models.StreamingPolicyCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -81,42 +250,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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') - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - - 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, + orderby=orderby, + 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, + orderby=orderby, + 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('StreamingPolicyCollection', pipeline_response) + deserialized = self._deserialize("StreamingPolicyCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -129,25 +295,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/mediaServices/{accountName}/streamingPolicies'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - streaming_policy_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StreamingPolicy" + resource_group_name: str, + account_name: str, + streaming_policy_name: str, + **kwargs: Any + ) -> "_models.StreamingPolicy": """Get a Streaming Policy. Get the details of a Streaming Policy in the Media Services account. @@ -168,34 +335,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingPolicyName': self._serialize.url("streaming_policy_name", streaming_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, + streaming_policy_name=streaming_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('StreamingPolicy', pipeline_response) @@ -204,17 +361,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName}'} # type: ignore + + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - streaming_policy_name, # type: str - parameters, # type: "_models.StreamingPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.StreamingPolicy" + resource_group_name: str, + account_name: str, + streaming_policy_name: str, + parameters: "_models.StreamingPolicy", + **kwargs: Any + ) -> "_models.StreamingPolicy": """Create a Streaming Policy. Create a Streaming Policy in the Media Services account. @@ -237,39 +396,29 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingPolicyName': self._serialize.url("streaming_policy_name", streaming_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, 'StreamingPolicy') + + request = build_create_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + streaming_policy_name=streaming_policy_name, + content_type=content_type, + json=_json, + template_url=self.create.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, 'StreamingPolicy') - 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) deserialized = self._deserialize('StreamingPolicy', pipeline_response) @@ -278,16 +427,18 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - streaming_policy_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + streaming_policy_name: str, + **kwargs: Any + ) -> None: """Delete a Streaming Policy. Deletes a Streaming Policy in the Media Services account. @@ -308,37 +459,28 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'streamingPolicyName': self._serialize.url("streaming_policy_name", streaming_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, + streaming_policy_name=streaming_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: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName}'} # type: ignore + diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_tracks_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_tracks_operations.py new file mode 100644 index 000000000000..d8e8e6c8f388 --- /dev/null +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_tracks_operations.py @@ -0,0 +1,968 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, 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 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 +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, + asset_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "assetName": _SERIALIZER.url("asset_name", asset_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, + asset_name: str, + track_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "assetName": _SERIALIZER.url("asset_name", asset_name, 'str'), + "trackName": _SERIALIZER.url("track_name", track_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, + asset_name: str, + track_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" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "assetName": _SERIALIZER.url("asset_name", asset_name, 'str'), + "trackName": _SERIALIZER.url("track_name", track_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_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + asset_name: str, + track_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "assetName": _SERIALIZER.url("asset_name", asset_name, 'str'), + "trackName": _SERIALIZER.url("track_name", track_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, + asset_name: str, + track_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" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "assetName": _SERIALIZER.url("asset_name", asset_name, 'str'), + "trackName": _SERIALIZER.url("track_name", track_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_update_track_data_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + asset_name: str, + track_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}/updateTrackData') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "assetName": _SERIALIZER.url("asset_name", asset_name, 'str'), + "trackName": _SERIALIZER.url("track_name", track_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 TracksOperations(object): + """TracksOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.media.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + **kwargs: Any + ) -> Iterable["_models.AssetTrackCollection"]: + """List Tracks in the Asset. + + Lists the Tracks in the asset. + + :param resource_group_name: The name of the resource group within the Azure subscription. + :type resource_group_name: str + :param account_name: The Media Services account name. + :type account_name: str + :param asset_name: The Asset name. + :type asset_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AssetTrackCollection or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.media.models.AssetTrackCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AssetTrackCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AssetTrackCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks'} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + track_name: str, + **kwargs: Any + ) -> "_models.AssetTrack": + """Get a Track. + + Get the details of a Track in the Asset. + + :param resource_group_name: The name of the resource group within the Azure subscription. + :type resource_group_name: str + :param account_name: The Media Services account name. + :type account_name: str + :param asset_name: The Asset name. + :type asset_name: str + :param track_name: The Asset Track name. + :type track_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AssetTrack, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.AssetTrack + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AssetTrack"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + track_name=track_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AssetTrack', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}'} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + track_name: str, + parameters: "_models.AssetTrack", + **kwargs: Any + ) -> "_models.AssetTrack": + cls = kwargs.pop('cls', None) # type: ClsType["_models.AssetTrack"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AssetTrack') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + track_name=track_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) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + 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('AssetTrack', pipeline_response) + + if response.status_code == 201: + 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('AssetTrack', 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/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + track_name: str, + parameters: "_models.AssetTrack", + **kwargs: Any + ) -> LROPoller["_models.AssetTrack"]: + """Create or update a Track. + + Create or update a Track in the asset. + + :param resource_group_name: The name of the resource group within the Azure subscription. + :type resource_group_name: str + :param account_name: The Media Services account name. + :type account_name: str + :param asset_name: The Asset name. + :type asset_name: str + :param track_name: The Asset Track name. + :type track_name: str + :param parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.AssetTrack + :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. + :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 AssetTrack or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.media.models.AssetTrack] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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.AssetTrack"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + track_name=track_name, + parameters=parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_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('AssetTrack', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + track_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', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + track_name=track_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + 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')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + track_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a Track. + + Deletes a Track in the asset. + + :param resource_group_name: The name of the resource group within the Azure subscription. + :type resource_group_name: str + :param account_name: The Media Services account name. + :type account_name: str + :param asset_name: The Asset name. + :type asset_name: str + :param track_name: The Asset Track name. + :type track_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. + :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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + track_name=track_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}'} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + track_name: str, + parameters: "_models.AssetTrack", + **kwargs: Any + ) -> "_models.AssetTrack": + cls = kwargs.pop('cls', None) # type: ClsType["_models.AssetTrack"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AssetTrack') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + track_name=track_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) + + 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) + 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('AssetTrack', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}'} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + track_name: str, + parameters: "_models.AssetTrack", + **kwargs: Any + ) -> LROPoller["_models.AssetTrack"]: + """Update an Track. + + Updates an existing Track in the asset. + + :param resource_group_name: The name of the resource group within the Azure subscription. + :type resource_group_name: str + :param account_name: The Media Services account name. + :type account_name: str + :param asset_name: The Asset name. + :type asset_name: str + :param track_name: The Asset Track name. + :type track_name: str + :param parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.AssetTrack + :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. + :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 AssetTrack or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.media.models.AssetTrack] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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.AssetTrack"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + track_name=track_name, + parameters=parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_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('AssetTrack', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}'} # type: ignore + + def _update_track_data_initial( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + track_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', {})) + + + request = build_update_track_data_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + track_name=track_name, + template_url=self._update_track_data_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _update_track_data_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}/updateTrackData'} # type: ignore + + + @distributed_trace + def begin_update_track_data( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + track_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Update the track data. + + Update the track data. Call this API after any changes are made to the track data stored in the + asset container. For example, you have modified the WebVTT captions file in the Azure blob + storage container for the asset, viewers will not see the new version of the captions unless + this API is called. Note, the changes may not be reflected immediately. CDN cache may also need + to be purged if applicable. + + :param resource_group_name: The name of the resource group within the Azure subscription. + :type resource_group_name: str + :param account_name: The Media Services account name. + :type account_name: str + :param asset_name: The Asset name. + :type asset_name: str + :param track_name: The Asset Track name. + :type track_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. + :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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_track_data_initial( + resource_group_name=resource_group_name, + account_name=account_name, + asset_name=asset_name, + track_name=track_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_track_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}/updateTrackData'} # type: ignore diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_transforms_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_transforms_operations.py index 612fdcd385f6..52fac0e6b080 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_transforms_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_transforms_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, + orderby: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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 orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, '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, + transform_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "transformName": _SERIALIZER.url("transform_name", transform_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, + transform_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" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "transformName": _SERIALIZER.url("transform_name", transform_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, + transform_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "transformName": _SERIALIZER.url("transform_name", transform_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, + transform_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" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "transformName": _SERIALIZER.url("transform_name", transform_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 TransformsOperations(object): """TransformsOperations operations. @@ -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] - orderby=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.TransformCollection"] + resource_group_name: str, + account_name: str, + filter: Optional[str] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.TransformCollection"]: """List Transforms. Lists the Transforms in the account. @@ -76,40 +287,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - '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 orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - - 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, + orderby=orderby, + 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, + orderby=orderby, + 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('TransformCollection', pipeline_response) + deserialized = self._deserialize("TransformCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -122,25 +330,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/mediaServices/{accountName}/transforms'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - transform_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Transform" + resource_group_name: str, + account_name: str, + transform_name: str, + **kwargs: Any + ) -> "_models.Transform": """Get Transform. Gets a Transform. @@ -161,34 +370,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'transformName': self._serialize.url("transform_name", transform_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, + transform_name=transform_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('Transform', pipeline_response) @@ -197,17 +396,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - transform_name, # type: str - parameters, # type: "_models.Transform" - **kwargs # type: Any - ): - # type: (...) -> "_models.Transform" + resource_group_name: str, + account_name: str, + transform_name: str, + parameters: "_models.Transform", + **kwargs: Any + ) -> "_models.Transform": """Create or Update Transform. Creates or updates a new Transform. @@ -230,39 +431,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'transformName': self._serialize.url("transform_name", transform_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, 'Transform') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + transform_name=transform_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, 'Transform') - 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: @@ -275,16 +466,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - account_name, # type: str - transform_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + transform_name: str, + **kwargs: Any + ) -> None: """Delete Transform. Deletes a Transform. @@ -305,34 +498,24 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'transformName': self._serialize.url("transform_name", transform_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, + transform_name=transform_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: @@ -340,15 +523,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - account_name, # type: str - transform_name, # type: str - parameters, # type: "_models.Transform" - **kwargs # type: Any - ): - # type: (...) -> "_models.Transform" + resource_group_name: str, + account_name: str, + transform_name: str, + parameters: "_models.Transform", + **kwargs: Any + ) -> "_models.Transform": """Update Transform. Updates a Transform. @@ -371,39 +555,29 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'transformName': self._serialize.url("transform_name", transform_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, 'Transform') - # 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, + transform_name=transform_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, 'Transform') - 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('Transform', pipeline_response) @@ -412,4 +586,6 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}'} # type: ignore +