From 0c974c7d9d9e49f4945fd5283592d31daf8c1860 Mon Sep 17 00:00:00 2001 From: 00Kai0 Date: Tue, 1 Dec 2020 14:59:19 +0800 Subject: [PATCH 1/2] generate media track2 version --- sdk/media/azure-mgmt-media/CHANGELOG.md | 30 + sdk/media/azure-mgmt-media/README.md | 10 +- .../azure/mgmt/media/__init__.py | 19 +- .../azure/mgmt/media/_azure_media_services.py | 130 +- .../azure/mgmt/media/_configuration.py | 81 +- .../mgmt/media/{version.py => _version.py} | 9 +- .../azure/mgmt/media/aio/__init__.py | 10 + .../mgmt/media/aio/_azure_media_services.py | 139 + .../azure/mgmt/media/aio/_configuration.py | 66 + .../mgmt/media/aio/operations/__init__.py | 43 + .../operations/_account_filters_operations.py | 398 ++ .../operations/_asset_filters_operations.py | 418 ++ .../aio/operations/_assets_operations.py | 620 ++ .../_content_key_policies_operations.py | 482 ++ .../media/aio/operations/_jobs_operations.py | 492 ++ .../aio/operations/_live_events_operations.py | 1073 ++++ .../operations/_live_outputs_operations.py | 467 ++ .../aio/operations/_locations_operations.py | 106 + .../operations/_mediaservices_operations.py | 638 ++ .../mgmt/media/aio/operations/_operations.py | 107 + ...private_endpoint_connections_operations.py | 302 + .../_private_link_resources_operations.py | 167 + .../_streaming_endpoints_operations.py | 954 +++ .../_streaming_locators_operations.py | 468 ++ .../_streaming_policies_operations.py | 338 + .../aio/operations/_transforms_operations.py | 408 ++ .../azure/mgmt/media/models/__init__.py | 562 +- .../models/_azure_media_services_enums.py | 757 ++- .../azure/mgmt/media/models/_models.py | 5195 +++++++++------ .../azure/mgmt/media/models/_models_py3.py | 5717 +++++++++++------ .../azure/mgmt/media/models/_paged_models.py | 196 - .../azure/mgmt/media/operations/__init__.py | 11 +- .../operations/_account_filters_operations.py | 454 +- .../operations/_asset_filters_operations.py | 459 +- .../media/operations/_assets_operations.py | 711 +- .../_content_key_policies_operations.py | 538 +- .../mgmt/media/operations/_jobs_operations.py | 530 +- .../operations/_live_events_operations.py | 1308 ++-- .../operations/_live_outputs_operations.py | 559 +- .../media/operations/_locations_operations.py | 125 +- .../operations/_mediaservices_operations.py | 784 +-- .../mgmt/media/operations/_operations.py | 122 +- ...private_endpoint_connections_operations.py | 310 + .../_private_link_resources_operations.py | 173 + .../_streaming_endpoints_operations.py | 1182 ++-- .../_streaming_locators_operations.py | 518 +- .../_streaming_policies_operations.py | 370 +- .../operations/_transforms_operations.py | 461 +- .../azure/mgmt/media/py.typed | 1 + sdk/media/azure-mgmt-media/setup.py | 2 +- 50 files changed, 20435 insertions(+), 8585 deletions(-) rename sdk/media/azure-mgmt-media/azure/mgmt/media/{version.py => _version.py} (84%) create mode 100644 sdk/media/azure-mgmt-media/azure/mgmt/media/aio/__init__.py create mode 100644 sdk/media/azure-mgmt-media/azure/mgmt/media/aio/_azure_media_services.py create mode 100644 sdk/media/azure-mgmt-media/azure/mgmt/media/aio/_configuration.py create mode 100644 sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/__init__.py create mode 100644 sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_account_filters_operations.py create mode 100644 sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_asset_filters_operations.py create mode 100644 sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_assets_operations.py create mode 100644 sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_content_key_policies_operations.py create mode 100644 sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_jobs_operations.py create mode 100644 sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_live_events_operations.py create mode 100644 sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_live_outputs_operations.py create mode 100644 sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_locations_operations.py create mode 100644 sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_mediaservices_operations.py create mode 100644 sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_operations.py create mode 100644 sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_private_endpoint_connections_operations.py create mode 100644 sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_private_link_resources_operations.py create mode 100644 sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_streaming_endpoints_operations.py create mode 100644 sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_streaming_locators_operations.py create mode 100644 sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_streaming_policies_operations.py create mode 100644 sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_transforms_operations.py delete mode 100644 sdk/media/azure-mgmt-media/azure/mgmt/media/models/_paged_models.py create mode 100644 sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_private_endpoint_connections_operations.py create mode 100644 sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_private_link_resources_operations.py create mode 100644 sdk/media/azure-mgmt-media/azure/mgmt/media/py.typed diff --git a/sdk/media/azure-mgmt-media/CHANGELOG.md b/sdk/media/azure-mgmt-media/CHANGELOG.md index 98dc3ffc8382..aa5ee752fb32 100644 --- a/sdk/media/azure-mgmt-media/CHANGELOG.md +++ b/sdk/media/azure-mgmt-media/CHANGELOG.md @@ -1,5 +1,35 @@ # Release History +## 7.0.0b1 (2020-12-01) + +This is beta preview version. + +This version uses a next-generation code generator that introduces important breaking changes, but also important new features (like unified authentication and async programming). + +**General breaking changes** + +- Credential system has been completly revamped: + + - `azure.common.credentials` or `msrestazure.azure_active_directory` instances are no longer supported, use the `azure-identity` classes instead: https://pypi.org/project/azure-identity/ + - `credentials` parameter has been renamed `credential` + +- The `config` attribute no longer exists on a client, configuration should be passed as kwarg. Example: `MyClient(credential, subscription_id, enable_logging=True)`. For a complete set of + supported options, see the [parameters accept in init documentation of azure-core](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies) +- You can't import a `version` module anymore, use `__version__` instead +- Operations that used to return a `msrest.polling.LROPoller` now returns a `azure.core.polling.LROPoller` and are prefixed with `begin_`. +- Exceptions tree have been simplified and most exceptions are now `azure.core.exceptions.HttpResponseError` (`CloudError` has been removed). +- Most of the operation kwarg have changed. Some of the most noticeable: + + - `raw` has been removed. Equivalent feature can be found using `cls`, a callback that will give access to internal HTTP response for advanced user + - For a complete set of + supported options, see the [parameters accept in Request documentation of azure-core](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies) + +**General new features** + +- Type annotations support using `typing`. SDKs are mypy ready. +- This client has now stable and official support for async. Check the `aio` namespace of your package to find the async client. +- This client now support natively tracing library like OpenCensus or OpenTelemetry. See this [tracing quickstart](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/core/azure-core-tracing-opentelemetry) for an overview. + ## 2.2.0 (2020-05-29) **Features** diff --git a/sdk/media/azure-mgmt-media/README.md b/sdk/media/azure-mgmt-media/README.md index 022f05279799..49dde3a85a7a 100644 --- a/sdk/media/azure-mgmt-media/README.md +++ b/sdk/media/azure-mgmt-media/README.md @@ -7,8 +7,14 @@ For a more complete view of Azure libraries, see the [azure sdk python release]( # Usage -For code examples, see [Media Services](https://docs.microsoft.com/python/api/overview/azure/media-services) -on docs.microsoft.com. + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [Media Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) # Provide Feedback 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 bfa736c133cd..69767e61f86f 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/__init__.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/__init__.py @@ -1,19 +1,16 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._configuration import AzureMediaServicesConfiguration from ._azure_media_services import AzureMediaServices -__all__ = ['AzureMediaServices', 'AzureMediaServicesConfiguration'] - -from .version import VERSION - -__version__ = VERSION +__all__ = ['AzureMediaServices'] +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass 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 5a3d6fac6449..03c1a67a4d45 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 @@ -1,21 +1,28 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.service_client import SDKClient -from msrest import Serializer, Deserializer +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential from ._configuration import AzureMediaServicesConfiguration from .operations import AccountFiltersOperations from .operations import Operations from .operations import MediaservicesOperations +from .operations import PrivateLinkResourcesOperations +from .operations import PrivateEndpointConnectionsOperations from .operations import LocationsOperations from .operations import AssetsOperations from .operations import AssetFiltersOperations @@ -30,86 +37,109 @@ from . import models -class AzureMediaServices(SDKClient): - """AzureMediaServices +class AzureMediaServices(object): + """This Swagger was generated by the API Framework. - :ivar config: Configuration for client. - :vartype config: AzureMediaServicesConfiguration - - :ivar account_filters: AccountFilters operations + :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: Mediaservices operations + :ivar mediaservices: MediaservicesOperations operations :vartype mediaservices: azure.mgmt.media.operations.MediaservicesOperations - :ivar locations: Locations operations + :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 + :ivar locations: LocationsOperations operations :vartype locations: azure.mgmt.media.operations.LocationsOperations - :ivar assets: Assets operations + :ivar assets: AssetsOperations operations :vartype assets: azure.mgmt.media.operations.AssetsOperations - :ivar asset_filters: AssetFilters operations + :ivar asset_filters: AssetFiltersOperations operations :vartype asset_filters: azure.mgmt.media.operations.AssetFiltersOperations - :ivar content_key_policies: ContentKeyPolicies operations + :ivar content_key_policies: ContentKeyPoliciesOperations operations :vartype content_key_policies: azure.mgmt.media.operations.ContentKeyPoliciesOperations - :ivar transforms: Transforms operations + :ivar transforms: TransformsOperations operations :vartype transforms: azure.mgmt.media.operations.TransformsOperations - :ivar jobs: Jobs operations + :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.media.operations.JobsOperations - :ivar streaming_policies: StreamingPolicies operations + :ivar streaming_policies: StreamingPoliciesOperations operations :vartype streaming_policies: azure.mgmt.media.operations.StreamingPoliciesOperations - :ivar streaming_locators: StreamingLocators operations + :ivar streaming_locators: StreamingLocatorsOperations operations :vartype streaming_locators: azure.mgmt.media.operations.StreamingLocatorsOperations - :ivar live_events: LiveEvents operations + :ivar live_events: LiveEventsOperations operations :vartype live_events: azure.mgmt.media.operations.LiveEventsOperations - :ivar live_outputs: LiveOutputs operations + :ivar live_outputs: LiveOutputsOperations operations :vartype live_outputs: azure.mgmt.media.operations.LiveOutputsOperations - :ivar streaming_endpoints: StreamingEndpoints operations + :ivar streaming_endpoints: StreamingEndpointsOperations operations :vartype streaming_endpoints: azure.mgmt.media.operations.StreamingEndpointsOperations - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: The unique identifier for a Microsoft Azure - subscription. + :param credential: Credential needed for the client to connect to Azure. + :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. """ def __init__( - self, credentials, subscription_id, base_url=None): - - self.config = AzureMediaServicesConfiguration(credentials, subscription_id, base_url) - super(AzureMediaServices, self).__init__(self.config.credentials, self.config) + 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) + 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.api_version = '2018-07-01' self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.account_filters = AccountFiltersOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.operations = Operations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.mediaservices = MediaservicesOperations( - self._client, self.config, self._serialize, self._deserialize) + 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._client, self._config, self._serialize, self._deserialize) self.assets = AssetsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.asset_filters = AssetFiltersOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.content_key_policies = ContentKeyPoliciesOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.transforms = TransformsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.jobs = JobsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.streaming_policies = StreamingPoliciesOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.streaming_locators = StreamingLocatorsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.live_events = LiveEventsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.live_outputs = LiveOutputsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.streaming_endpoints = StreamingEndpointsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> AzureMediaServices + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) 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 842d5dcd6c44..c2d56eb3fc63 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/_configuration.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/_configuration.py @@ -1,49 +1,70 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrestazure import AzureConfiguration -from .version import VERSION +from typing import TYPE_CHECKING +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + +VERSION = "unknown" + +class AzureMediaServicesConfiguration(Configuration): + """Configuration for AzureMediaServices. -class AzureMediaServicesConfiguration(AzureConfiguration): - """Configuration for AzureMediaServices Note that all parameters used to create this instance are saved as instance attributes. - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: The unique identifier for a Microsoft Azure - subscription. + :param credential: Credential needed for the client to connect to Azure. + :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 """ def __init__( - self, credentials, subscription_id, base_url=None): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + 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.") - if not base_url: - base_url = 'https://management.azure.com' + super(AzureMediaServicesConfiguration, self).__init__(**kwargs) - super(AzureMediaServicesConfiguration, self).__init__(base_url) - - # Starting Autorest.Python 4.0.64, make connection pool activated by default - self.keep_alive = True - - self.add_user_agent('azure-mgmt-media/{}'.format(VERSION)) - self.add_user_agent('Azure-SDK-For-Python') - - self.credentials = credentials + self.credential = credential self.subscription_id = subscription_id + self.api_version = "2020-05-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-media/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/version.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/_version.py similarity index 84% rename from sdk/media/azure-mgmt-media/azure/mgmt/media/version.py rename to sdk/media/azure-mgmt-media/azure/mgmt/media/_version.py index 1a46faeb7ce7..20e28141456a 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/version.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/_version.py @@ -1,13 +1,10 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.2.0" +VERSION = "7.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 new file mode 100644 index 000000000000..434c2dc4efea --- /dev/null +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/__init__.py @@ -0,0 +1,10 @@ +# 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_media_services import AzureMediaServices +__all__ = ['AzureMediaServices'] 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 new file mode 100644 index 000000000000..87f512de71fd --- /dev/null +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/_azure_media_services.py @@ -0,0 +1,139 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import AzureMediaServicesConfiguration +from .operations import AccountFiltersOperations +from .operations import Operations +from .operations import MediaservicesOperations +from .operations import PrivateLinkResourcesOperations +from .operations import PrivateEndpointConnectionsOperations +from .operations import LocationsOperations +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): + """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 + :vartype mediaservices: azure.mgmt.media.aio.operations.MediaservicesOperations + :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 + :ivar locations: LocationsOperations operations + :vartype locations: azure.mgmt.media.aio.operations.LocationsOperations + :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 content_key_policies: ContentKeyPoliciesOperations operations + :vartype content_key_policies: azure.mgmt.media.aio.operations.ContentKeyPoliciesOperations + :ivar transforms: TransformsOperations operations + :vartype transforms: azure.mgmt.media.aio.operations.TransformsOperations + :ivar jobs: JobsOperations operations + :vartype jobs: azure.mgmt.media.aio.operations.JobsOperations + :ivar streaming_policies: StreamingPoliciesOperations operations + :vartype streaming_policies: azure.mgmt.media.aio.operations.StreamingPoliciesOperations + :ivar streaming_locators: StreamingLocatorsOperations operations + :vartype streaming_locators: azure.mgmt.media.aio.operations.StreamingLocatorsOperations + :ivar live_events: LiveEventsOperations operations + :vartype live_events: azure.mgmt.media.aio.operations.LiveEventsOperations + :ivar live_outputs: LiveOutputsOperations operations + :vartype live_outputs: azure.mgmt.media.aio.operations.LiveOutputsOperations + :ivar streaming_endpoints: StreamingEndpointsOperations operations + :vartype streaming_endpoints: azure.mgmt.media.aio.operations.StreamingEndpointsOperations + :param credential: Credential needed for the client to connect to Azure. + :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. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = AzureMediaServicesConfiguration(credential, 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.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.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 close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "AzureMediaServices": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) 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 new file mode 100644 index 000000000000..f2f21a322e49 --- /dev/null +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +VERSION = "unknown" + +class AzureMediaServicesConfiguration(Configuration): + """Configuration for AzureMediaServices. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The unique identifier for a Microsoft Azure subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + 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 = "2020-05-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-media/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) 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 new file mode 100644 index 000000000000..795a18cd9d99 --- /dev/null +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/__init__.py @@ -0,0 +1,43 @@ +# 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 ._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 ._assets_operations import AssetsOperations +from ._asset_filters_operations import AssetFiltersOperations +from ._content_key_policies_operations import ContentKeyPoliciesOperations +from ._transforms_operations import TransformsOperations +from ._jobs_operations import JobsOperations +from ._streaming_policies_operations import StreamingPoliciesOperations +from ._streaming_locators_operations import StreamingLocatorsOperations +from ._live_events_operations import LiveEventsOperations +from ._live_outputs_operations import LiveOutputsOperations +from ._streaming_endpoints_operations import StreamingEndpointsOperations + +__all__ = [ + 'AccountFiltersOperations', + 'Operations', + 'MediaservicesOperations', + 'PrivateLinkResourcesOperations', + 'PrivateEndpointConnectionsOperations', + 'LocationsOperations', + 'AssetsOperations', + 'AssetFiltersOperations', + 'ContentKeyPoliciesOperations', + 'TransformsOperations', + 'JobsOperations', + 'StreamingPoliciesOperations', + 'StreamingLocatorsOperations', + 'LiveEventsOperations', + 'LiveOutputsOperations', + 'StreamingEndpointsOperations', +] 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 new file mode 100644 index 000000000000..9d40ff13c12f --- /dev/null +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_account_filters_operations.py @@ -0,0 +1,398 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AccountFiltersOperations: + """AccountFiltersOperations 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 + + def list( + self, + resource_group_name: str, + account_name: str, + **kwargs + ) -> AsyncIterable["_models.AccountFilterCollection"]: + """List Account Filters. + + List Account Filters in the Media Services account. + + :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 + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccountFilterCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AccountFilterCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.odata_next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ApiError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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 + + async def get( + self, + resource_group_name: str, + account_name: str, + filter_name: str, + **kwargs + ) -> Optional["_models.AccountFilter"]: + """Get an Account Filter. + + Get the details of an Account Filter in the Media Services account. + + :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 filter_name: The Account Filter name. + :type filter_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccountFilter, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.AccountFilter or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccountFilter"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AccountFilter', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + filter_name: str, + parameters: "_models.AccountFilter", + **kwargs + ) -> "_models.AccountFilter": + """Create or update an Account Filter. + + Creates or updates an Account Filter in the Media Services account. + + :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 filter_name: The Account Filter name. + :type filter_name: str + :param parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.AccountFilter + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccountFilter, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.AccountFilter + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccountFilter"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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') + + # 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, '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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AccountFilter', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AccountFilter', pipeline_response) + + if cls: + 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 + + async def delete( + self, + resource_group_name: str, + account_name: str, + filter_name: str, + **kwargs + ) -> None: + """Delete an Account Filter. + + Deletes an Account Filter in the Media Services account. + + :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 filter_name: The Account Filter name. + :type filter_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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(_models.ApiError, 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}/accountFilters/{filterName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + account_name: str, + filter_name: str, + parameters: "_models.AccountFilter", + **kwargs + ) -> "_models.AccountFilter": + """Update an Account Filter. + + Updates an existing Account Filter in the Media Services account. + + :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 filter_name: The Account Filter name. + :type filter_name: str + :param parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.AccountFilter + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccountFilter, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.AccountFilter + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccountFilter"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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') + + # 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, '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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccountFilter', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..5d77a844b2f7 --- /dev/null +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_asset_filters_operations.py @@ -0,0 +1,418 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AssetFiltersOperations: + """AssetFiltersOperations 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 + + def list( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + **kwargs + ) -> AsyncIterable["_models.AssetFilterCollection"]: + """List Asset Filters. + + List Asset Filters associated with the specified 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 AssetFilterCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.media.models.AssetFilterCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AssetFilterCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AssetFilterCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.odata_next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ApiError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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 + + async def get( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + filter_name: str, + **kwargs + ) -> Optional["_models.AssetFilter"]: + """Get an Asset Filter. + + Get the details of an Asset Filter associated with the specified 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 filter_name: The Asset Filter name. + :type filter_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AssetFilter, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.AssetFilter or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AssetFilter"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AssetFilter', 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}/assetFilters/{filterName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + filter_name: str, + parameters: "_models.AssetFilter", + **kwargs + ) -> "_models.AssetFilter": + """Create or update an Asset Filter. + + Creates or updates an Asset Filter associated with the specified 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 filter_name: The Asset Filter name. + :type filter_name: str + :param parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.AssetFilter + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AssetFilter, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.AssetFilter + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AssetFilter"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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') + + # 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, '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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AssetFilter', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AssetFilter', pipeline_response) + + if cls: + 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 + + async def delete( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + filter_name: str, + **kwargs + ) -> None: + """Delete an Asset Filter. + + Deletes an Asset Filter associated with the specified 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 filter_name: The Asset Filter name. + :type filter_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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(_models.ApiError, 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}/assets/{assetName}/assetFilters/{filterName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + filter_name: str, + parameters: "_models.AssetFilter", + **kwargs + ) -> "_models.AssetFilter": + """Update an Asset Filter. + + Updates an existing Asset Filter associated with the specified 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 filter_name: The Asset Filter name. + :type filter_name: str + :param parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.AssetFilter + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AssetFilter, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.AssetFilter + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AssetFilter"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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') + + # 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, '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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AssetFilter', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..f3d339f0c70a --- /dev/null +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_assets_operations.py @@ -0,0 +1,620 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AssetsOperations: + """AssetsOperations 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 + + def list( + self, + resource_group_name: str, + account_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.AssetCollection"]: + """List Assets. + + List Assets in the Media Services account with optional filtering and ordering. + + :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 filter: Restricts the set of items returned. + :type filter: str + :param top: Specifies a non-negative integer n that limits the number of items returned from a + collection. The service returns the number of available items up to but not greater than the + specified value n. + :type top: int + :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 AssetCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.media.models.AssetCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AssetCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AssetCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.odata_next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ApiError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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 + + async def get( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + **kwargs + ) -> Optional["_models.Asset"]: + """Get an Asset. + + Get the details of an Asset in the Media Services account. + + :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: Asset, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.Asset or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Asset"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Asset', 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}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + parameters: "_models.Asset", + **kwargs + ) -> "_models.Asset": + """Create or update an Asset. + + Creates or updates an Asset in the Media Services account. + + :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 parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.Asset + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Asset, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.Asset + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Asset"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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') + + # 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, '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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Asset', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Asset', pipeline_response) + + if cls: + 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 + + async def delete( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + **kwargs + ) -> None: + """Delete an Asset. + + Deletes an Asset in the Media Services account. + + :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: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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(_models.ApiError, 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}/assets/{assetName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + parameters: "_models.Asset", + **kwargs + ) -> "_models.Asset": + """Update an Asset. + + Updates an existing Asset in the Media Services account. + + :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 parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.Asset + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Asset, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.Asset + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Asset"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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') + + # 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, '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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Asset', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}'} # type: ignore + + async def list_container_sas( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + parameters: "_models.ListContainerSasInput", + **kwargs + ) -> "_models.AssetContainerSas": + """List the Asset URLs. + + Lists storage container URLs with shared access signatures (SAS) for uploading and downloading + Asset content. The signatures are derived from the storage account keys. + + :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 parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.ListContainerSasInput + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AssetContainerSas, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.AssetContainerSas + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AssetContainerSas"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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') + + # 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, '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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AssetContainerSas', pipeline_response) + + if cls: + 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 + + async def get_encryption_key( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + **kwargs + ) -> "_models.StorageEncryptedAssetDecryptionData": + """Gets the Asset storage key. + + Gets the Asset storage encryption keys used to decrypt content created by version 2 of the + Media Services API. + + :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: StorageEncryptedAssetDecryptionData, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.StorageEncryptedAssetDecryptionData + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageEncryptedAssetDecryptionData"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StorageEncryptedAssetDecryptionData', pipeline_response) + + if cls: + 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 + + async def list_streaming_locators( + self, + resource_group_name: str, + account_name: str, + asset_name: str, + **kwargs + ) -> "_models.ListStreamingLocatorsResponse": + """List Streaming Locators. + + Lists Streaming Locators which are associated with this 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: ListStreamingLocatorsResponse, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.ListStreamingLocatorsResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListStreamingLocatorsResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ListStreamingLocatorsResponse', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..8e293bce0ffb --- /dev/null +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_content_key_policies_operations.py @@ -0,0 +1,482 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ContentKeyPoliciesOperations: + """ContentKeyPoliciesOperations 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 + + def list( + self, + resource_group_name: str, + account_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.ContentKeyPolicyCollection"]: + """List Content Key Policies. + + Lists the Content Key Policies in the account. + + :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 filter: Restricts the set of items returned. + :type filter: str + :param top: Specifies a non-negative integer n that limits the number of items returned from a + collection. The service returns the number of available items up to but not greater than the + specified value n. + :type top: int + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ContentKeyPolicyCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ContentKeyPolicyCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.odata_next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ApiError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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 + + async def get( + self, + resource_group_name: str, + account_name: str, + content_key_policy_name: str, + **kwargs + ) -> Optional["_models.ContentKeyPolicy"]: + """Get a Content Key Policy. + + Get the details of a Content Key Policy in the Media Services account. + + :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 content_key_policy_name: The Content Key Policy name. + :type content_key_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ContentKeyPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.ContentKeyPolicy or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ContentKeyPolicy"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ContentKeyPolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + content_key_policy_name: str, + parameters: "_models.ContentKeyPolicy", + **kwargs + ) -> "_models.ContentKeyPolicy": + """Create or update an Content Key Policy. + + Create or update a Content Key Policy in the Media Services account. + + :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 content_key_policy_name: The Content Key Policy name. + :type content_key_policy_name: str + :param parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.ContentKeyPolicy + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ContentKeyPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.ContentKeyPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ContentKeyPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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') + + # 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, '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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ContentKeyPolicy', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ContentKeyPolicy', pipeline_response) + + if cls: + 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 + + async def delete( + self, + resource_group_name: str, + account_name: str, + content_key_policy_name: str, + **kwargs + ) -> None: + """Delete a Content Key Policy. + + Deletes a Content Key Policy in the Media Services account. + + :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 content_key_policy_name: The Content Key Policy name. + :type content_key_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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(_models.ApiError, 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}/contentKeyPolicies/{contentKeyPolicyName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + account_name: str, + content_key_policy_name: str, + parameters: "_models.ContentKeyPolicy", + **kwargs + ) -> "_models.ContentKeyPolicy": + """Update a Content Key Policy. + + Updates an existing Content Key Policy in the Media Services account. + + :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 content_key_policy_name: The Content Key Policy name. + :type content_key_policy_name: str + :param parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.ContentKeyPolicy + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ContentKeyPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.ContentKeyPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ContentKeyPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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') + + # 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, '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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ContentKeyPolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}'} # type: ignore + + async def get_policy_properties_with_secrets( + self, + resource_group_name: str, + account_name: str, + content_key_policy_name: str, + **kwargs + ) -> Optional["_models.ContentKeyPolicyProperties"]: + """Get a Content Key Policy with secrets. + + Get a Content Key Policy including secret values. + + :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 content_key_policy_name: The Content Key Policy name. + :type content_key_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ContentKeyPolicyProperties, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.ContentKeyPolicyProperties or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ContentKeyPolicyProperties"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ContentKeyPolicyProperties', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..9a0021051309 --- /dev/null +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_jobs_operations.py @@ -0,0 +1,492 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class JobsOperations: + """JobsOperations 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 + + def list( + self, + resource_group_name: str, + account_name: str, + transform_name: str, + filter: Optional[str] = None, + orderby: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.JobCollection"]: + """List Jobs. + + Lists all of the Jobs for the Transform. + + :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 transform_name: The Transform name. + :type transform_name: str + :param filter: Restricts the set of items returned. + :type filter: str + :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 JobCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.media.models.JobCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('JobCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.odata_next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ApiError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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 + + async def get( + self, + resource_group_name: str, + account_name: str, + transform_name: str, + job_name: str, + **kwargs + ) -> Optional["_models.Job"]: + """Get Job. + + Gets a Job. + + :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 transform_name: The Transform name. + :type transform_name: str + :param job_name: The Job name. + :type job_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Job, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.Job or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Job"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Job', pipeline_response) + + if cls: + 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 + + async def create( + self, + resource_group_name: str, + account_name: str, + transform_name: str, + job_name: str, + parameters: "_models.Job", + **kwargs + ) -> "_models.Job": + """Create Job. + + Creates a Job. + + :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 transform_name: The Transform name. + :type transform_name: str + :param job_name: The Job name. + :type job_name: str + :param parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.Job + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Job, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.Job + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Job"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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') + + # 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, '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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Job', pipeline_response) + + if cls: + 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 + + async def delete( + self, + resource_group_name: str, + account_name: str, + transform_name: str, + job_name: str, + **kwargs + ) -> None: + """Delete Job. + + Deletes a Job. + + :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 transform_name: The Transform name. + :type transform_name: str + :param job_name: The Job name. + :type job_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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(_models.ApiError, 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}/transforms/{transformName}/jobs/{jobName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + account_name: str, + transform_name: str, + job_name: str, + parameters: "_models.Job", + **kwargs + ) -> "_models.Job": + """Update Job. + + Update is only supported for description and priority. Updating Priority will take effect when + the Job state is Queued or Scheduled and depending on the timing the priority update may be + ignored. + + :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 transform_name: The Transform name. + :type transform_name: str + :param job_name: The Job name. + :type job_name: str + :param parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.Job + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Job, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.Job + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Job"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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') + + # 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, '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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Job', pipeline_response) + + if cls: + 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 + + async def cancel_job( + self, + resource_group_name: str, + account_name: str, + transform_name: str, + job_name: str, + **kwargs + ) -> None: + """Cancel Job. + + Cancel a Job. + + :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 transform_name: The Transform name. + :type transform_name: str + :param job_name: The Job name. + :type job_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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(_models.ApiError, 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 new file mode 100644 index 000000000000..00701a82aeb2 --- /dev/null +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_live_events_operations.py @@ -0,0 +1,1073 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class LiveEventsOperations: + """LiveEventsOperations 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 + + def list( + self, + resource_group_name: str, + account_name: str, + **kwargs + ) -> AsyncIterable["_models.LiveEventListResult"]: + """List live events. + + Lists all the live events in the account. + + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LiveEventListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.media.models.LiveEventListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LiveEventListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('LiveEventListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.odata_next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ApiError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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 + + async def get( + self, + resource_group_name: str, + account_name: str, + live_event_name: str, + **kwargs + ) -> Optional["_models.LiveEvent"]: + """Get Live Event. + + Gets properties of a live event. + + :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 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: LiveEvent, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.LiveEvent or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LiveEvent"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('LiveEvent', pipeline_response) + + if cls: + 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, + account_name: str, + live_event_name: str, + parameters: "_models.LiveEvent", + auto_start: Optional[bool] = None, + **kwargs + ) -> "_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 = "2020-05-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) + 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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('LiveEvent', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('LiveEvent', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + account_name: str, + live_event_name: str, + parameters: "_models.LiveEvent", + auto_start: Optional[bool] = None, + **kwargs + ) -> AsyncLROPoller["_models.LiveEvent"]: + """Create Live Event. + + Creates a new live event. + + :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 live_event_name: The name of the live event, maximum length is 32. + :type live_event_name: str + :param parameters: Live event properties needed for creation. + :type parameters: ~azure.mgmt.media.models.LiveEvent + :param auto_start: The flag indicates if the resource should be automatically started on + creation. + :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: True for ARMPolling, False for no polling, or a + polling object for 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.media.models.LiveEvent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LiveEvent"] + 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_initial( + resource_group_name=resource_group_name, + account_name=account_name, + live_event_name=live_event_name, + parameters=parameters, + auto_start=auto_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): + 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) + 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + account_name: str, + live_event_name: str, + parameters: "_models.LiveEvent", + **kwargs + ) -> "_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 = "2020-05-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') + + # 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.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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('LiveEvent', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('LiveEvent', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + account_name: str, + live_event_name: str, + parameters: "_models.LiveEvent", + **kwargs + ) -> AsyncLROPoller["_models.LiveEvent"]: + """Updates settings on an existing live event. + + :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 live_event_name: The name of the live event, maximum length is 32. + :type live_event_name: str + :param parameters: Live event properties needed for patch. + :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: True for ARMPolling, False for no polling, or a + polling object for 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.media.models.LiveEvent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LiveEvent"] + 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, + live_event_name=live_event_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_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) + 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}/liveEvents/{liveEventName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + account_name: str, + live_event_name: str, + **kwargs + ) -> 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 = "2020-05-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 = 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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, 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 + + async def begin_delete( + self, + resource_group_name: str, + account_name: str, + live_event_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Delete Live Event. + + Deletes a live event. + + :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 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for 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, 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, + live_event_name=live_event_name, + 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) + 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}/liveEvents/{liveEventName}'} # type: ignore + + async def _allocate_initial( + self, + resource_group_name: str, + account_name: str, + live_event_name: str, + **kwargs + ) -> 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 = "2020-05-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 = 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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, 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 + + async def begin_allocate( + self, + resource_group_name: str, + account_name: str, + live_event_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Allocate resources for a live event. + + A live event is in StandBy state after allocation completes, and is ready to start. + + :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 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for 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, 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._allocate_initial( + resource_group_name=resource_group_name, + account_name=account_name, + live_event_name=live_event_name, + 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) + 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_allocate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/allocate'} # type: ignore + + async def _start_initial( + self, + resource_group_name: str, + account_name: str, + live_event_name: str, + **kwargs + ) -> 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 = "2020-05-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 = 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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, 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 + + async def begin_start( + self, + resource_group_name: str, + account_name: str, + live_event_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Start Live Event. + + A live event in Stopped or StandBy state will be in Running state after the start operation + completes. + + :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 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for 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, 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._start_initial( + resource_group_name=resource_group_name, + account_name=account_name, + live_event_name=live_event_name, + 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) + 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_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/start'} # type: ignore + + async def _stop_initial( + self, + resource_group_name: str, + account_name: str, + live_event_name: str, + parameters: "_models.LiveEventActionInput", + **kwargs + ) -> 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 = "2020-05-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') + + # 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, '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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, 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 + + async def begin_stop( + self, + resource_group_name: str, + account_name: str, + live_event_name: str, + parameters: "_models.LiveEventActionInput", + **kwargs + ) -> AsyncLROPoller[None]: + """Stop Live Event. + + Stops a running live event. + + :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 live_event_name: The name of the live event, maximum length is 32. + :type live_event_name: str + :param parameters: LiveEvent stop parameters. + :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: True for ARMPolling, False for no polling, or a + polling object for 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, 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._stop_initial( + resource_group_name=resource_group_name, + account_name=account_name, + live_event_name=live_event_name, + parameters=parameters, + 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) + 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_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/stop'} # type: ignore + + async def _reset_initial( + self, + resource_group_name: str, + account_name: str, + live_event_name: str, + **kwargs + ) -> 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 = "2020-05-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 = 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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, 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 + + async def begin_reset( + self, + resource_group_name: str, + account_name: str, + live_event_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Reset Live Event. + + Resets an existing live event. All live outputs for the live event are deleted and the live + event is stopped and will be started again. All assets used by the live outputs and streaming + locators created on these assets are unaffected. + + :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 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for 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, 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._reset_initial( + resource_group_name=resource_group_name, + account_name=account_name, + live_event_name=live_event_name, + 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) + 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_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 new file mode 100644 index 000000000000..ec299a871cd8 --- /dev/null +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_live_outputs_operations.py @@ -0,0 +1,467 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class LiveOutputsOperations: + """LiveOutputsOperations 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 + + def list( + self, + resource_group_name: str, + account_name: str, + live_event_name: str, + **kwargs + ) -> AsyncIterable["_models.LiveOutputListResult"]: + """List Live Outputs. + + Lists the live outputs of a live event. + + :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 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) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.media.models.LiveOutputListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LiveOutputListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('LiveOutputListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.odata_next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ApiError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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 + + async def get( + self, + resource_group_name: str, + account_name: str, + live_event_name: str, + live_output_name: str, + **kwargs + ) -> Optional["_models.LiveOutput"]: + """Get Live Output. + + Gets a live output. + + :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 live_event_name: The name of the live event, maximum length is 32. + :type live_event_name: str + :param live_output_name: The name of the live output. + :type live_output_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LiveOutput, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.LiveOutput or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LiveOutput"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('LiveOutput', pipeline_response) + + if cls: + 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, + account_name: str, + live_event_name: str, + live_output_name: str, + parameters: "_models.LiveOutput", + **kwargs + ) -> "_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 = "2020-05-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') + + # 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, '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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('LiveOutput', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('LiveOutput', pipeline_response) + + if cls: + 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 + + async def begin_create( + self, + resource_group_name: str, + account_name: str, + live_event_name: str, + live_output_name: str, + parameters: "_models.LiveOutput", + **kwargs + ) -> AsyncLROPoller["_models.LiveOutput"]: + """Create Live Output. + + Creates a new live output. + + :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 live_event_name: The name of the live event, maximum length is 32. + :type live_event_name: str + :param live_output_name: The name of the live output. + :type live_output_name: str + :param parameters: Live Output properties needed for creation. + :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: True for ARMPolling, False for no polling, or a + polling object for 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.media.models.LiveOutput] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LiveOutput"] + 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_initial( + resource_group_name=resource_group_name, + account_name=account_name, + live_event_name=live_event_name, + live_output_name=live_output_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_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) + 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + account_name: str, + live_event_name: str, + live_output_name: str, + **kwargs + ) -> 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 = "2020-05-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 = 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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, 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 + + async def begin_delete( + self, + resource_group_name: str, + account_name: str, + live_event_name: str, + live_output_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Delete Live Output. + + Deletes a live output. Deleting a live output does not delete the asset the live output is + writing to. + + :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 live_event_name: The name of the live event, maximum length is 32. + :type live_event_name: str + :param live_output_name: The name of the live output. + :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: True for ARMPolling, False for no polling, or a + polling object for 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, 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, + live_event_name=live_event_name, + live_output_name=live_output_name, + 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) + 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}/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 new file mode 100644 index 000000000000..f5c88e9c9b81 --- /dev/null +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_locations_operations.py @@ -0,0 +1,106 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class LocationsOperations: + """LocationsOperations 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 + + async def check_name_availability( + self, + location_name: str, + parameters: "_models.CheckNameAvailabilityInput", + **kwargs + ) -> "_models.EntityNameAvailabilityCheckOutput": + """Check Name Availability. + + Checks whether the Media Service resource name is available. + + :param location_name: The name of the location. + :type location_name: str + :param parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.CheckNameAvailabilityInput + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EntityNameAvailabilityCheckOutput, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.EntityNameAvailabilityCheckOutput + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EntityNameAvailabilityCheckOutput"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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') + + # 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, '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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EntityNameAvailabilityCheckOutput', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..ef7d71adabbc --- /dev/null +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_mediaservices_operations.py @@ -0,0 +1,638 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MediaservicesOperations: + """MediaservicesOperations 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 + + def list( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["_models.MediaServiceCollection"]: + """List Media Services accounts. + + List Media Services accounts in the resource group. + + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MediaServiceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('MediaServiceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.odata_next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ApiError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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 + + async def get( + self, + resource_group_name: str, + account_name: str, + **kwargs + ) -> "_models.MediaService": + """Get a Media Services account. + + Get the details of a Media Services account. + + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MediaService, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.MediaService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MediaService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MediaService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + parameters: "_models.MediaService", + **kwargs + ) -> "_models.MediaService": + """Create or update a Media Services account. + + Creates or updates a Media Services account. + + :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 parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.MediaService + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MediaService, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.MediaService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MediaService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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') + + # 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, '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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('MediaService', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('MediaService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + account_name: str, + **kwargs + ) -> None: + """Delete a Media Services account. + + Deletes a Media Services account. + + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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(_models.ApiError, 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}'} # type: ignore + + async def update( + self, + resource_group_name: str, + account_name: str, + parameters: "_models.MediaService", + **kwargs + ) -> "_models.MediaService": + """Update a Media Services account. + + Updates an existing Media Services account. + + :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 parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.MediaService + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MediaService, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.MediaService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MediaService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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') + + # 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, 'MediaService') + 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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MediaService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}'} # type: ignore + + async def sync_storage_keys( + self, + resource_group_name: str, + account_name: str, + parameters: "_models.SyncStorageKeysInput", + **kwargs + ) -> None: + """Synchronizes Storage Account Keys. + + Synchronizes storage account keys for a storage account associated with the Media Service + account. + + :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 parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.SyncStorageKeysInput + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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') + + # 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, '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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + sync_storage_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/syncStorageKeys'} # type: ignore + + async def list_edge_policies( + self, + resource_group_name: str, + account_name: str, + parameters: "_models.ListEdgePoliciesInput", + **kwargs + ) -> "_models.EdgePolicies": + """List the media edge policies associated with the Media Services account. + + List the media edge policies associated with the Media Services account. + + :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 parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.ListEdgePoliciesInput + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EdgePolicies, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.EdgePolicies + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EdgePolicies"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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') + + # 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, '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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EdgePolicies', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_edge_policies.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/listEdgePolicies'} # type: ignore + + def list_by_subscription( + self, + **kwargs + ) -> AsyncIterable["_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) + :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"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('MediaServiceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.odata_next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ApiError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Media/mediaservices'} # type: ignore + + async def get_by_subscription( + self, + account_name: str, + **kwargs + ) -> "_models.MediaService": + """Get a Media Services account. + + Get the details of a Media Services account. + + :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: MediaService, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.MediaService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MediaService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + accept = "application/json" + + # Construct URL + url = self.get_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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 = 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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MediaService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Media/mediaservices/{accountName}'} # 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 new file mode 100644 index 000000000000..8803efde27f5 --- /dev/null +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_operations.py @@ -0,0 +1,107 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~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 + + def list( + self, + **kwargs + ) -> AsyncIterable["_models.OperationCollection"]: + """List Operations. + + Lists all the Media Services operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.media.models.OperationCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.odata_next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ApiError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + 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 new file mode 100644 index 000000000000..57d57d8c4a59 --- /dev/null +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,302 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionsOperations: + """PrivateEndpointConnectionsOperations 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 + + async def list( + self, + resource_group_name: str, + account_name: str, + **kwargs + ) -> "_models.PrivateEndpointConnectionListResult": + """Get all private endpoint connections. + + Get all private endpoint connections. + + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.PrivateEndpointConnectionListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections'} # type: ignore + + async def get( + self, + resource_group_name: str, + account_name: str, + name: str, + **kwargs + ) -> "_models.PrivateEndpointConnection": + """Get private endpoint connection. + + Get private endpoint connection. + + :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 name: + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections/{name}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + name: str, + parameters: "_models.PrivateEndpointConnection", + **kwargs + ) -> "_models.PrivateEndpointConnection": + """Update private endpoint connection. + + Update private endpoint connection. + + :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 name: + :type name: str + :param parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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') + + # 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, '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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + 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 + + async def delete( + self, + resource_group_name: str, + account_name: str, + name: str, + **kwargs + ) -> None: + """Delete private endpoint connection. + + Delete private endpoint connection. + + :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 name: + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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') + + # 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, 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 new file mode 100644 index 000000000000..beeb5b60aeb2 --- /dev/null +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_private_link_resources_operations.py @@ -0,0 +1,167 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateLinkResourcesOperations: + """PrivateLinkResourcesOperations 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 + + async def list( + self, + resource_group_name: str, + account_name: str, + **kwargs + ) -> "_models.PrivateLinkResourceListResult": + """Get list of group IDs. + + Get list of group IDs. + + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourceListResult, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.PrivateLinkResourceListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateLinkResources'} # type: ignore + + async def get( + self, + resource_group_name: str, + account_name: str, + name: str, + **kwargs + ) -> "_models.PrivateLinkResource": + """Get group ID. + + Get group ID. + + :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 name: + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.PrivateLinkResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..b22df4a06ad8 --- /dev/null +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_streaming_endpoints_operations.py @@ -0,0 +1,954 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class StreamingEndpointsOperations: + """StreamingEndpointsOperations 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 + + def list( + self, + resource_group_name: str, + account_name: str, + **kwargs + ) -> AsyncIterable["_models.StreamingEndpointListResult"]: + """List StreamingEndpoints. + + Lists the streaming endpoints in the account. + + :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 + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingEndpointListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('StreamingEndpointListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.odata_next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ApiError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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 + + async def get( + self, + resource_group_name: str, + account_name: str, + streaming_endpoint_name: str, + **kwargs + ) -> Optional["_models.StreamingEndpoint"]: + """Get StreamingEndpoint. + + Gets a streaming endpoint. + + :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: StreamingEndpoint, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.StreamingEndpoint or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StreamingEndpoint"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('StreamingEndpoint', pipeline_response) + + if cls: + 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, + account_name: str, + streaming_endpoint_name: str, + parameters: "_models.StreamingEndpoint", + auto_start: Optional[bool] = None, + **kwargs + ) -> "_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 = "2020-05-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) + 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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('StreamingEndpoint', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('StreamingEndpoint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + account_name: str, + streaming_endpoint_name: str, + parameters: "_models.StreamingEndpoint", + auto_start: Optional[bool] = None, + **kwargs + ) -> AsyncLROPoller["_models.StreamingEndpoint"]: + """Create StreamingEndpoint. + + Creates a streaming endpoint. + + :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 + :param parameters: Streaming endpoint properties needed for creation. + :type parameters: ~azure.mgmt.media.models.StreamingEndpoint + :param auto_start: The flag indicates if the resource should be automatically started on + creation. + :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: True for ARMPolling, False for no polling, or a + polling object for 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.media.models.StreamingEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingEndpoint"] + 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_initial( + resource_group_name=resource_group_name, + account_name=account_name, + streaming_endpoint_name=streaming_endpoint_name, + parameters=parameters, + auto_start=auto_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): + 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) + 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + account_name: str, + streaming_endpoint_name: str, + parameters: "_models.StreamingEndpoint", + **kwargs + ) -> "_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 = "2020-05-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') + + # 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.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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('StreamingEndpoint', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('StreamingEndpoint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + account_name: str, + streaming_endpoint_name: str, + parameters: "_models.StreamingEndpoint", + **kwargs + ) -> AsyncLROPoller["_models.StreamingEndpoint"]: + """Update StreamingEndpoint. + + Updates a existing streaming endpoint. + + :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 + :param parameters: Streaming endpoint properties needed for creation. + :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: True for ARMPolling, False for no polling, or a + polling object for 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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.media.models.StreamingEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingEndpoint"] + 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, + streaming_endpoint_name=streaming_endpoint_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_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) + 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}/streamingEndpoints/{streamingEndpointName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + account_name: str, + streaming_endpoint_name: str, + **kwargs + ) -> 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 = "2020-05-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 = 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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, 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 + + async def begin_delete( + self, + resource_group_name: str, + account_name: str, + streaming_endpoint_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Delete StreamingEndpoint. + + Deletes a streaming endpoint. + + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for 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, 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, + streaming_endpoint_name=streaming_endpoint_name, + 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) + 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}/streamingEndpoints/{streamingEndpointName}'} # type: ignore + + async def _start_initial( + self, + resource_group_name: str, + account_name: str, + streaming_endpoint_name: str, + **kwargs + ) -> 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 = "2020-05-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 = 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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, 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 + + async def begin_start( + self, + resource_group_name: str, + account_name: str, + streaming_endpoint_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Start StreamingEndpoint. + + Starts an existing streaming endpoint. + + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for 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, 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._start_initial( + resource_group_name=resource_group_name, + account_name=account_name, + streaming_endpoint_name=streaming_endpoint_name, + 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) + 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_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/start'} # type: ignore + + async def _stop_initial( + self, + resource_group_name: str, + account_name: str, + streaming_endpoint_name: str, + **kwargs + ) -> 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 = "2020-05-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 = 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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, 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 + + async def begin_stop( + self, + resource_group_name: str, + account_name: str, + streaming_endpoint_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Stop StreamingEndpoint. + + Stops an existing streaming endpoint. + + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for 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, 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._stop_initial( + resource_group_name=resource_group_name, + account_name=account_name, + streaming_endpoint_name=streaming_endpoint_name, + 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) + 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_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/stop'} # type: ignore + + async def _scale_initial( + self, + resource_group_name: str, + account_name: str, + streaming_endpoint_name: str, + parameters: "_models.StreamingEntityScaleUnit", + **kwargs + ) -> 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 = "2020-05-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') + + # 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, '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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, 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 + + async def begin_scale( + self, + resource_group_name: str, + account_name: str, + streaming_endpoint_name: str, + parameters: "_models.StreamingEntityScaleUnit", + **kwargs + ) -> AsyncLROPoller[None]: + """Scale StreamingEndpoint. + + Scales an existing streaming endpoint. + + :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 + :param parameters: Streaming endpoint scale parameters. + :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: True for ARMPolling, False for no polling, or a + polling object for 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, 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._scale_initial( + resource_group_name=resource_group_name, + account_name=account_name, + streaming_endpoint_name=streaming_endpoint_name, + parameters=parameters, + 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) + 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_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 new file mode 100644 index 000000000000..c03c181a7c1c --- /dev/null +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_streaming_locators_operations.py @@ -0,0 +1,468 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class StreamingLocatorsOperations: + """StreamingLocatorsOperations 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 + + def list( + self, + resource_group_name: str, + account_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.StreamingLocatorCollection"]: + """List Streaming Locators. + + Lists the Streaming Locators in the account. + + :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 filter: Restricts the set of items returned. + :type filter: str + :param top: Specifies a non-negative integer n that limits the number of items returned from a + collection. The service returns the number of available items up to but not greater than the + specified value n. + :type top: int + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingLocatorCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('StreamingLocatorCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.odata_next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ApiError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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 + + async def get( + self, + resource_group_name: str, + account_name: str, + streaming_locator_name: str, + **kwargs + ) -> Optional["_models.StreamingLocator"]: + """Get a Streaming Locator. + + Get the details of a Streaming Locator in the Media Services account. + + :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_locator_name: The Streaming Locator name. + :type streaming_locator_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StreamingLocator, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.StreamingLocator or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StreamingLocator"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('StreamingLocator', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}'} # type: ignore + + async def create( + self, + resource_group_name: str, + account_name: str, + streaming_locator_name: str, + parameters: "_models.StreamingLocator", + **kwargs + ) -> "_models.StreamingLocator": + """Create a Streaming Locator. + + Create a Streaming Locator in the Media Services account. + + :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_locator_name: The Streaming Locator name. + :type streaming_locator_name: str + :param parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.StreamingLocator + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StreamingLocator, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.StreamingLocator + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingLocator"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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') + + # 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, '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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StreamingLocator', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + account_name: str, + streaming_locator_name: str, + **kwargs + ) -> None: + """Delete a Streaming Locator. + + Deletes a Streaming Locator in the Media Services account. + + :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_locator_name: The Streaming Locator name. + :type streaming_locator_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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(_models.ApiError, 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}/streamingLocators/{streamingLocatorName}'} # type: ignore + + async def list_content_keys( + self, + resource_group_name: str, + account_name: str, + streaming_locator_name: str, + **kwargs + ) -> "_models.ListContentKeysResponse": + """List Content Keys. + + List Content Keys used by this Streaming Locator. + + :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_locator_name: The Streaming Locator name. + :type streaming_locator_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ListContentKeysResponse, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.ListContentKeysResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListContentKeysResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ListContentKeysResponse', pipeline_response) + + if cls: + 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 + + async def list_paths( + self, + resource_group_name: str, + account_name: str, + streaming_locator_name: str, + **kwargs + ) -> "_models.ListPathsResponse": + """List Paths. + + List Paths supported by this Streaming Locator. + + :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_locator_name: The Streaming Locator name. + :type streaming_locator_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ListPathsResponse, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.ListPathsResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListPathsResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ListPathsResponse', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..5472b3c7a31f --- /dev/null +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_streaming_policies_operations.py @@ -0,0 +1,338 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class StreamingPoliciesOperations: + """StreamingPoliciesOperations 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 + + def list( + self, + resource_group_name: str, + account_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.StreamingPolicyCollection"]: + """List Streaming Policies. + + Lists the Streaming Policies in the account. + + :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 filter: Restricts the set of items returned. + :type filter: str + :param top: Specifies a non-negative integer n that limits the number of items returned from a + collection. The service returns the number of available items up to but not greater than the + specified value n. + :type top: int + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingPolicyCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('StreamingPolicyCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.odata_next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ApiError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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 + + async def get( + self, + resource_group_name: str, + account_name: str, + streaming_policy_name: str, + **kwargs + ) -> Optional["_models.StreamingPolicy"]: + """Get a Streaming Policy. + + Get the details of a Streaming Policy in the Media Services account. + + :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_policy_name: The Streaming Policy name. + :type streaming_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StreamingPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.StreamingPolicy or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StreamingPolicy"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('StreamingPolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName}'} # type: ignore + + async def create( + self, + resource_group_name: str, + account_name: str, + streaming_policy_name: str, + parameters: "_models.StreamingPolicy", + **kwargs + ) -> "_models.StreamingPolicy": + """Create a Streaming Policy. + + Create a Streaming Policy in the Media Services account. + + :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_policy_name: The Streaming Policy name. + :type streaming_policy_name: str + :param parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.StreamingPolicy + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StreamingPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.StreamingPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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') + + # 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, '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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StreamingPolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + account_name: str, + streaming_policy_name: str, + **kwargs + ) -> None: + """Delete a Streaming Policy. + + Deletes a Streaming Policy in the Media Services account. + + :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_policy_name: The Streaming Policy name. + :type streaming_policy_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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(_models.ApiError, 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/_transforms_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_transforms_operations.py new file mode 100644 index 000000000000..d56ced16687c --- /dev/null +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_transforms_operations.py @@ -0,0 +1,408 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TransformsOperations: + """TransformsOperations 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 + + def list( + self, + resource_group_name: str, + account_name: str, + filter: Optional[str] = None, + orderby: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.TransformCollection"]: + """List Transforms. + + Lists the Transforms in the account. + + :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 filter: Restricts the set of items returned. + :type filter: str + :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 TransformCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.media.models.TransformCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TransformCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('TransformCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.odata_next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ApiError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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 + + async def get( + self, + resource_group_name: str, + account_name: str, + transform_name: str, + **kwargs + ) -> Optional["_models.Transform"]: + """Get Transform. + + Gets a Transform. + + :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 transform_name: The Transform name. + :type transform_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Transform, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.Transform or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Transform"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Transform', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + transform_name: str, + parameters: "_models.Transform", + **kwargs + ) -> "_models.Transform": + """Create or Update Transform. + + Creates or updates a new Transform. + + :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 transform_name: The Transform name. + :type transform_name: str + :param parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.Transform + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Transform, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.Transform + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Transform"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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') + + # 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, '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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Transform', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Transform', pipeline_response) + + if cls: + 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 + + async def delete( + self, + resource_group_name: str, + account_name: str, + transform_name: str, + **kwargs + ) -> None: + """Delete Transform. + + Deletes a Transform. + + :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 transform_name: The Transform name. + :type transform_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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(_models.ApiError, 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}/transforms/{transformName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + account_name: str, + transform_name: str, + parameters: "_models.Transform", + **kwargs + ) -> "_models.Transform": + """Update Transform. + + Updates a Transform. + + :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 transform_name: The Transform name. + :type transform_name: str + :param parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.Transform + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Transform, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.Transform + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Transform"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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') + + # 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, '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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Transform', pipeline_response) + + if cls: + 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 c6801c6972e1..aec1da56df38 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 @@ -1,25 +1,26 @@ # 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. -# +# 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. +# 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 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 ApiError, ApiErrorException + from ._models_py3 import ApiError 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 @@ -34,6 +35,7 @@ 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 @@ -69,19 +71,20 @@ from ._models_py3 import EntityNameAvailabilityCheckOutput from ._models_py3 import EnvelopeEncryption from ._models_py3 import FaceDetectorPreset - from ._models_py3 import Filters 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 H264Layer from ._models_py3 import H264Video from ._models_py3 import Hls - from ._models_py3 import Image - from ._models_py3 import ImageFormat from ._models_py3 import IPAccessControl from ._models_py3 import IPRange + from ._models_py3 import Image + from ._models_py3 import ImageFormat 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 @@ -94,6 +97,7 @@ from ._models_py3 import JpgFormat from ._models_py3 import JpgImage from ._models_py3 import JpgLayer + from ._models_py3 import KeyVaultProperties from ._models_py3 import Layer from ._models_py3 import ListContainerSasInput from ._models_py3 import ListContentKeysResponse @@ -106,19 +110,27 @@ 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 Location + from ._models_py3 import LogSpecification from ._models_py3 import MediaService - from ._models_py3 import Metric + from ._models_py3 import MediaServiceCollection + from ._models_py3 import MediaServiceIdentity from ._models_py3 import MetricDimension - from ._models_py3 import MetricProperties + from ._models_py3 import MetricSpecification from ._models_py3 import Mp4Format from ._models_py3 import MultiBitrateFormat from ._models_py3 import NoEncryption from ._models_py3 import ODataError 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 @@ -127,6 +139,13 @@ from ._models_py3 import PngLayer from ._models_py3 import PresentationTimeRange from ._models_py3 import Preset + 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 Provider from ._models_py3 import ProxyResource from ._models_py3 import Rectangle @@ -137,246 +156,274 @@ 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 SubscriptionMediaService from ._models_py3 import SyncStorageKeysInput - from ._models_py3 import TrackedResource 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 UtcClipTime from ._models_py3 import Video from ._models_py3 import VideoAnalyzerPreset from ._models_py3 import VideoLayer from ._models_py3 import VideoOverlay except (SyntaxError, ImportError): - from ._models import AacAudio - from ._models import AbsoluteClipTime - from ._models import AccountFilter - from ._models import AkamaiAccessControl - from ._models import AkamaiSignatureHeaderAuthenticationKey - from ._models import ApiError, ApiErrorException - from ._models import Asset - from ._models import AssetContainerSas - from ._models import AssetFileEncryptionMetadata - from ._models import AssetFilter - from ._models import AssetStreamingLocator - from ._models import Audio - from ._models import AudioAnalyzerPreset - from ._models import AudioOverlay - from ._models import BuiltInStandardEncoderPreset - from ._models import CbcsDrmConfiguration - from ._models import CencDrmConfiguration - from ._models import CheckNameAvailabilityInput - from ._models import ClipTime - from ._models import Codec - from ._models import CommonEncryptionCbcs - from ._models import CommonEncryptionCenc - from ._models import ContentKeyPolicy - from ._models import ContentKeyPolicyClearKeyConfiguration - from ._models import ContentKeyPolicyConfiguration - from ._models import ContentKeyPolicyFairPlayConfiguration - from ._models import ContentKeyPolicyFairPlayOfflineRentalConfiguration - from ._models import ContentKeyPolicyOpenRestriction - from ._models import ContentKeyPolicyOption - from ._models import ContentKeyPolicyPlayReadyConfiguration - from ._models import ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader - from ._models import ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier - from ._models import ContentKeyPolicyPlayReadyContentKeyLocation - from ._models import ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction - from ._models import ContentKeyPolicyPlayReadyLicense - from ._models import ContentKeyPolicyPlayReadyPlayRight - from ._models import ContentKeyPolicyProperties - from ._models import ContentKeyPolicyRestriction - from ._models import ContentKeyPolicyRestrictionTokenKey - from ._models import ContentKeyPolicyRsaTokenKey - from ._models import ContentKeyPolicySymmetricTokenKey - from ._models import ContentKeyPolicyTokenClaim - from ._models import ContentKeyPolicyTokenRestriction - from ._models import ContentKeyPolicyUnknownConfiguration - from ._models import ContentKeyPolicyUnknownRestriction - from ._models import ContentKeyPolicyWidevineConfiguration - from ._models import ContentKeyPolicyX509CertificateTokenKey - from ._models import CopyAudio - from ._models import CopyVideo - from ._models import CrossSiteAccessPolicies - from ._models import DefaultKey - from ._models import Deinterlace - from ._models import EdgePolicies - from ._models import EdgeUsageDataCollectionPolicy - from ._models import EdgeUsageDataEventHub - from ._models import EnabledProtocols - from ._models import EntityNameAvailabilityCheckOutput - from ._models import EnvelopeEncryption - from ._models import FaceDetectorPreset - from ._models import Filters - from ._models import FilterTrackPropertyCondition - from ._models import FilterTrackSelection - from ._models import FirstQuality - from ._models import Format - from ._models import H264Layer - from ._models import H264Video - from ._models import Hls - from ._models import Image - from ._models import ImageFormat - from ._models import IPAccessControl - from ._models import IPRange - from ._models import Job - from ._models import JobError - from ._models import JobErrorDetail - from ._models import JobInput - from ._models import JobInputAsset - from ._models import JobInputClip - from ._models import JobInputHttp - from ._models import JobInputs - from ._models import JobOutput - from ._models import JobOutputAsset - from ._models import JpgFormat - from ._models import JpgImage - from ._models import JpgLayer - from ._models import Layer - from ._models import ListContainerSasInput - from ._models import ListContentKeysResponse - from ._models import ListEdgePoliciesInput - from ._models import ListPathsResponse - from ._models import ListStreamingLocatorsResponse - from ._models import LiveEvent - from ._models import LiveEventActionInput - from ._models import LiveEventEncoding - from ._models import LiveEventEndpoint - from ._models import LiveEventInput - from ._models import LiveEventInputAccessControl - from ._models import LiveEventPreview - from ._models import LiveEventPreviewAccessControl - from ._models import LiveOutput - from ._models import Location - from ._models import MediaService - from ._models import Metric - from ._models import MetricDimension - from ._models import MetricProperties - from ._models import Mp4Format - from ._models import MultiBitrateFormat - from ._models import NoEncryption - from ._models import ODataError - from ._models import Operation - from ._models import OperationDisplay - from ._models import OutputFile - from ._models import Overlay - from ._models import PngFormat - from ._models import PngImage - from ._models import PngLayer - from ._models import PresentationTimeRange - from ._models import Preset - from ._models import Provider - from ._models import ProxyResource - from ._models import Rectangle - from ._models import Resource - from ._models import ServiceSpecification - from ._models import StandardEncoderPreset - from ._models import StorageAccount - from ._models import StorageEncryptedAssetDecryptionData - from ._models import StreamingEndpoint - from ._models import StreamingEndpointAccessControl - from ._models import StreamingEntityScaleUnit - from ._models import StreamingLocator - from ._models import StreamingLocatorContentKey - from ._models import StreamingPath - from ._models import StreamingPolicy - from ._models import StreamingPolicyContentKey - from ._models import StreamingPolicyContentKeys - from ._models import StreamingPolicyFairPlayConfiguration - from ._models import StreamingPolicyPlayReadyConfiguration - from ._models import StreamingPolicyWidevineConfiguration - from ._models import SubscriptionMediaService - from ._models import SyncStorageKeysInput - from ._models import TrackedResource - from ._models import TrackPropertyCondition - from ._models import TrackSelection - from ._models import Transform - from ._models import TransformOutput - from ._models import TransportStreamFormat - from ._models import Video - from ._models import VideoAnalyzerPreset - from ._models import VideoLayer - from ._models import VideoOverlay -from ._paged_models import AccountFilterPaged -from ._paged_models import AssetFilterPaged -from ._paged_models import AssetPaged -from ._paged_models import ContentKeyPolicyPaged -from ._paged_models import JobPaged -from ._paged_models import LiveEventPaged -from ._paged_models import LiveOutputPaged -from ._paged_models import MediaServicePaged -from ._paged_models import OperationPaged -from ._paged_models import StreamingEndpointPaged -from ._paged_models import StreamingLocatorPaged -from ._paged_models import StreamingPolicyPaged -from ._paged_models import SubscriptionMediaServicePaged -from ._paged_models import TransformPaged + from ._models import AacAudio # type: ignore + from ._models import AbsoluteClipTime # 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 ApiError # 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 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 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 H264Layer # type: ignore + from ._models import H264Video # 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 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 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 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 Location # 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 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 ODataError # 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 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 Provider # type: ignore + from ._models import ProxyResource # type: ignore + from ._models import Rectangle # type: ignore + from ._models import Resource # 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 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 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 ._azure_media_services_enums import ( - FilterTrackPropertyType, - FilterTrackPropertyCompareOperation, - MetricUnit, - MetricAggregationType, - StorageAccountType, - AssetStorageEncryptionFormat, + AacAudioProfile, + AccountEncryptionKeyType, + AnalysisResolution, AssetContainerPermission, - ContentKeyPolicyPlayReadyUnknownOutputPassingOption, - ContentKeyPolicyPlayReadyLicenseType, + AssetStorageEncryptionFormat, + AudioAnalysisMode, + ContentKeyPolicyFairPlayRentalAndLeaseKeyType, ContentKeyPolicyPlayReadyContentType, + ContentKeyPolicyPlayReadyLicenseType, + ContentKeyPolicyPlayReadyUnknownOutputPassingOption, ContentKeyPolicyRestrictionTokenType, - ContentKeyPolicyFairPlayRentalAndLeaseKeyType, - AacAudioProfile, - AnalysisResolution, - StretchMode, - DeinterlaceParity, DeinterlaceMode, - Rotation, - H264VideoProfile, + DeinterlaceParity, + EncoderNamedPreset, + EncryptionScheme, EntropyMode, + FilterTrackPropertyCompareOperation, + FilterTrackPropertyType, H264Complexity, - EncoderNamedPreset, + H264VideoProfile, InsightsType, - OnErrorType, - Priority, - JobErrorCode, JobErrorCategory, + JobErrorCode, JobRetry, JobState, - TrackPropertyType, - TrackPropertyCompareOperation, - StreamingLocatorContentKeyType, - StreamingPolicyStreamingProtocol, - EncryptionScheme, - LiveOutputResourceState, - LiveEventInputProtocol, LiveEventEncodingType, + LiveEventInputProtocol, LiveEventResourceState, + LiveOutputResourceState, + ManagedIdentityType, + MetricAggregationType, + MetricUnit, + OnErrorType, + Priority, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + Rotation, + StorageAccountType, + StorageAuthentication, StreamOptionsFlag, StreamingEndpointResourceState, + StreamingLocatorContentKeyType, + StreamingPolicyStreamingProtocol, + StretchMode, + TrackPropertyCompareOperation, + TrackPropertyType, + VideoSyncMode, ) __all__ = [ 'AacAudio', 'AbsoluteClipTime', + 'AccountEncryption', 'AccountFilter', + 'AccountFilterCollection', 'AkamaiAccessControl', 'AkamaiSignatureHeaderAuthenticationKey', - 'ApiError', 'ApiErrorException', + 'ApiError', 'Asset', + 'AssetCollection', 'AssetContainerSas', 'AssetFileEncryptionMetadata', 'AssetFilter', + 'AssetFilterCollection', 'AssetStreamingLocator', 'Audio', 'AudioAnalyzerPreset', @@ -391,6 +438,7 @@ 'CommonEncryptionCenc', 'ContentKeyPolicy', 'ContentKeyPolicyClearKeyConfiguration', + 'ContentKeyPolicyCollection', 'ContentKeyPolicyConfiguration', 'ContentKeyPolicyFairPlayConfiguration', 'ContentKeyPolicyFairPlayOfflineRentalConfiguration', @@ -426,19 +474,20 @@ 'EntityNameAvailabilityCheckOutput', 'EnvelopeEncryption', 'FaceDetectorPreset', - 'Filters', 'FilterTrackPropertyCondition', 'FilterTrackSelection', + 'Filters', 'FirstQuality', 'Format', 'H264Layer', 'H264Video', 'Hls', - 'Image', - 'ImageFormat', 'IPAccessControl', 'IPRange', + 'Image', + 'ImageFormat', 'Job', + 'JobCollection', 'JobError', 'JobErrorDetail', 'JobInput', @@ -451,6 +500,7 @@ 'JpgFormat', 'JpgImage', 'JpgLayer', + 'KeyVaultProperties', 'Layer', 'ListContainerSasInput', 'ListContentKeysResponse', @@ -463,19 +513,27 @@ 'LiveEventEndpoint', 'LiveEventInput', 'LiveEventInputAccessControl', + 'LiveEventInputTrackSelection', + 'LiveEventListResult', + 'LiveEventOutputTranscriptionTrack', 'LiveEventPreview', 'LiveEventPreviewAccessControl', + 'LiveEventTranscription', 'LiveOutput', + 'LiveOutputListResult', 'Location', + 'LogSpecification', 'MediaService', - 'Metric', + 'MediaServiceCollection', + 'MediaServiceIdentity', 'MetricDimension', - 'MetricProperties', + 'MetricSpecification', 'Mp4Format', 'MultiBitrateFormat', 'NoEncryption', 'ODataError', 'Operation', + 'OperationCollection', 'OperationDisplay', 'OutputFile', 'Overlay', @@ -484,6 +542,13 @@ 'PngLayer', 'PresentationTimeRange', 'Preset', + 'PrivateEndpoint', + 'PrivateEndpointConnection', + 'PrivateEndpointConnectionListResult', + 'PrivateLinkResource', + 'PrivateLinkResourceListResult', + 'PrivateLinkServiceConnectionState', + 'Properties', 'Provider', 'ProxyResource', 'Rectangle', @@ -494,80 +559,77 @@ 'StorageEncryptedAssetDecryptionData', 'StreamingEndpoint', 'StreamingEndpointAccessControl', + 'StreamingEndpointListResult', 'StreamingEntityScaleUnit', 'StreamingLocator', + 'StreamingLocatorCollection', 'StreamingLocatorContentKey', 'StreamingPath', 'StreamingPolicy', + 'StreamingPolicyCollection', 'StreamingPolicyContentKey', 'StreamingPolicyContentKeys', 'StreamingPolicyFairPlayConfiguration', 'StreamingPolicyPlayReadyConfiguration', 'StreamingPolicyWidevineConfiguration', - 'SubscriptionMediaService', 'SyncStorageKeysInput', - 'TrackedResource', 'TrackPropertyCondition', 'TrackSelection', + 'TrackedResource', 'Transform', + 'TransformCollection', 'TransformOutput', 'TransportStreamFormat', + 'UtcClipTime', 'Video', 'VideoAnalyzerPreset', 'VideoLayer', 'VideoOverlay', - 'AccountFilterPaged', - 'OperationPaged', - 'MediaServicePaged', - 'SubscriptionMediaServicePaged', - 'AssetPaged', - 'AssetFilterPaged', - 'ContentKeyPolicyPaged', - 'TransformPaged', - 'JobPaged', - 'StreamingPolicyPaged', - 'StreamingLocatorPaged', - 'LiveEventPaged', - 'LiveOutputPaged', - 'StreamingEndpointPaged', - 'FilterTrackPropertyType', - 'FilterTrackPropertyCompareOperation', - 'MetricUnit', - 'MetricAggregationType', - 'StorageAccountType', - 'AssetStorageEncryptionFormat', + 'AacAudioProfile', + 'AccountEncryptionKeyType', + 'AnalysisResolution', 'AssetContainerPermission', - 'ContentKeyPolicyPlayReadyUnknownOutputPassingOption', - 'ContentKeyPolicyPlayReadyLicenseType', + 'AssetStorageEncryptionFormat', + 'AudioAnalysisMode', + 'ContentKeyPolicyFairPlayRentalAndLeaseKeyType', 'ContentKeyPolicyPlayReadyContentType', + 'ContentKeyPolicyPlayReadyLicenseType', + 'ContentKeyPolicyPlayReadyUnknownOutputPassingOption', 'ContentKeyPolicyRestrictionTokenType', - 'ContentKeyPolicyFairPlayRentalAndLeaseKeyType', - 'AacAudioProfile', - 'AnalysisResolution', - 'StretchMode', - 'DeinterlaceParity', 'DeinterlaceMode', - 'Rotation', - 'H264VideoProfile', + 'DeinterlaceParity', + 'EncoderNamedPreset', + 'EncryptionScheme', 'EntropyMode', + 'FilterTrackPropertyCompareOperation', + 'FilterTrackPropertyType', 'H264Complexity', - 'EncoderNamedPreset', + 'H264VideoProfile', 'InsightsType', - 'OnErrorType', - 'Priority', - 'JobErrorCode', 'JobErrorCategory', + 'JobErrorCode', 'JobRetry', 'JobState', - 'TrackPropertyType', - 'TrackPropertyCompareOperation', - 'StreamingLocatorContentKeyType', - 'StreamingPolicyStreamingProtocol', - 'EncryptionScheme', - 'LiveOutputResourceState', - 'LiveEventInputProtocol', 'LiveEventEncodingType', + 'LiveEventInputProtocol', 'LiveEventResourceState', + 'LiveOutputResourceState', + 'ManagedIdentityType', + 'MetricAggregationType', + 'MetricUnit', + 'OnErrorType', + 'Priority', + 'PrivateEndpointConnectionProvisioningState', + 'PrivateEndpointServiceConnectionStatus', + 'Rotation', + 'StorageAccountType', + 'StorageAuthentication', 'StreamOptionsFlag', 'StreamingEndpointResourceState', + 'StreamingLocatorContentKeyType', + 'StreamingPolicyStreamingProtocol', + 'StretchMode', + 'TrackPropertyCompareOperation', + 'TrackPropertyType', + 'VideoSyncMode', ] 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 858dcb3bc4a1..c62b5331de3e 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 @@ -1,320 +1,455 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class AacAudioProfile(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The encoding profile to be used when encoding audio with AAC. + """ + + AAC_LC = "AacLc" #: Specifies that the output audio is to be encoded into AAC Low Complexity profile (AAC-LC). + HE_AAC_V1 = "HeAacV1" #: Specifies that the output audio is to be encoded into HE-AAC v1 profile. + HE_AAC_V2 = "HeAacV2" #: Specifies that the output audio is to be encoded into HE-AAC v2 profile. + +class AccountEncryptionKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of key used to encrypt the Account Key. + """ + + SYSTEM_KEY = "SystemKey" #: The Account Key is encrypted with a System Key. + CUSTOMER_KEY = "CustomerKey" #: The Account Key is encrypted with a Customer Key. + +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 + 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. + """ + + SOURCE_RESOLUTION = "SourceResolution" + STANDARD_DEFINITION = "StandardDefinition" + +class AssetContainerPermission(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The permissions to set on the SAS URL. + """ + + READ = "Read" #: The SAS URL will allow read access to the container. + READ_WRITE = "ReadWrite" #: The SAS URL will allow read and write access to the container. + READ_WRITE_DELETE = "ReadWriteDelete" #: The SAS URL will allow read, write and delete access to the container. + +class AssetStorageEncryptionFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The Asset encryption format. One of None or MediaStorageEncryption. + """ + + NONE = "None" #: The Asset does not use client-side storage encryption (this is the only allowed value for new Assets). + MEDIA_STORAGE_CLIENT_ENCRYPTION = "MediaStorageClientEncryption" #: The Asset is encrypted with Media Services client-side encryption. + +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. + """ + + STANDARD = "Standard" #: Performs all operations included in the Basic mode, additionally performing language detection and speaker diarization. + BASIC = "Basic" #: This mode performs speech-to-text transcription and generation of a VTT subtitle/caption file. The output of this mode includes an Insights JSON file including only the keywords, transcription,and timing information. Automatic language detection and speaker diarization are not included in this mode. + +class ContentKeyPolicyFairPlayRentalAndLeaseKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The rental and lease key type. + """ + + UNKNOWN = "Unknown" #: Represents a ContentKeyPolicyFairPlayRentalAndLeaseKeyType that is unavailable in current API version. + UNDEFINED = "Undefined" #: Key duration is not specified. + DUAL_EXPIRY = "DualExpiry" #: Dual expiry for offline rental. + PERSISTENT_UNLIMITED = "PersistentUnlimited" #: Content key can be persisted with an unlimited duration. + PERSISTENT_LIMITED = "PersistentLimited" #: Content key can be persisted and the valid duration is limited by the Rental Duration value. + +class ContentKeyPolicyPlayReadyContentType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The PlayReady content type. + """ + + UNKNOWN = "Unknown" #: Represents a ContentKeyPolicyPlayReadyContentType that is unavailable in current API version. + UNSPECIFIED = "Unspecified" #: Unspecified content type. + ULTRA_VIOLET_DOWNLOAD = "UltraVioletDownload" #: Ultraviolet download content type. + ULTRA_VIOLET_STREAMING = "UltraVioletStreaming" #: Ultraviolet streaming content type. + +class ContentKeyPolicyPlayReadyLicenseType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The license type. + """ + + UNKNOWN = "Unknown" #: Represents a ContentKeyPolicyPlayReadyLicenseType that is unavailable in current API version. + NON_PERSISTENT = "NonPersistent" #: Non persistent license. + PERSISTENT = "Persistent" #: Persistent license. Allows offline playback. + +class ContentKeyPolicyPlayReadyUnknownOutputPassingOption(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Configures Unknown output handling settings of the license. + """ + + UNKNOWN = "Unknown" #: Represents a ContentKeyPolicyPlayReadyUnknownOutputPassingOption that is unavailable in current API version. + NOT_ALLOWED = "NotAllowed" #: Passing the video portion of protected content to an Unknown Output is not allowed. + ALLOWED = "Allowed" #: Passing the video portion of protected content to an Unknown Output is allowed. + ALLOWED_WITH_VIDEO_CONSTRICTION = "AllowedWithVideoConstriction" #: Passing the video portion of protected content to an Unknown Output is allowed but with constrained resolution. + +class ContentKeyPolicyRestrictionTokenType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of token. + """ + + UNKNOWN = "Unknown" #: Represents a ContentKeyPolicyRestrictionTokenType that is unavailable in current API version. + SWT = "Swt" #: Simple Web Token. + JWT = "Jwt" #: JSON Web Token. + +class DeinterlaceMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The deinterlacing mode. Defaults to AutoPixelAdaptive. + """ + + OFF = "Off" #: Disables de-interlacing of the source video. + AUTO_PIXEL_ADAPTIVE = "AutoPixelAdaptive" #: Apply automatic pixel adaptive de-interlacing on each frame in the input video. + +class DeinterlaceParity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The field parity for de-interlacing, defaults to Auto. + """ + + AUTO = "Auto" #: Automatically detect the order of fields. + TOP_FIELD_FIRST = "TopFieldFirst" #: Apply top field first processing of input video. + BOTTOM_FIELD_FIRST = "BottomFieldFirst" #: Apply bottom field first processing of input video. + +class EncoderNamedPreset(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The built-in preset to be used for encoding videos. + """ + + H264_SINGLE_BITRATE_SD = "H264SingleBitrateSD" #: Produces an MP4 file where the video is encoded with H.264 codec at 2200 kbps and a picture height of 480 pixels, and the stereo audio is encoded with AAC-LC codec at 128 kbps. + H264_SINGLE_BITRATE720_P = "H264SingleBitrate720p" #: Produces an MP4 file where the video is encoded with H.264 codec at 4500 kbps and a picture height of 720 pixels, and the stereo audio is encoded with AAC-LC codec at 128 kbps. + H264_SINGLE_BITRATE1080_P = "H264SingleBitrate1080p" #: Produces an MP4 file where the video is encoded with H.264 codec at 6750 kbps and a picture height of 1080 pixels, and the stereo audio is encoded with AAC-LC codec at 128 kbps. + ADAPTIVE_STREAMING = "AdaptiveStreaming" #: Produces a set of GOP aligned MP4 files with H.264 video and stereo AAC audio. Auto-generates a bitrate ladder based on the input resolution, bitrate and frame rate. The auto-generated preset will never exceed the input resolution. For example, if the input is 720p, output will remain 720p at best. + AAC_GOOD_QUALITY_AUDIO = "AACGoodQualityAudio" #: Produces a single MP4 file containing only stereo audio encoded at 192 kbps. + CONTENT_AWARE_ENCODING_EXPERIMENTAL = "ContentAwareEncodingExperimental" #: Exposes an experimental preset for content-aware encoding. Given any input content, the service attempts to automatically determine the optimal number of layers, appropriate bitrate and resolution settings for delivery by adaptive streaming. The underlying algorithms will continue to evolve over time. The output will contain MP4 files with video and audio interleaved. + CONTENT_AWARE_ENCODING = "ContentAwareEncoding" #: Produces a set of GOP-aligned MP4s by using content-aware encoding. Given any input content, the service performs an initial lightweight analysis of the input content, and uses the results to determine the optimal number of layers, appropriate bitrate and resolution settings for delivery by adaptive streaming. This preset is particularly effective for low and medium complexity videos, where the output files will be at lower bitrates but at a quality that still delivers a good experience to viewers. The output will contain MP4 files with video and audio interleaved. + COPY_ALL_BITRATE_NON_INTERLEAVED = "CopyAllBitrateNonInterleaved" #: Copy all video and audio streams from the input asset as non-interleaved video and audio output files. This preset can be used to clip an existing asset or convert a group of key frame (GOP) aligned MP4 files as an asset that can be streamed. + H264_MULTIPLE_BITRATE1080_P = "H264MultipleBitrate1080p" #: Produces a set of 8 GOP-aligned MP4 files, ranging from 6000 kbps to 400 kbps, and stereo AAC audio. Resolution starts at 1080p and goes down to 180p. + H264_MULTIPLE_BITRATE720_P = "H264MultipleBitrate720p" #: Produces a set of 6 GOP-aligned MP4 files, ranging from 3400 kbps to 400 kbps, and stereo AAC audio. Resolution starts at 720p and goes down to 180p. + H264_MULTIPLE_BITRATE_SD = "H264MultipleBitrateSD" #: Produces a set of 5 GOP-aligned MP4 files, ranging from 1900kbps to 400 kbps, and stereo AAC audio. Resolution starts at 480p and goes down to 240p. + +class EncryptionScheme(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Encryption scheme + """ + + NO_ENCRYPTION = "NoEncryption" #: NoEncryption scheme. + ENVELOPE_ENCRYPTION = "EnvelopeEncryption" #: EnvelopeEncryption scheme. + COMMON_ENCRYPTION_CENC = "CommonEncryptionCenc" #: CommonEncryptionCenc scheme. + COMMON_ENCRYPTION_CBCS = "CommonEncryptionCbcs" #: CommonEncryptionCbcs scheme. + +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. + """ + + CABAC = "Cabac" #: Context Adaptive Binary Arithmetic Coder (CABAC) entropy encoding. + CAVLC = "Cavlc" #: Context Adaptive Variable Length Coder (CAVLC) entropy encoding. + +class FilterTrackPropertyCompareOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The track property condition operation. + """ + + EQUAL = "Equal" #: The equal operation. + NOT_EQUAL = "NotEqual" #: The not equal operation. + +class FilterTrackPropertyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The track property type. + """ + + UNKNOWN = "Unknown" #: The unknown track property type. + TYPE = "Type" #: The type. + NAME = "Name" #: The name. + LANGUAGE = "Language" #: The language. + FOUR_CC = "FourCC" #: The fourCC. + BITRATE = "Bitrate" #: The bitrate. + +class H264Complexity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Tells the encoder how to choose its encoding settings. The default value is Balanced. + """ + + SPEED = "Speed" #: Tells the encoder to use settings that are optimized for faster encoding. Quality is sacrificed to decrease encoding time. + BALANCED = "Balanced" #: Tells the encoder to use settings that achieve a balance between speed and quality. + QUALITY = "Quality" #: Tells the encoder to use settings that are optimized to produce higher quality output at the expense of slower overall encode time. + +class H264VideoProfile(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """We currently support Baseline, Main, High, High422, High444. Default is Auto. + """ + + AUTO = "Auto" #: Tells the encoder to automatically determine the appropriate H.264 profile. + BASELINE = "Baseline" #: Baseline profile. + MAIN = "Main" #: Main profile. + HIGH = "High" #: High profile. + HIGH422 = "High422" #: High 4:2:2 profile. + HIGH444 = "High444" #: High 4:4:4 predictive profile. + +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. + 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. + """ + + AUDIO_INSIGHTS_ONLY = "AudioInsightsOnly" #: Generate audio only insights. Ignore video even if present. Fails if no audio is present. + VIDEO_INSIGHTS_ONLY = "VideoInsightsOnly" #: Generate video only insights. Ignore audio if present. Fails if no video is present. + ALL_INSIGHTS = "AllInsights" #: Generate both audio and video insights. Fails if either audio or video Insights fail. + +class JobErrorCategory(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Helps with categorization of errors. + """ + + SERVICE = "Service" #: The error is service related. + DOWNLOAD = "Download" #: The error is download related. + UPLOAD = "Upload" #: The error is upload related. + CONFIGURATION = "Configuration" #: The error is configuration related. + CONTENT = "Content" #: The error is related to data in the input files. + +class JobErrorCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Error code describing the error. + """ + + SERVICE_ERROR = "ServiceError" #: Fatal service error, please contact support. + SERVICE_TRANSIENT_ERROR = "ServiceTransientError" #: Transient error, please retry, if retry is unsuccessful, please contact support. + DOWNLOAD_NOT_ACCESSIBLE = "DownloadNotAccessible" #: While trying to download the input files, the files were not accessible, please check the availability of the source. + DOWNLOAD_TRANSIENT_ERROR = "DownloadTransientError" #: While trying to download the input files, there was an issue during transfer (storage service, network errors), see details and check your source. + UPLOAD_NOT_ACCESSIBLE = "UploadNotAccessible" #: While trying to upload the output files, the destination was not reachable, please check the availability of the destination. + UPLOAD_TRANSIENT_ERROR = "UploadTransientError" #: While trying to upload the output files, there was an issue during transfer (storage service, network errors), see details and check your destination. + CONFIGURATION_UNSUPPORTED = "ConfigurationUnsupported" #: There was a problem with the combination of input files and the configuration settings applied, fix the configuration settings and retry with the same input, or change input to match the configuration. + CONTENT_MALFORMED = "ContentMalformed" #: There was a problem with the input content (for example: zero byte files, or corrupt/non-decodable files), check the input files. + CONTENT_UNSUPPORTED = "ContentUnsupported" #: There was a problem with the format of the input (not valid media file, or an unsupported file/codec), check the validity of the input files. + +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. + """ + + DO_NOT_RETRY = "DoNotRetry" #: Issue needs to be investigated and then the job resubmitted with corrections or retried once the underlying issue has been corrected. + MAY_RETRY = "MayRetry" #: Issue may be resolved after waiting for a period of time and resubmitting the same Job. + +class JobState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Describes the state of the JobOutput. + """ + + CANCELED = "Canceled" #: The job was canceled. This is a final state for the job. + CANCELING = "Canceling" #: The job is in the process of being canceled. This is a transient state for the job. + ERROR = "Error" #: The job has encountered an error. This is a final state for the job. + FINISHED = "Finished" #: The job is finished. This is a final state for the job. + PROCESSING = "Processing" #: The job is processing. This is a transient state for the job. + QUEUED = "Queued" #: The job is in a queued state, waiting for resources to become available. This is a transient state. + SCHEDULED = "Scheduled" #: The job is being scheduled to run on an available resource. This is a transient state, between queued and processing states. + +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. + """ + + NONE = "None" #: 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. + STANDARD = "Standard" #: 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. + PREMIUM1080_P = "Premium1080p" #: 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. + +class LiveEventInputProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The input protocol for the live event. This is specified at creation time and cannot be + updated. + """ + + FRAGMENTED_MP4 = "FragmentedMP4" #: Smooth Streaming input will be sent by the contribution encoder to the live event. + RTMP = "RTMP" #: RTMP input will be sent by the contribution encoder to the live event. + +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. + """ + + STOPPED = "Stopped" #: This is the initial state of the live event after creation (unless autostart was set to true.) No billing occurs in this state. In this state, the live event properties can be updated but streaming is not allowed. + ALLOCATING = "Allocating" #: Allocate action was called on the live event and resources are being provisioned for this live event. Once allocation completes successfully, the live event will transition to StandBy state. + STAND_BY = "StandBy" #: Live event resources have been provisioned and is ready to start. Billing occurs in this state. Most properties can still be updated, however ingest or streaming is not allowed during this state. + STARTING = "Starting" #: The live event is being started and resources are being allocated. No billing occurs in this state. Updates or streaming are not allowed during this state. If an error occurs, the live event returns to the Stopped state. + RUNNING = "Running" #: The live event resources have been allocated, ingest and preview URLs have been generated, and it is capable of receiving live streams. At this point, billing is active. You must explicitly call Stop on the live event resource to halt further billing. + STOPPING = "Stopping" #: The live event is being stopped and resources are being de-provisioned. No billing occurs in this transient state. Updates or streaming are not allowed during this state. + DELETING = "Deleting" #: The live event is being deleted. No billing occurs in this transient state. Updates or streaming are not allowed during this state. + +class LiveOutputResourceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The resource state of the live output. + """ + + CREATING = "Creating" #: Live output is being created. No content is archived in the asset until the live output is in running state. + RUNNING = "Running" #: Live output is running and archiving live streaming content to the asset if there is valid input from a contribution encoder. + DELETING = "Deleting" #: Live output is being deleted. The live asset is being converted from live to on-demand asset. Any streaming URLs created on the live output asset continue to work. + +class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The identity type. + """ + + SYSTEM_ASSIGNED = "SystemAssigned" #: A system-assigned managed identity. + NONE = "None" #: No managed identity. + +class MetricAggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The metric aggregation type + """ + + AVERAGE = "Average" #: The average. + COUNT = "Count" #: The count of a number of items, usually requests. + TOTAL = "Total" #: The sum. + +class MetricUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The metric unit + """ + + BYTES = "Bytes" #: The number of bytes. + COUNT = "Count" #: The count. + MILLISECONDS = "Milliseconds" #: The number of milliseconds. + +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 + 'ContinueJob'. The default is 'StopProcessingJob'. + """ + + STOP_PROCESSING_JOB = "StopProcessingJob" #: Tells the service that if this TransformOutput fails, then any other incomplete TransformOutputs can be stopped. + CONTINUE_JOB = "ContinueJob" #: Tells the service that if this TransformOutput fails, then allow any other TransformOutput to continue. + +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. + """ + + LOW = "Low" #: Used for TransformOutputs that can be generated after Normal and High priority TransformOutputs. + NORMAL = "Normal" #: Used for TransformOutputs that can be generated at Normal priority. + HIGH = "High" #: Used for TransformOutputs that should take precedence over others. + +class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The current provisioning state. + """ + + SUCCEEDED = "Succeeded" + CREATING = "Creating" + DELETING = "Deleting" + FAILED = "Failed" + +class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The private endpoint connection status. + """ + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + +class Rotation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The rotation, if any, to be applied to the input video, before it is encoded. Default is Auto + """ + + AUTO = "Auto" #: Automatically detect and rotate as needed. + NONE = "None" #: Do not rotate the video. If the output format supports it, any metadata about rotation is kept intact. + ROTATE0 = "Rotate0" #: Do not rotate the video but remove any metadata about the rotation. + ROTATE90 = "Rotate90" #: Rotate 90 degrees clockwise. + ROTATE180 = "Rotate180" #: Rotate 180 degrees clockwise. + ROTATE270 = "Rotate270" #: Rotate 270 degrees clockwise. + +class StorageAccountType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of the storage account. + """ + + PRIMARY = "Primary" #: The primary storage account for the Media Services account. + SECONDARY = "Secondary" #: A secondary storage account for the Media Services account. + +class StorageAuthentication(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + SYSTEM = "System" #: System authentication. + MANAGED_IDENTITY = "ManagedIdentity" #: Managed Identity authentication. + +class StreamingEndpointResourceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The resource state of the streaming endpoint. + """ + + STOPPED = "Stopped" #: The initial state of a streaming endpoint after creation. Content is not ready to be streamed from this endpoint. + STARTING = "Starting" #: The streaming endpoint is transitioning to the running state. + RUNNING = "Running" #: The streaming endpoint is running. It is able to stream content to clients. + STOPPING = "Stopping" #: The streaming endpoint is transitioning to the stopped state. + DELETING = "Deleting" #: The streaming endpoint is being deleted. + SCALING = "Scaling" #: The streaming endpoint is increasing or decreasing scale units. + +class StreamingLocatorContentKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Encryption type of Content Key + """ + + COMMON_ENCRYPTION_CENC = "CommonEncryptionCenc" #: Common Encryption using CENC. + COMMON_ENCRYPTION_CBCS = "CommonEncryptionCbcs" #: Common Encryption using CBCS. + ENVELOPE_ENCRYPTION = "EnvelopeEncryption" #: Envelope Encryption. + +class StreamingPolicyStreamingProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Streaming protocol + """ + + HLS = "Hls" #: HLS protocol. + DASH = "Dash" #: DASH protocol. + SMOOTH_STREAMING = "SmoothStreaming" #: SmoothStreaming protocol. + DOWNLOAD = "Download" #: Download protocol. + +class StreamOptionsFlag(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + DEFAULT = "Default" #: Live streaming with no special latency optimizations. + LOW_LATENCY = "LowLatency" #: 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. + +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 + """ + + NONE = "None" #: Strictly respect the output resolution without considering the pixel aspect ratio or display aspect ratio of the input video. + AUTO_SIZE = "AutoSize" #: Override the output resolution, and change it to match the display aspect ratio of the input, without padding. For example, if the input is 1920x1080 and the encoding preset asks for 1280x1280, then the value in the preset is overridden, and the output will be at 1280x720, which maintains the input aspect ratio of 16:9. + AUTO_FIT = "AutoFit" #: Pad the output (with either letterbox or pillar box) to honor the output resolution, while ensuring that the active video region in the output has the same aspect ratio as the input. For example, if the input is 1920x1080 and the encoding preset asks for 1280x1280, then the output will be at 1280x1280, which contains an inner rectangle of 1280x720 at aspect ratio of 16:9, and pillar box regions 280 pixels wide at the left and right. + +class TrackPropertyCompareOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Track property condition operation + """ + UNKNOWN = "Unknown" #: Unknown track property compare operation. + EQUAL = "Equal" #: Equal operation. + +class TrackPropertyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Track property type + """ + + UNKNOWN = "Unknown" #: Unknown track property. + FOUR_CC = "FourCC" #: Track FourCC. -class FilterTrackPropertyType(str, Enum): +class VideoSyncMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The Video Sync Mode + """ - unknown = "Unknown" #: The unknown track property type. - type = "Type" #: The type. - name = "Name" #: The name. - language = "Language" #: The language. - four_cc = "FourCC" #: The fourCC. - bitrate = "Bitrate" #: The bitrate. - - -class FilterTrackPropertyCompareOperation(str, Enum): - - equal = "Equal" #: The equal operation. - not_equal = "NotEqual" #: The not equal operation. - - -class MetricUnit(str, Enum): - - bytes = "Bytes" #: The number of bytes. - count = "Count" #: The count. - milliseconds = "Milliseconds" #: The number of milliseconds. - - -class MetricAggregationType(str, Enum): - - average = "Average" #: The average. - count = "Count" #: The count of a number of items, usually requests. - total = "Total" #: The sum. - - -class StorageAccountType(str, Enum): - - primary = "Primary" #: The primary storage account for the Media Services account. - secondary = "Secondary" #: A secondary storage account for the Media Services account. - - -class AssetStorageEncryptionFormat(str, Enum): - - none = "None" #: The Asset does not use client-side storage encryption (this is the only allowed value for new Assets). - media_storage_client_encryption = "MediaStorageClientEncryption" #: The Asset is encrypted with Media Services client-side encryption. - - -class AssetContainerPermission(str, Enum): - - read = "Read" #: The SAS URL will allow read access to the container. - read_write = "ReadWrite" #: The SAS URL will allow read and write access to the container. - read_write_delete = "ReadWriteDelete" #: The SAS URL will allow read, write and delete access to the container. - - -class ContentKeyPolicyPlayReadyUnknownOutputPassingOption(str, Enum): - - unknown = "Unknown" #: Represents a ContentKeyPolicyPlayReadyUnknownOutputPassingOption that is unavailable in current API version. - not_allowed = "NotAllowed" #: Passing the video portion of protected content to an Unknown Output is not allowed. - allowed = "Allowed" #: Passing the video portion of protected content to an Unknown Output is allowed. - allowed_with_video_constriction = "AllowedWithVideoConstriction" #: Passing the video portion of protected content to an Unknown Output is allowed but with constrained resolution. - - -class ContentKeyPolicyPlayReadyLicenseType(str, Enum): - - unknown = "Unknown" #: Represents a ContentKeyPolicyPlayReadyLicenseType that is unavailable in current API version. - non_persistent = "NonPersistent" #: Non persistent license. - persistent = "Persistent" #: Persistent license. Allows offline playback. - - -class ContentKeyPolicyPlayReadyContentType(str, Enum): - - unknown = "Unknown" #: Represents a ContentKeyPolicyPlayReadyContentType that is unavailable in current API version. - unspecified = "Unspecified" #: Unspecified content type. - ultra_violet_download = "UltraVioletDownload" #: Ultraviolet download content type. - ultra_violet_streaming = "UltraVioletStreaming" #: Ultraviolet streaming content type. - - -class ContentKeyPolicyRestrictionTokenType(str, Enum): - - unknown = "Unknown" #: Represents a ContentKeyPolicyRestrictionTokenType that is unavailable in current API version. - swt = "Swt" #: Simple Web Token. - jwt = "Jwt" #: JSON Web Token. - - -class ContentKeyPolicyFairPlayRentalAndLeaseKeyType(str, Enum): - - unknown = "Unknown" #: Represents a ContentKeyPolicyFairPlayRentalAndLeaseKeyType that is unavailable in current API version. - undefined = "Undefined" #: Key duration is not specified. - dual_expiry = "DualExpiry" #: Dual expiry for offline rental. - persistent_unlimited = "PersistentUnlimited" #: Content key can be persisted with an unlimited duration - persistent_limited = "PersistentLimited" #: Content key can be persisted and the valid duration is limited by the Rental Duration value - - -class AacAudioProfile(str, Enum): - - aac_lc = "AacLc" #: Specifies that the output audio is to be encoded into AAC Low Complexity profile (AAC-LC). - he_aac_v1 = "HeAacV1" #: Specifies that the output audio is to be encoded into HE-AAC v1 profile. - he_aac_v2 = "HeAacV2" #: Specifies that the output audio is to be encoded into HE-AAC v2 profile. - - -class AnalysisResolution(str, Enum): - - source_resolution = "SourceResolution" - standard_definition = "StandardDefinition" - - -class StretchMode(str, Enum): - - none = "None" #: Strictly respect the output resolution without considering the pixel aspect ratio or display aspect ratio of the input video. - auto_size = "AutoSize" #: Override the output resolution, and change it to match the display aspect ratio of the input, without padding. For example, if the input is 1920x1080 and the encoding preset asks for 1280x1280, then the value in the preset is overridden, and the output will be at 1280x720, which maintains the input aspect ratio of 16:9. - auto_fit = "AutoFit" #: Pad the output (with either letterbox or pillar box) to honor the output resolution, while ensuring that the active video region in the output has the same aspect ratio as the input. For example, if the input is 1920x1080 and the encoding preset asks for 1280x1280, then the output will be at 1280x1280, which contains an inner rectangle of 1280x720 at aspect ratio of 16:9, and pillar box regions 280 pixels wide at the left and right. - - -class DeinterlaceParity(str, Enum): - - auto = "Auto" #: Automatically detect the order of fields - top_field_first = "TopFieldFirst" #: Apply top field first processing of input video. - bottom_field_first = "BottomFieldFirst" #: Apply bottom field first processing of input video. - - -class DeinterlaceMode(str, Enum): - - off = "Off" #: Disables de-interlacing of the source video. - auto_pixel_adaptive = "AutoPixelAdaptive" #: Apply automatic pixel adaptive de-interlacing on each frame in the input video. - - -class Rotation(str, Enum): - - auto = "Auto" #: Automatically detect and rotate as needed. - none = "None" #: Do not rotate the video. If the output format supports it, any metadata about rotation is kept intact. - rotate0 = "Rotate0" #: Do not rotate the video but remove any metadata about the rotation. - rotate90 = "Rotate90" #: Rotate 90 degrees clockwise. - rotate180 = "Rotate180" #: Rotate 180 degrees clockwise. - rotate270 = "Rotate270" #: Rotate 270 degrees clockwise. - - -class H264VideoProfile(str, Enum): - - auto = "Auto" #: Tells the encoder to automatically determine the appropriate H.264 profile. - baseline = "Baseline" #: Baseline profile - main = "Main" #: Main profile - high = "High" #: High profile. - high422 = "High422" #: High 4:2:2 profile. - high444 = "High444" #: High 4:4:4 predictive profile. - - -class EntropyMode(str, Enum): - - cabac = "Cabac" #: Context Adaptive Binary Arithmetic Coder (CABAC) entropy encoding. - cavlc = "Cavlc" #: Context Adaptive Variable Length Coder (CAVLC) entropy encoding. - - -class H264Complexity(str, Enum): - - speed = "Speed" #: Tells the encoder to use settings that are optimized for faster encoding. Quality is sacrificed to decrease encoding time. - balanced = "Balanced" #: Tells the encoder to use settings that achieve a balance between speed and quality. - quality = "Quality" #: Tells the encoder to use settings that are optimized to produce higher quality output at the expense of slower overall encode time. - - -class EncoderNamedPreset(str, Enum): - - h264_single_bitrate_sd = "H264SingleBitrateSD" #: Produces an MP4 file where the video is encoded with H.264 codec at 2200 kbps and a picture height of 480 pixels, and the stereo audio is encoded with AAC-LC codec at 64 kbps. - h264_single_bitrate720p = "H264SingleBitrate720p" #: Produces an MP4 file where the video is encoded with H.264 codec at 4500 kbps and a picture height of 720 pixels, and the stereo audio is encoded with AAC-LC codec at 64 kbps. - h264_single_bitrate1080p = "H264SingleBitrate1080p" #: Produces an MP4 file where the video is encoded with H.264 codec at 6750 kbps and a picture height of 1080 pixels, and the stereo audio is encoded with AAC-LC codec at 64 kbps. - adaptive_streaming = "AdaptiveStreaming" #: Produces a set of GOP aligned MP4 files with H.264 video and stereo AAC audio. Auto-generates a bitrate ladder based on the input resolution and bitrate. The auto-generated preset will never exceed the input resolution and bitrate. For example, if the input is 720p at 3 Mbps, output will remain 720p at best, and will start at rates lower than 3 Mbps. The output will have video and audio in separate MP4 files, which is optimal for adaptive streaming. - aac_good_quality_audio = "AACGoodQualityAudio" #: Produces a single MP4 file containing only stereo audio encoded at 192 kbps. - content_aware_encoding_experimental = "ContentAwareEncodingExperimental" #: Exposes an experimental preset for content-aware encoding. Given any input content, the service attempts to automatically determine the optimal number of layers, appropriate bitrate and resolution settings for delivery by adaptive streaming. The underlying algorithms will continue to evolve over time. The output will contain MP4 files with video and audio interleaved. - content_aware_encoding = "ContentAwareEncoding" #: Produces a set of GOP-aligned MP4s by using content-aware encoding. Given any input content, the service performs an initial lightweight analysis of the input content, and uses the results to determine the optimal number of layers, appropriate bitrate and resolution settings for delivery by adaptive streaming. This preset is particularly effective for low and medium complexity videos, where the output files will be at lower bitrates but at a quality that still delivers a good experience to viewers. The output will contain MP4 files with video and audio interleaved. - h264_multiple_bitrate1080p = "H264MultipleBitrate1080p" #: Produces a set of 8 GOP-aligned MP4 files, ranging from 6000 kbps to 400 kbps, and stereo AAC audio. Resolution starts at 1080p and goes down to 360p. - h264_multiple_bitrate720p = "H264MultipleBitrate720p" #: Produces a set of 6 GOP-aligned MP4 files, ranging from 3400 kbps to 400 kbps, and stereo AAC audio. Resolution starts at 720p and goes down to 360p. - h264_multiple_bitrate_sd = "H264MultipleBitrateSD" #: Produces a set of 5 GOP-aligned MP4 files, ranging from 1600kbps to 400 kbps, and stereo AAC audio. Resolution starts at 480p and goes down to 360p. - - -class InsightsType(str, Enum): - - audio_insights_only = "AudioInsightsOnly" #: Generate audio only insights. Ignore video even if present. Fails if no audio is present. - video_insights_only = "VideoInsightsOnly" #: Generate video only insights. Ignore audio if present. Fails if no video is present. - all_insights = "AllInsights" #: Generate both audio and video insights. Fails if either audio or video Insights fail. - - -class OnErrorType(str, Enum): - - stop_processing_job = "StopProcessingJob" #: Tells the service that if this TransformOutput fails, then any other incomplete TransformOutputs can be stopped. - continue_job = "ContinueJob" #: Tells the service that if this TransformOutput fails, then allow any other TransformOutput to continue. - - -class Priority(str, Enum): - - low = "Low" #: Used for TransformOutputs that can be generated after Normal and High priority TransformOutputs. - normal = "Normal" #: Used for TransformOutputs that can be generated at Normal priority. - high = "High" #: Used for TransformOutputs that should take precedence over others. - - -class JobErrorCode(str, Enum): - - service_error = "ServiceError" #: Fatal service error, please contact support. - service_transient_error = "ServiceTransientError" #: Transient error, please retry, if retry is unsuccessful, please contact support. - download_not_accessible = "DownloadNotAccessible" #: While trying to download the input files, the files were not accessible, please check the availability of the source. - download_transient_error = "DownloadTransientError" #: While trying to download the input files, there was an issue during transfer (storage service, network errors), see details and check your source. - upload_not_accessible = "UploadNotAccessible" #: While trying to upload the output files, the destination was not reachable, please check the availability of the destination. - upload_transient_error = "UploadTransientError" #: While trying to upload the output files, there was an issue during transfer (storage service, network errors), see details and check your destination. - configuration_unsupported = "ConfigurationUnsupported" #: There was a problem with the combination of input files and the configuration settings applied, fix the configuration settings and retry with the same input, or change input to match the configuration. - content_malformed = "ContentMalformed" #: There was a problem with the input content (for example: zero byte files, or corrupt/non-decodable files), check the input files. - content_unsupported = "ContentUnsupported" #: There was a problem with the format of the input (not valid media file, or an unsupported file/codec), check the validity of the input files. - - -class JobErrorCategory(str, Enum): - - service = "Service" #: The error is service related. - download = "Download" #: The error is download related. - upload = "Upload" #: The error is upload related. - configuration = "Configuration" #: The error is configuration related. - content = "Content" #: The error is related to data in the input files. - - -class JobRetry(str, Enum): - - do_not_retry = "DoNotRetry" #: Issue needs to be investigated and then the job resubmitted with corrections or retried once the underlying issue has been corrected. - may_retry = "MayRetry" #: Issue may be resolved after waiting for a period of time and resubmitting the same Job. - - -class JobState(str, Enum): - - canceled = "Canceled" #: The job was canceled. This is a final state for the job. - canceling = "Canceling" #: The job is in the process of being canceled. This is a transient state for the job. - error = "Error" #: The job has encountered an error. This is a final state for the job. - finished = "Finished" #: The job is finished. This is a final state for the job. - processing = "Processing" #: The job is processing. This is a transient state for the job. - queued = "Queued" #: The job is in a queued state, waiting for resources to become available. This is a transient state. - scheduled = "Scheduled" #: The job is being scheduled to run on an available resource. This is a transient state, between queued and processing states. - - -class TrackPropertyType(str, Enum): - - unknown = "Unknown" #: Unknown track property - four_cc = "FourCC" #: Track FourCC - - -class TrackPropertyCompareOperation(str, Enum): - - unknown = "Unknown" #: Unknown track property compare operation - equal = "Equal" #: Equal operation - - -class StreamingLocatorContentKeyType(str, Enum): - - common_encryption_cenc = "CommonEncryptionCenc" #: Common Encryption using CENC - common_encryption_cbcs = "CommonEncryptionCbcs" #: Common Encryption using CBCS - envelope_encryption = "EnvelopeEncryption" #: Envelope Encryption - - -class StreamingPolicyStreamingProtocol(str, Enum): - - hls = "Hls" #: HLS protocol - dash = "Dash" #: DASH protocol - smooth_streaming = "SmoothStreaming" #: SmoothStreaming protocol - download = "Download" #: Download protocol - - -class EncryptionScheme(str, Enum): - - no_encryption = "NoEncryption" #: NoEncryption scheme - envelope_encryption = "EnvelopeEncryption" #: EnvelopeEncryption scheme - common_encryption_cenc = "CommonEncryptionCenc" #: CommonEncryptionCenc scheme - common_encryption_cbcs = "CommonEncryptionCbcs" #: CommonEncryptionCbcs scheme - - -class LiveOutputResourceState(str, Enum): - - creating = "Creating" - running = "Running" - deleting = "Deleting" - - -class LiveEventInputProtocol(str, Enum): - - fragmented_mp4 = "FragmentedMP4" - rtmp = "RTMP" - - -class LiveEventEncodingType(str, Enum): - - none = "None" - basic = "Basic" - standard = "Standard" - premium1080p = "Premium1080p" - - -class LiveEventResourceState(str, Enum): - - stopped = "Stopped" - starting = "Starting" - running = "Running" - stopping = "Stopping" - deleting = "Deleting" - - -class StreamOptionsFlag(str, Enum): - - default = "Default" - low_latency = "LowLatency" - - -class StreamingEndpointResourceState(str, Enum): - - stopped = "Stopped" - starting = "Starting" - running = "Running" - stopping = "Stopping" - deleting = "Deleting" - scaling = "Scaling" + AUTO = "Auto" #: This is the default method. Chooses between Cfr and Vfr depending on muxer capabilities. For output format MP4, the default mode is Cfr. + PASSTHROUGH = "Passthrough" #: The presentation timestamps on frames are passed through from the input file to the output file writer. Recommended when the input source has variable frame rate, and are attempting to produce multiple layers for adaptive streaming in the output which have aligned GOP boundaries. Note: if two or more frames in the input have duplicate timestamps, then the output will also have the same behavior. + CFR = "Cfr" #: Input frames will be repeated and/or dropped as needed to achieve exactly the requested constant frame rate. Recommended when the output frame rate is explicitly set at a specified value. + VFR = "Vfr" #: Similar to the Passthrough mode, but if the input has frames that have duplicate timestamps, then only one frame is passed through to the output, and others are dropped. Recommended when 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. 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 index 7f9aeb3e0475..2c05b45f6b7a 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/models/_models.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/models/_models.py @@ -1,96 +1,98 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError +from azure.core.exceptions import HttpResponseError +import msrest.serialization -class Codec(Model): +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, CopyVideo, Video, CopyAudio + sub-classes are: Audio, CopyAudio, CopyVideo, Video. All required parameters must be populated in order to send to Azure. - :param label: An optional label for the codec. The label can be used to - control muxing behavior. + :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 odatatype: Required. Constant filled by server. - :type odatatype: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'label': {'key': 'label', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, } _subtype_map = { - 'odatatype': {'#Microsoft.Media.Audio': 'Audio', '#Microsoft.Media.CopyVideo': 'CopyVideo', '#Microsoft.Media.Video': 'Video', '#Microsoft.Media.CopyAudio': 'CopyAudio'} + 'odata_type': {'#Microsoft.Media.Audio': 'Audio', '#Microsoft.Media.CopyAudio': 'CopyAudio', '#Microsoft.Media.CopyVideo': 'CopyVideo', '#Microsoft.Media.Video': 'Video'} } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Codec, self).__init__(**kwargs) + self.odata_type = None # type: Optional[str] self.label = kwargs.get('label', None) - self.odatatype = 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 + sub-classes are: AacAudio. All required parameters must be populated in order to send to Azure. - :param label: An optional label for the codec. The label can be used to - control muxing behavior. + :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 odatatype: Required. Constant filled by server. - :type odatatype: 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. + :param bitrate: The bitrate, in bits per second, of the output encoded audio. :type bitrate: int """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'label': {'key': 'label', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, 'channels': {'key': 'channels', 'type': 'int'}, 'sampling_rate': {'key': 'samplingRate', 'type': 'int'}, 'bitrate': {'key': 'bitrate', 'type': 'int'}, } _subtype_map = { - 'odatatype': {'#Microsoft.Media.AacAudio': 'AacAudio'} + 'odata_type': {'#Microsoft.Media.AacAudio': 'AacAudio'} } - def __init__(self, **kwargs): + 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) - self.odatatype = '#Microsoft.Media.Audio' class AacAudio(Audio): @@ -98,147 +100,149 @@ class AacAudio(Audio): All required parameters must be populated in order to send to Azure. - :param label: An optional label for the codec. The label can be used to - control muxing behavior. + :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 odatatype: Required. Constant filled by server. - :type odatatype: 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. + :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' + :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 = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'label': {'key': 'label', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', '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): + def __init__( + self, + **kwargs + ): super(AacAudio, self).__init__(**kwargs) + self.odata_type = '#Microsoft.Media.AacAudio' # type: str self.profile = kwargs.get('profile', None) - self.odatatype = '#Microsoft.Media.AacAudio' -class ClipTime(Model): - """Base class for specifying a clip time. Use sub classes of this class to - specify the time position in the media. +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 + sub-classes are: AbsoluteClipTime, UtcClipTime. All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str + :param odata_type: Required. The discriminator for derived types.Constant filled by server. + :type odata_type: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, } _subtype_map = { - 'odatatype': {'#Microsoft.Media.AbsoluteClipTime': 'AbsoluteClipTime'} + 'odata_type': {'#Microsoft.Media.AbsoluteClipTime': 'AbsoluteClipTime', '#Microsoft.Media.UtcClipTime': 'UtcClipTime'} } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ClipTime, self).__init__(**kwargs) - self.odatatype = None + 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. + """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 odatatype: Required. Constant filled by server. - :type odatatype: 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: timedelta + :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 = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, 'time': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'time': {'key': 'time', 'type': 'duration'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AbsoluteClipTime, self).__init__(**kwargs) - self.time = kwargs.get('time', None) - self.odatatype = '#Microsoft.Media.AbsoluteClipTime' + self.odata_type = '#Microsoft.Media.AbsoluteClipTime' # type: str + self.time = kwargs['time'] -class Resource(Model): - """The core properties of ARM resources. +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. - :ivar id: Fully qualified resource ID for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str + :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 """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + 'type': {'required': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'key_vault_properties': {'key': 'keyVaultProperties', 'type': 'KeyVaultProperties'}, } - def __init__(self, **kwargs): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None + def __init__( + self, + **kwargs + ): + super(AccountEncryption, self).__init__(**kwargs) + self.type = kwargs['type'] + self.key_vault_properties = kwargs.get('key_vault_properties', None) -class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. +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. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. + :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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str """ @@ -254,25 +258,31 @@ class ProxyResource(Resource): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): - super(ProxyResource, self).__init__(**kwargs) + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None -class AccountFilter(ProxyResource): +class AccountFilter(Resource): """An Account Filter. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. + :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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param presentation_time_range: The presentation time range. - :type presentation_time_range: - ~azure.mgmt.media.models.PresentationTimeRange + :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. @@ -294,18 +304,44 @@ class AccountFilter(ProxyResource): 'tracks': {'key': 'properties.tracks', 'type': '[FilterTrackSelection]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AccountFilter, self).__init__(**kwargs) 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 AkamaiAccessControl(Model): +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 + :param akamai_signature_header_authentication_key_list: authentication key list. :type akamai_signature_header_authentication_key_list: list[~azure.mgmt.media.models.AkamaiSignatureHeaderAuthenticationKey] """ @@ -314,20 +350,23 @@ class AkamaiAccessControl(Model): 'akamai_signature_header_authentication_key_list': {'key': 'akamaiSignatureHeaderAuthenticationKeyList', 'type': '[AkamaiSignatureHeaderAuthenticationKey]'}, } - def __init__(self, **kwargs): + 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(Model): +class AkamaiSignatureHeaderAuthenticationKey(msrest.serialization.Model): """Akamai Signature Header authentication key. - :param identifier: identifier of the key + :param identifier: identifier of the key. :type identifier: str - :param base64_key: authentication key + :param base64_key: authentication key. :type base64_key: str :param expiration: The expiration time of the authentication key. - :type expiration: datetime + :type expiration: ~datetime.datetime """ _attribute_map = { @@ -336,17 +375,20 @@ class AkamaiSignatureHeaderAuthenticationKey(Model): 'expiration': {'key': 'expiration', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + 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 ApiError(Model): +class ApiError(msrest.serialization.Model): """The API error. - :param error: ApiError. The error properties. + :param error: The error properties. :type error: ~azure.mgmt.media.models.ODataError """ @@ -354,41 +396,33 @@ class ApiError(Model): 'error': {'key': 'error', 'type': 'ODataError'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ApiError, self).__init__(**kwargs) self.error = kwargs.get('error', None) -class ApiErrorException(HttpOperationError): - """Server responsed with exception of type: 'ApiError'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(ApiErrorException, self).__init__(deserialize, response, 'ApiError', *args) - - -class Asset(ProxyResource): +class Asset(Resource): """An Asset. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. + :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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar asset_id: The Asset ID. :vartype asset_id: str :ivar created: The creation date of the Asset. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar last_modified: The last modified date of the Asset. - :vartype last_modified: datetime + :vartype last_modified: ~datetime.datetime :param alternate_id: The alternate ID of the Asset. :type alternate_id: str :param description: The Asset description. @@ -397,9 +431,8 @@ class Asset(ProxyResource): :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' + :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 """ @@ -428,7 +461,10 @@ class Asset(ProxyResource): 'storage_encryption_format': {'key': 'properties.storageEncryptionFormat', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Asset, self).__init__(**kwargs) self.asset_id = None self.created = None @@ -440,7 +476,31 @@ def __init__(self, **kwargs): self.storage_encryption_format = None -class AssetContainerSas(Model): +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. @@ -451,12 +511,15 @@ class AssetContainerSas(Model): 'asset_container_sas_urls': {'key': 'assetContainerSasUrls', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AssetContainerSas, self).__init__(**kwargs) self.asset_container_sas_urls = kwargs.get('asset_container_sas_urls', None) -class AssetFileEncryptionMetadata(Model): +class AssetFileEncryptionMetadata(msrest.serialization.Model): """The Asset File Storage encryption metadata. All required parameters must be populated in order to send to Azure. @@ -479,28 +542,31 @@ class AssetFileEncryptionMetadata(Model): 'asset_file_id': {'key': 'assetFileId', 'type': 'str'}, } - def __init__(self, **kwargs): + 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.get('asset_file_id', None) + self.asset_file_id = kwargs['asset_file_id'] -class AssetFilter(ProxyResource): +class AssetFilter(Resource): """An Asset Filter. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. + :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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param presentation_time_range: The presentation time range. - :type presentation_time_range: - ~azure.mgmt.media.models.PresentationTimeRange + :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. @@ -522,36 +588,61 @@ class AssetFilter(ProxyResource): 'tracks': {'key': 'properties.tracks', 'type': '[FilterTrackSelection]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AssetFilter, self).__init__(**kwargs) 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 AssetStreamingLocator(Model): +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. + 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 + :vartype created: ~datetime.datetime :ivar start_time: The start time of the Streaming Locator. - :vartype start_time: datetime + :vartype start_time: ~datetime.datetime :ivar end_time: The end time of the Streaming Locator. - :vartype end_time: datetime + :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. + :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. + :ivar default_content_key_policy_name: Name of the default ContentKeyPolicy used by this + Streaming Locator. :vartype default_content_key_policy_name: str """ @@ -577,7 +668,10 @@ class AssetStreamingLocator(Model): 'default_content_key_policy_name': {'key': 'defaultContentKeyPolicyName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AssetStreamingLocator, self).__init__(**kwargs) self.name = None self.asset_name = None @@ -589,157 +683,165 @@ def __init__(self, **kwargs): self.default_content_key_policy_name = None -class Preset(Model): - """Base type for all Presets, which define the recipe or instructions on how - the input media files should be processed. +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: FaceDetectorPreset, AudioAnalyzerPreset, - BuiltInStandardEncoderPreset, StandardEncoderPreset + sub-classes are: AudioAnalyzerPreset, BuiltInStandardEncoderPreset, FaceDetectorPreset, StandardEncoderPreset. All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str + :param odata_type: Required. The discriminator for derived types.Constant filled by server. + :type odata_type: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, } _subtype_map = { - 'odatatype': {'#Microsoft.Media.FaceDetectorPreset': 'FaceDetectorPreset', '#Microsoft.Media.AudioAnalyzerPreset': 'AudioAnalyzerPreset', '#Microsoft.Media.BuiltInStandardEncoderPreset': 'BuiltInStandardEncoderPreset', '#Microsoft.Media.StandardEncoderPreset': 'StandardEncoderPreset'} + 'odata_type': {'#Microsoft.Media.AudioAnalyzerPreset': 'AudioAnalyzerPreset', '#Microsoft.Media.BuiltInStandardEncoderPreset': 'BuiltInStandardEncoderPreset', '#Microsoft.Media.FaceDetectorPreset': 'FaceDetectorPreset', '#Microsoft.Media.StandardEncoderPreset': 'StandardEncoderPreset'} } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Preset, self).__init__(**kwargs) - self.odatatype = None + 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. + """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 + sub-classes are: VideoAnalyzerPreset. All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: 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. - 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 + :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 experimental_options: Dictionary containing key value pairs for - parameters not exposed in the preset itself + :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 = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + '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 = { - 'odatatype': {'#Microsoft.Media.VideoAnalyzerPreset': 'VideoAnalyzerPreset'} + 'odata_type': {'#Microsoft.Media.VideoAnalyzerPreset': 'VideoAnalyzerPreset'} } - def __init__(self, **kwargs): + 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) - self.odatatype = '#Microsoft.Media.AudioAnalyzerPreset' -class Overlay(Model): +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 + sub-classes are: AudioOverlay, VideoOverlay. All required parameters must be populated in order to send to Azure. - :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 or PNG formats, 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. + :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 or PNG formats, 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 in to the input video. If - not specified the overlay starts from the beginning of the input video. - :type start: timedelta - :param end: The position in the input video at which the overlay ends. The - value should be in ISO 8601 duration format. For example, PT30S to end the - overlay at 30 seconds in to the input video. If not specified the overlay - will be applied until the end of the input video if inputLoop is true. - Else, if inputLoop is false, then overlay will last as long as the - duration of the overlay media. - :type end: 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: 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: 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. + :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 odatatype: Required. Constant filled by server. - :type odatatype: str """ _validation = { + 'odata_type': {'required': True}, 'input_label': {'required': True}, - 'odatatype': {'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'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, } _subtype_map = { - 'odatatype': {'#Microsoft.Media.AudioOverlay': 'AudioOverlay', '#Microsoft.Media.VideoOverlay': 'VideoOverlay'} + 'odata_type': {'#Microsoft.Media.AudioOverlay': 'AudioOverlay', '#Microsoft.Media.VideoOverlay': 'VideoOverlay'} } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Overlay, self).__init__(**kwargs) - self.input_label = kwargs.get('input_label', None) + 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) - self.odatatype = None class AudioOverlay(Overlay): @@ -747,105 +849,104 @@ class AudioOverlay(Overlay): All required parameters must be populated in order to send to Azure. - :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 or PNG formats, 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. + :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 or PNG formats, 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 in to the input video. If - not specified the overlay starts from the beginning of the input video. - :type start: timedelta - :param end: The position in the input video at which the overlay ends. The - value should be in ISO 8601 duration format. For example, PT30S to end the - overlay at 30 seconds in to the input video. If not specified the overlay - will be applied until the end of the input video if inputLoop is true. - Else, if inputLoop is false, then overlay will last as long as the - duration of the overlay media. - :type end: 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: 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: 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. + :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 odatatype: Required. Constant filled by server. - :type odatatype: str """ _validation = { + 'odata_type': {'required': True}, 'input_label': {'required': True}, - 'odatatype': {'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'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AudioOverlay, self).__init__(**kwargs) - self.odatatype = '#Microsoft.Media.AudioOverlay' + self.odata_type = '#Microsoft.Media.AudioOverlay' # type: str class BuiltInStandardEncoderPreset(Preset): - """Describes a built-in preset for encoding the input video with the Standard - Encoder. + """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 odatatype: Required. Constant filled by server. - :type odatatype: str - :param preset_name: Required. The built-in preset to be used for encoding - videos. Possible values include: 'H264SingleBitrateSD', - 'H264SingleBitrate720p', 'H264SingleBitrate1080p', 'AdaptiveStreaming', - 'AACGoodQualityAudio', 'ContentAwareEncodingExperimental', - 'ContentAwareEncoding', 'H264MultipleBitrate1080p', - 'H264MultipleBitrate720p', 'H264MultipleBitrateSD' + :param odata_type: Required. The discriminator for derived types.Constant filled by server. + :type odata_type: str + :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". :type preset_name: str or ~azure.mgmt.media.models.EncoderNamedPreset """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, 'preset_name': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'preset_name': {'key': 'presetName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(BuiltInStandardEncoderPreset, self).__init__(**kwargs) - self.preset_name = kwargs.get('preset_name', None) - self.odatatype = '#Microsoft.Media.BuiltInStandardEncoderPreset' + self.odata_type = '#Microsoft.Media.BuiltInStandardEncoderPreset' # type: str + self.preset_name = kwargs['preset_name'] -class CbcsDrmConfiguration(Model): - """Class to specify DRM configurations of CommonEncryptionCbcs scheme in - Streaming Policy. +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 + :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 = { @@ -854,23 +955,23 @@ class CbcsDrmConfiguration(Model): 'widevine': {'key': 'widevine', 'type': 'StreamingPolicyWidevineConfiguration'}, } - def __init__(self, **kwargs): + 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(Model): - """Class to specify DRM configurations of CommonEncryptionCenc scheme in - Streaming Policy. +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 + :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 = { @@ -878,19 +979,21 @@ class CencDrmConfiguration(Model): 'widevine': {'key': 'widevine', 'type': 'StreamingPolicyWidevineConfiguration'}, } - def __init__(self, **kwargs): + 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(Model): +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'. + :param type: The account type. For a Media Services account, this should be 'MediaServices'. :type type: str """ @@ -899,31 +1002,26 @@ class CheckNameAvailabilityInput(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CheckNameAvailabilityInput, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.type = kwargs.get('type', None) -class CloudError(Model): - """CloudError. - """ - - _attribute_map = { - } - - -class CommonEncryptionCbcs(Model): +class CommonEncryptionCbcs(msrest.serialization.Model): """Class for CommonEncryptionCbcs encryption scheme. - :param enabled_protocols: Representing supported protocols + :param enabled_protocols: Representing supported protocols. :type enabled_protocols: ~azure.mgmt.media.models.EnabledProtocols - :param clear_tracks: Representing which tracks should not be encrypted + :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 + :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 + :param drm: Configuration of DRMs for current encryption scheme. :type drm: ~azure.mgmt.media.models.CbcsDrmConfiguration """ @@ -934,7 +1032,10 @@ class CommonEncryptionCbcs(Model): 'drm': {'key': 'drm', 'type': 'CbcsDrmConfiguration'}, } - def __init__(self, **kwargs): + 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) @@ -942,18 +1043,17 @@ def __init__(self, **kwargs): self.drm = kwargs.get('drm', None) -class CommonEncryptionCenc(Model): +class CommonEncryptionCenc(msrest.serialization.Model): """Class for envelope encryption scheme. - :param enabled_protocols: Representing supported protocols + :param enabled_protocols: Representing supported protocols. :type enabled_protocols: ~azure.mgmt.media.models.EnabledProtocols - :param clear_tracks: Representing which tracks should not be encrypted + :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 + :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 + :param drm: Configuration of DRMs for CommonEncryptionCenc encryption scheme. :type drm: ~azure.mgmt.media.models.CencDrmConfiguration """ @@ -964,7 +1064,10 @@ class CommonEncryptionCenc(Model): 'drm': {'key': 'drm', 'type': 'CencDrmConfiguration'}, } - def __init__(self, **kwargs): + 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) @@ -972,29 +1075,28 @@ def __init__(self, **kwargs): self.drm = kwargs.get('drm', None) -class ContentKeyPolicy(ProxyResource): +class ContentKeyPolicy(Resource): """A Content Key Policy resource. - 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. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. + :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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar policy_id: The legacy Policy ID. :vartype policy_id: str - :ivar created: The creation date of the Policy - :vartype created: datetime - :ivar last_modified: The last modified date of the Policy - :vartype last_modified: datetime + :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. + :param options: The Key Policy options. :type options: list[~azure.mgmt.media.models.ContentKeyPolicyOption] """ @@ -1005,7 +1107,6 @@ class ContentKeyPolicy(ProxyResource): 'policy_id': {'readonly': True}, 'created': {'readonly': True}, 'last_modified': {'readonly': True}, - 'options': {'required': True}, } _attribute_map = { @@ -1019,7 +1120,10 @@ class ContentKeyPolicy(ProxyResource): 'options': {'key': 'properties.options', 'type': '[ContentKeyPolicyOption]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ContentKeyPolicy, self).__init__(**kwargs) self.policy_id = None self.created = None @@ -1028,38 +1132,36 @@ def __init__(self, **kwargs): self.options = kwargs.get('options', None) -class ContentKeyPolicyConfiguration(Model): - """Base class for Content Key Policy configuration. A derived class must be - used to create a configuration. +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, - ContentKeyPolicyUnknownConfiguration, - ContentKeyPolicyWidevineConfiguration, - ContentKeyPolicyPlayReadyConfiguration, - ContentKeyPolicyFairPlayConfiguration + sub-classes are: ContentKeyPolicyClearKeyConfiguration, ContentKeyPolicyFairPlayConfiguration, ContentKeyPolicyPlayReadyConfiguration, ContentKeyPolicyUnknownConfiguration, ContentKeyPolicyWidevineConfiguration. All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str + :param odata_type: Required. The discriminator for derived types.Constant filled by server. + :type odata_type: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, } _subtype_map = { - 'odatatype': {'#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration': 'ContentKeyPolicyClearKeyConfiguration', '#Microsoft.Media.ContentKeyPolicyUnknownConfiguration': 'ContentKeyPolicyUnknownConfiguration', '#Microsoft.Media.ContentKeyPolicyWidevineConfiguration': 'ContentKeyPolicyWidevineConfiguration', '#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration': 'ContentKeyPolicyPlayReadyConfiguration', '#Microsoft.Media.ContentKeyPolicyFairPlayConfiguration': 'ContentKeyPolicyFairPlayConfiguration'} + '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): + def __init__( + self, + **kwargs + ): super(ContentKeyPolicyConfiguration, self).__init__(**kwargs) - self.odatatype = None + self.odata_type = None # type: Optional[str] class ContentKeyPolicyClearKeyConfiguration(ContentKeyPolicyConfiguration): @@ -1067,21 +1169,48 @@ class ContentKeyPolicyClearKeyConfiguration(ContentKeyPolicyConfiguration): All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str + :param odata_type: Required. The discriminator for derived types.Constant filled by server. + :type odata_type: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ContentKeyPolicyClearKeyConfiguration, self).__init__(**kwargs) - self.odatatype = '#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration' + 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): @@ -1089,32 +1218,29 @@ class ContentKeyPolicyFairPlayConfiguration(ContentKeyPolicyConfiguration): All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str - :param ask: Required. The key that must be used as FairPlay Application - Secret key. + :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. + :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). + :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' + :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. + :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 + :param offline_rental_configuration: Offline rental policy. :type offline_rental_configuration: ~azure.mgmt.media.models.ContentKeyPolicyFairPlayOfflineRentalConfiguration """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, 'ask': {'required': True}, 'fair_play_pfx_password': {'required': True}, 'fair_play_pfx': {'required': True}, @@ -1123,7 +1249,7 @@ class ContentKeyPolicyFairPlayConfiguration(ContentKeyPolicyConfiguration): } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + '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'}, @@ -1132,25 +1258,28 @@ class ContentKeyPolicyFairPlayConfiguration(ContentKeyPolicyConfiguration): 'offline_rental_configuration': {'key': 'offlineRentalConfiguration', 'type': 'ContentKeyPolicyFairPlayOfflineRentalConfiguration'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ContentKeyPolicyFairPlayConfiguration, self).__init__(**kwargs) - self.ask = kwargs.get('ask', None) - self.fair_play_pfx_password = kwargs.get('fair_play_pfx_password', None) - self.fair_play_pfx = kwargs.get('fair_play_pfx', None) - self.rental_and_lease_key_type = kwargs.get('rental_and_lease_key_type', None) - self.rental_duration = kwargs.get('rental_duration', None) + 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) - self.odatatype = '#Microsoft.Media.ContentKeyPolicyFairPlayConfiguration' -class ContentKeyPolicyFairPlayOfflineRentalConfiguration(Model): +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 + :param playback_duration_seconds: Required. Playback duration. :type playback_duration_seconds: long - :param storage_duration_seconds: Required. Storage duration + :param storage_duration_seconds: Required. Storage duration. :type storage_duration_seconds: long """ @@ -1164,71 +1293,76 @@ class ContentKeyPolicyFairPlayOfflineRentalConfiguration(Model): 'storage_duration_seconds': {'key': 'storageDurationSeconds', 'type': 'long'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ContentKeyPolicyFairPlayOfflineRentalConfiguration, self).__init__(**kwargs) - self.playback_duration_seconds = kwargs.get('playback_duration_seconds', None) - self.storage_duration_seconds = kwargs.get('storage_duration_seconds', None) + self.playback_duration_seconds = kwargs['playback_duration_seconds'] + self.storage_duration_seconds = kwargs['storage_duration_seconds'] -class ContentKeyPolicyRestriction(Model): - """Base class for Content Key Policy restrictions. A derived class must be - used to create a restriction. +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, - ContentKeyPolicyUnknownRestriction, ContentKeyPolicyTokenRestriction + sub-classes are: ContentKeyPolicyOpenRestriction, ContentKeyPolicyTokenRestriction, ContentKeyPolicyUnknownRestriction. All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str + :param odata_type: Required. The discriminator for derived types.Constant filled by server. + :type odata_type: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, } _subtype_map = { - 'odatatype': {'#Microsoft.Media.ContentKeyPolicyOpenRestriction': 'ContentKeyPolicyOpenRestriction', '#Microsoft.Media.ContentKeyPolicyUnknownRestriction': 'ContentKeyPolicyUnknownRestriction', '#Microsoft.Media.ContentKeyPolicyTokenRestriction': 'ContentKeyPolicyTokenRestriction'} + 'odata_type': {'#Microsoft.Media.ContentKeyPolicyOpenRestriction': 'ContentKeyPolicyOpenRestriction', '#Microsoft.Media.ContentKeyPolicyTokenRestriction': 'ContentKeyPolicyTokenRestriction', '#Microsoft.Media.ContentKeyPolicyUnknownRestriction': 'ContentKeyPolicyUnknownRestriction'} } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ContentKeyPolicyRestriction, self).__init__(**kwargs) - self.odatatype = None + self.odata_type = None # type: Optional[str] class ContentKeyPolicyOpenRestriction(ContentKeyPolicyRestriction): - """Represents an open restriction. License or key will be delivered on every - request. + """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 odatatype: Required. Constant filled by server. - :type odatatype: str + :param odata_type: Required. The discriminator for derived types.Constant filled by server. + :type odata_type: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ContentKeyPolicyOpenRestriction, self).__init__(**kwargs) - self.odatatype = '#Microsoft.Media.ContentKeyPolicyOpenRestriction' + self.odata_type = '#Microsoft.Media.ContentKeyPolicyOpenRestriction' # type: str -class ContentKeyPolicyOption(Model): +class ContentKeyPolicyOption(msrest.serialization.Model): """Represents a policy option. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. @@ -1237,10 +1371,9 @@ class ContentKeyPolicyOption(Model): :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 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 """ @@ -1257,12 +1390,15 @@ class ContentKeyPolicyOption(Model): 'restriction': {'key': 'restriction', 'type': 'ContentKeyPolicyRestriction'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ContentKeyPolicyOption, self).__init__(**kwargs) self.policy_option_id = None self.name = kwargs.get('name', None) - self.configuration = kwargs.get('configuration', None) - self.restriction = kwargs.get('restriction', None) + self.configuration = kwargs['configuration'] + self.restriction = kwargs['restriction'] class ContentKeyPolicyPlayReadyConfiguration(ContentKeyPolicyConfiguration): @@ -1270,62 +1406,65 @@ class ContentKeyPolicyPlayReadyConfiguration(ContentKeyPolicyConfiguration): All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str + :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] + :type licenses: list[~azure.mgmt.media.models.ContentKeyPolicyPlayReadyLicense] :param response_custom_data: The custom response data. :type response_custom_data: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, 'licenses': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'licenses': {'key': 'licenses', 'type': '[ContentKeyPolicyPlayReadyLicense]'}, 'response_custom_data': {'key': 'responseCustomData', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ContentKeyPolicyPlayReadyConfiguration, self).__init__(**kwargs) - self.licenses = kwargs.get('licenses', None) + self.odata_type = '#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration' # type: str + self.licenses = kwargs['licenses'] self.response_custom_data = kwargs.get('response_custom_data', None) - self.odatatype = '#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration' -class ContentKeyPolicyPlayReadyContentKeyLocation(Model): - """Base class for content key ID location. A derived class must be used to - represent the location. +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 + sub-classes are: ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader, ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier. All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str + :param odata_type: Required. The discriminator for derived types.Constant filled by server. + :type odata_type: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, } _subtype_map = { - 'odatatype': {'#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader': 'ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader', '#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier': 'ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier'} + 'odata_type': {'#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader': 'ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader', '#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier': 'ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier'} } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ContentKeyPolicyPlayReadyContentKeyLocation, self).__init__(**kwargs) - self.odatatype = None + self.odata_type = None # type: Optional[str] class ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader(ContentKeyPolicyPlayReadyContentKeyLocation): @@ -1333,62 +1472,66 @@ class ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader(ContentKeyPolicyPl All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str + :param odata_type: Required. The discriminator for derived types.Constant filled by server. + :type odata_type: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader, self).__init__(**kwargs) - self.odatatype = '#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader' + self.odata_type = '#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader' # type: str class ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier(ContentKeyPolicyPlayReadyContentKeyLocation): - """Specifies that the content key ID is specified in the PlayReady - configuration. + """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 odatatype: Required. Constant filled by server. - :type odatatype: str + :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 = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, 'key_id': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'key_id': {'key': 'keyId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier, self).__init__(**kwargs) - self.key_id = kwargs.get('key_id', None) - self.odatatype = '#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier' + self.odata_type = '#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier' # type: str + self.key_id = kwargs['key_id'] -class ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction(Model): - """Configures the Explicit Analog Television Output Restriction control bits. - For further details see the PlayReady Compliance Rules. +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. + :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. + :param configuration_data: Required. Configures the restriction control bits. Must be between 0 + and 3 inclusive. :type configuration_data: int """ @@ -1402,45 +1545,44 @@ class ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction(Model): 'configuration_data': {'key': 'configurationData', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction, self).__init__(**kwargs) - self.best_effort = kwargs.get('best_effort', None) - self.configuration_data = kwargs.get('configuration_data', None) + self.best_effort = kwargs['best_effort'] + self.configuration_data = kwargs['configuration_data'] -class ContentKeyPolicyPlayReadyLicense(Model): +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. + :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 + :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 + :type expiration_date: ~datetime.datetime :param relative_begin_date: The relative begin date of license. - :type relative_begin_date: timedelta + :type relative_begin_date: ~datetime.timedelta :param relative_expiration_date: The relative expiration date of license. - :type relative_expiration_date: timedelta + :type relative_expiration_date: ~datetime.timedelta :param grace_period: The grace period of license. - :type grace_period: 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 + :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 + :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 = { @@ -1463,69 +1605,68 @@ class ContentKeyPolicyPlayReadyLicense(Model): 'content_type': {'key': 'contentType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ContentKeyPolicyPlayReadyLicense, self).__init__(**kwargs) - self.allow_test_devices = kwargs.get('allow_test_devices', None) + 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.get('license_type', None) - self.content_key_location = kwargs.get('content_key_location', None) - self.content_type = kwargs.get('content_type', None) + self.license_type = kwargs['license_type'] + self.content_key_location = kwargs['content_key_location'] + self.content_type = kwargs['content_type'] -class ContentKeyPolicyPlayReadyPlayRight(Model): +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: timedelta - :param scms_restriction: Configures the Serial Copy Management System - (SCMS) in the license. Must be between 0 and 3 inclusive. + :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. + :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. + :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. + :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. + :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. + :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' + :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. + :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. + :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. + :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. + :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. + :param uncompressed_digital_audio_opl: Specifies the output protection level for uncompressed + digital audio. :type uncompressed_digital_audio_opl: int """ @@ -1552,16 +1693,19 @@ class ContentKeyPolicyPlayReadyPlayRight(Model): 'uncompressed_digital_audio_opl': {'key': 'uncompressedDigitalAudioOpl', 'type': 'int'}, } - def __init__(self, **kwargs): + 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.get('digital_video_only_content_restriction', None) - self.image_constraint_for_analog_component_video_restriction = kwargs.get('image_constraint_for_analog_component_video_restriction', None) - self.image_constraint_for_analog_computer_monitor_restriction = kwargs.get('image_constraint_for_analog_computer_monitor_restriction', None) - self.allow_passing_video_content_to_unknown_output = kwargs.get('allow_passing_video_content_to_unknown_output', 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) @@ -1569,20 +1713,19 @@ def __init__(self, **kwargs): self.uncompressed_digital_audio_opl = kwargs.get('uncompressed_digital_audio_opl', None) -class ContentKeyPolicyProperties(Model): +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. + 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 - :ivar last_modified: The last modified date of the Policy - :vartype last_modified: datetime + :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. @@ -1604,44 +1747,48 @@ class ContentKeyPolicyProperties(Model): 'options': {'key': 'options', 'type': '[ContentKeyPolicyOption]'}, } - def __init__(self, **kwargs): + 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.get('options', None) + self.options = kwargs['options'] -class ContentKeyPolicyRestrictionTokenKey(Model): - """Base class for Content Key Policy key for token validation. A derived class - must be used to create a token key. +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: ContentKeyPolicySymmetricTokenKey, - ContentKeyPolicyRsaTokenKey, ContentKeyPolicyX509CertificateTokenKey + sub-classes are: ContentKeyPolicyRsaTokenKey, ContentKeyPolicySymmetricTokenKey, ContentKeyPolicyX509CertificateTokenKey. All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str + :param odata_type: Required. The discriminator for derived types.Constant filled by server. + :type odata_type: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, } _subtype_map = { - 'odatatype': {'#Microsoft.Media.ContentKeyPolicySymmetricTokenKey': 'ContentKeyPolicySymmetricTokenKey', '#Microsoft.Media.ContentKeyPolicyRsaTokenKey': 'ContentKeyPolicyRsaTokenKey', '#Microsoft.Media.ContentKeyPolicyX509CertificateTokenKey': 'ContentKeyPolicyX509CertificateTokenKey'} + 'odata_type': {'#Microsoft.Media.ContentKeyPolicyRsaTokenKey': 'ContentKeyPolicyRsaTokenKey', '#Microsoft.Media.ContentKeyPolicySymmetricTokenKey': 'ContentKeyPolicySymmetricTokenKey', '#Microsoft.Media.ContentKeyPolicyX509CertificateTokenKey': 'ContentKeyPolicyX509CertificateTokenKey'} } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ContentKeyPolicyRestrictionTokenKey, self).__init__(**kwargs) - self.odatatype = None + self.odata_type = None # type: Optional[str] class ContentKeyPolicyRsaTokenKey(ContentKeyPolicyRestrictionTokenKey): @@ -1649,31 +1796,34 @@ class ContentKeyPolicyRsaTokenKey(ContentKeyPolicyRestrictionTokenKey): All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str - :param exponent: Required. The RSA Parameter exponent + :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 + :param modulus: Required. The RSA Parameter modulus. :type modulus: bytearray """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, 'exponent': {'required': True}, 'modulus': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'exponent': {'key': 'exponent', 'type': 'bytearray'}, 'modulus': {'key': 'modulus', 'type': 'bytearray'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ContentKeyPolicyRsaTokenKey, self).__init__(**kwargs) - self.exponent = kwargs.get('exponent', None) - self.modulus = kwargs.get('modulus', None) - self.odatatype = '#Microsoft.Media.ContentKeyPolicyRsaTokenKey' + self.odata_type = '#Microsoft.Media.ContentKeyPolicyRsaTokenKey' # type: str + self.exponent = kwargs['exponent'] + self.modulus = kwargs['modulus'] class ContentKeyPolicySymmetricTokenKey(ContentKeyPolicyRestrictionTokenKey): @@ -1681,29 +1831,32 @@ class ContentKeyPolicySymmetricTokenKey(ContentKeyPolicyRestrictionTokenKey): All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str - :param key_value: Required. The key value of the key + :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 = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, 'key_value': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'key_value': {'key': 'keyValue', 'type': 'bytearray'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ContentKeyPolicySymmetricTokenKey, self).__init__(**kwargs) - self.key_value = kwargs.get('key_value', None) - self.odatatype = '#Microsoft.Media.ContentKeyPolicySymmetricTokenKey' + self.odata_type = '#Microsoft.Media.ContentKeyPolicySymmetricTokenKey' # type: str + self.key_value = kwargs['key_value'] -class ContentKeyPolicyTokenClaim(Model): +class ContentKeyPolicyTokenClaim(msrest.serialization.Model): """Represents a token claim. :param claim_type: Token claim type. @@ -1717,45 +1870,43 @@ class ContentKeyPolicyTokenClaim(Model): 'claim_value': {'key': 'claimValue', 'type': 'str'}, } - def __init__(self, **kwargs): + 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. + """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 odatatype: Required. Constant filled by server. - :type odatatype: str + :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 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 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. + :param open_id_connect_discovery_document: The OpenID connect discovery document. :type open_id_connect_discovery_document: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, 'issuer': {'required': True}, 'audience': {'required': True}, 'primary_verification_key': {'required': True}, @@ -1763,7 +1914,7 @@ class ContentKeyPolicyTokenRestriction(ContentKeyPolicyRestriction): } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'issuer': {'key': 'issuer', 'type': 'str'}, 'audience': {'key': 'audience', 'type': 'str'}, 'primary_verification_key': {'key': 'primaryVerificationKey', 'type': 'ContentKeyPolicyRestrictionTokenKey'}, @@ -1773,62 +1924,69 @@ class ContentKeyPolicyTokenRestriction(ContentKeyPolicyRestriction): 'open_id_connect_discovery_document': {'key': 'openIdConnectDiscoveryDocument', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ContentKeyPolicyTokenRestriction, self).__init__(**kwargs) - self.issuer = kwargs.get('issuer', None) - self.audience = kwargs.get('audience', None) - self.primary_verification_key = kwargs.get('primary_verification_key', None) + 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.get('restriction_token_type', None) + self.restriction_token_type = kwargs['restriction_token_type'] self.open_id_connect_discovery_document = kwargs.get('open_id_connect_discovery_document', None) - self.odatatype = '#Microsoft.Media.ContentKeyPolicyTokenRestriction' class ContentKeyPolicyUnknownConfiguration(ContentKeyPolicyConfiguration): - """Represents a ContentKeyPolicyConfiguration that is unavailable in the - current API version. + """Represents a ContentKeyPolicyConfiguration that is unavailable in the current API version. All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str + :param odata_type: Required. The discriminator for derived types.Constant filled by server. + :type odata_type: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ContentKeyPolicyUnknownConfiguration, self).__init__(**kwargs) - self.odatatype = '#Microsoft.Media.ContentKeyPolicyUnknownConfiguration' + self.odata_type = '#Microsoft.Media.ContentKeyPolicyUnknownConfiguration' # type: str class ContentKeyPolicyUnknownRestriction(ContentKeyPolicyRestriction): - """Represents a ContentKeyPolicyRestriction that is unavailable in the current - API version. + """Represents a ContentKeyPolicyRestriction that is unavailable in the current API version. All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str + :param odata_type: Required. The discriminator for derived types.Constant filled by server. + :type odata_type: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ContentKeyPolicyUnknownRestriction, self).__init__(**kwargs) - self.odatatype = '#Microsoft.Media.ContentKeyPolicyUnknownRestriction' + self.odata_type = '#Microsoft.Media.ContentKeyPolicyUnknownRestriction' # type: str class ContentKeyPolicyWidevineConfiguration(ContentKeyPolicyConfiguration): @@ -1836,26 +1994,29 @@ class ContentKeyPolicyWidevineConfiguration(ContentKeyPolicyConfiguration): All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str + :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 = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, 'widevine_template': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'widevine_template': {'key': 'widevineTemplate', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ContentKeyPolicyWidevineConfiguration, self).__init__(**kwargs) - self.widevine_template = kwargs.get('widevine_template', None) - self.odatatype = '#Microsoft.Media.ContentKeyPolicyWidevineConfiguration' + self.odata_type = '#Microsoft.Media.ContentKeyPolicyWidevineConfiguration' # type: str + self.widevine_template = kwargs['widevine_template'] class ContentKeyPolicyX509CertificateTokenKey(ContentKeyPolicyRestrictionTokenKey): @@ -1863,27 +2024,30 @@ class ContentKeyPolicyX509CertificateTokenKey(ContentKeyPolicyRestrictionTokenKe All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str - :param raw_body: Required. The raw data field of a certificate in PKCS 12 - format (X509Certificate2 in .NET) + :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 = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, 'raw_body': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'raw_body': {'key': 'rawBody', 'type': 'bytearray'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ContentKeyPolicyX509CertificateTokenKey, self).__init__(**kwargs) - self.raw_body = kwargs.get('raw_body', None) - self.odatatype = '#Microsoft.Media.ContentKeyPolicyX509CertificateTokenKey' + self.odata_type = '#Microsoft.Media.ContentKeyPolicyX509CertificateTokenKey' # type: str + self.raw_body = kwargs['raw_body'] class CopyAudio(Codec): @@ -1891,62 +2055,65 @@ class CopyAudio(Codec): All required parameters must be populated in order to send to Azure. - :param label: An optional label for the codec. The label can be used to - control muxing behavior. + :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 odatatype: Required. Constant filled by server. - :type odatatype: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'label': {'key': 'label', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CopyAudio, self).__init__(**kwargs) - self.odatatype = '#Microsoft.Media.CopyAudio' + 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. + """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 label: An optional label for the codec. The label can be used to - control muxing behavior. + :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 odatatype: Required. Constant filled by server. - :type odatatype: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'label': {'key': 'label', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CopyVideo, self).__init__(**kwargs) - self.odatatype = '#Microsoft.Media.CopyVideo' + self.odata_type = '#Microsoft.Media.CopyVideo' # type: str -class CrossSiteAccessPolicies(Model): +class CrossSiteAccessPolicies(msrest.serialization.Model): """The client access policy. - :param client_access_policy: The content of clientaccesspolicy.xml used by - Silverlight. + :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. + :param cross_domain_policy: The content of crossdomain.xml used by Silverlight. :type cross_domain_policy: str """ @@ -1955,20 +2122,21 @@ class CrossSiteAccessPolicies(Model): 'cross_domain_policy': {'key': 'crossDomainPolicy', 'type': 'str'}, } - def __init__(self, **kwargs): + 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(Model): - """Class to specify properties of default content key for each encryption - scheme. +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 + :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 + :param policy_name: Policy used by Default Key. :type policy_name: str """ @@ -1977,20 +2145,23 @@ class DefaultKey(Model): 'policy_name': {'key': 'policyName', 'type': 'str'}, } - def __init__(self, **kwargs): + 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(Model): +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' + :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' + :param mode: The deinterlacing mode. Defaults to AutoPixelAdaptive. Possible values include: + "Off", "AutoPixelAdaptive". :type mode: str or ~azure.mgmt.media.models.DeinterlaceMode """ @@ -1999,44 +2170,47 @@ class Deinterlace(Model): 'mode': {'key': 'mode', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Deinterlace, self).__init__(**kwargs) self.parity = kwargs.get('parity', None) self.mode = kwargs.get('mode', None) -class EdgePolicies(Model): +class EdgePolicies(msrest.serialization.Model): """EdgePolicies. :param usage_data_collection_policy: - :type usage_data_collection_policy: - ~azure.mgmt.media.models.EdgeUsageDataCollectionPolicy + :type usage_data_collection_policy: ~azure.mgmt.media.models.EdgeUsageDataCollectionPolicy """ _attribute_map = { 'usage_data_collection_policy': {'key': 'usageDataCollectionPolicy', 'type': 'EdgeUsageDataCollectionPolicy'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(EdgePolicies, self).__init__(**kwargs) self.usage_data_collection_policy = kwargs.get('usage_data_collection_policy', None) -class EdgeUsageDataCollectionPolicy(Model): +class EdgeUsageDataCollectionPolicy(msrest.serialization.Model): """EdgeUsageDataCollectionPolicy. - :param data_collection_frequency: Usage data collection frequency in ISO - 8601 duration format e.g. PT10M , PT5H. + :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. + :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. + :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. + :param event_hub_details: Details of Event Hub where the usage will be reported. :type event_hub_details: ~azure.mgmt.media.models.EdgeUsageDataEventHub """ @@ -2047,7 +2221,10 @@ class EdgeUsageDataCollectionPolicy(Model): 'event_hub_details': {'key': 'eventHubDetails', 'type': 'EdgeUsageDataEventHub'}, } - def __init__(self, **kwargs): + 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) @@ -2055,7 +2232,7 @@ def __init__(self, **kwargs): self.event_hub_details = kwargs.get('event_hub_details', None) -class EdgeUsageDataEventHub(Model): +class EdgeUsageDataEventHub(msrest.serialization.Model): """EdgeUsageDataEventHub. :param name: Name of the Event Hub where usage will be reported. @@ -2072,25 +2249,28 @@ class EdgeUsageDataEventHub(Model): 'token': {'key': 'token', 'type': 'str'}, } - def __init__(self, **kwargs): + 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(Model): +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 + :param download: Required. Enable Download protocol or not. :type download: bool - :param dash: Required. Enable DASH protocol or not + :param dash: Required. Enable DASH protocol or not. :type dash: bool - :param hls: Required. Enable HLS protocol or not + :param hls: Required. Enable HLS protocol or not. :type hls: bool - :param smooth_streaming: Required. Enable SmoothStreaming protocol or not + :param smooth_streaming: Required. Enable SmoothStreaming protocol or not. :type smooth_streaming: bool """ @@ -2108,15 +2288,18 @@ class EnabledProtocols(Model): 'smooth_streaming': {'key': 'smoothStreaming', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(EnabledProtocols, self).__init__(**kwargs) - self.download = kwargs.get('download', None) - self.dash = kwargs.get('dash', None) - self.hls = kwargs.get('hls', None) - self.smooth_streaming = kwargs.get('smooth_streaming', None) + self.download = kwargs['download'] + self.dash = kwargs['dash'] + self.hls = kwargs['hls'] + self.smooth_streaming = kwargs['smooth_streaming'] -class EntityNameAvailabilityCheckOutput(Model): +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. @@ -2125,8 +2308,7 @@ class EntityNameAvailabilityCheckOutput(Model): :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. + :param message: Specifies the detailed reason if the name is not available. :type message: str """ @@ -2140,31 +2322,33 @@ class EntityNameAvailabilityCheckOutput(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(EntityNameAvailabilityCheckOutput, self).__init__(**kwargs) - self.name_available = kwargs.get('name_available', None) + self.name_available = kwargs['name_available'] self.reason = kwargs.get('reason', None) self.message = kwargs.get('message', None) -class EnvelopeEncryption(Model): +class EnvelopeEncryption(msrest.serialization.Model): """Class for EnvelopeEncryption encryption scheme. - :param enabled_protocols: Representing supported protocols + :param enabled_protocols: Representing supported protocols. :type enabled_protocols: ~azure.mgmt.media.models.EnabledProtocols - :param clear_tracks: Representing which tracks should not be encrypted + :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 + :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 + :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. + StreamingLocatorId.AlternativeMediaId, and {ContentKeyId}, which is replaced with the value of + identifier of the key being requested. :type custom_key_acquisition_url_template: str """ @@ -2175,7 +2359,10 @@ class EnvelopeEncryption(Model): 'custom_key_acquisition_url_template': {'key': 'customKeyAcquisitionUrlTemplate', 'type': 'str'}, } - def __init__(self, **kwargs): + 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) @@ -2184,64 +2371,61 @@ def __init__(self, **kwargs): class FaceDetectorPreset(Preset): - """Describes all the settings to be used when analyzing a video in order to - detect all the faces present. + """Describes all the settings to be used when analyzing a video in order to detect all the faces present. All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: 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' + :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 experimental_options: Dictionary containing key value pairs for - parameters not exposed in the preset itself + :param experimental_options: Dictionary containing key value pairs for parameters not exposed + in the preset itself. :type experimental_options: dict[str, str] """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'resolution': {'key': 'resolution', 'type': 'str'}, 'experimental_options': {'key': 'experimentalOptions', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(FaceDetectorPreset, self).__init__(**kwargs) + self.odata_type = '#Microsoft.Media.FaceDetectorPreset' # type: str self.resolution = kwargs.get('resolution', None) self.experimental_options = kwargs.get('experimental_options', None) - self.odatatype = '#Microsoft.Media.FaceDetectorPreset' -class Filters(Model): - """Describes all the filtering operations, such as de-interlacing, rotation - etc. that are to be applied to the input media before encoding. +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' + :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. + :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. + :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] """ @@ -2252,7 +2436,10 @@ class Filters(Model): 'overlays': {'key': 'overlays', 'type': '[Overlay]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Filters, self).__init__(**kwargs) self.deinterlace = kwargs.get('deinterlace', None) self.rotation = kwargs.get('rotation', None) @@ -2260,20 +2447,19 @@ def __init__(self, **kwargs): self.overlays = kwargs.get('overlays', None) -class FilterTrackPropertyCondition(Model): +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' + :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 + :param operation: Required. The track property condition operation. Possible values include: + "Equal", "NotEqual". + :type operation: str or ~azure.mgmt.media.models.FilterTrackPropertyCompareOperation """ _validation = { @@ -2288,22 +2474,23 @@ class FilterTrackPropertyCondition(Model): 'operation': {'key': 'operation', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(FilterTrackPropertyCondition, self).__init__(**kwargs) - self.property = kwargs.get('property', None) - self.value = kwargs.get('value', None) - self.operation = kwargs.get('operation', None) + self.property = kwargs['property'] + self.value = kwargs['value'] + self.operation = kwargs['operation'] -class FilterTrackSelection(Model): - """Representing a list of FilterTrackPropertyConditions to select a track. - The filters are combined using a logical AND 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] + :type track_selections: list[~azure.mgmt.media.models.FilterTrackPropertyCondition] """ _validation = { @@ -2314,12 +2501,15 @@ class FilterTrackSelection(Model): 'track_selections': {'key': 'trackSelections', 'type': '[FilterTrackPropertyCondition]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(FilterTrackSelection, self).__init__(**kwargs) - self.track_selections = kwargs.get('track_selections', None) + self.track_selections = kwargs['track_selections'] -class FirstQuality(Model): +class FirstQuality(msrest.serialization.Model): """Filter First Quality. All required parameters must be populated in order to send to Azure. @@ -2336,273 +2526,266 @@ class FirstQuality(Model): 'bitrate': {'key': 'bitrate', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(FirstQuality, self).__init__(**kwargs) - self.bitrate = kwargs.get('bitrate', None) + self.bitrate = kwargs['bitrate'] -class Format(Model): +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 + sub-classes are: ImageFormat, JpgFormat, MultiBitrateFormat, PngFormat. All required parameters must be populated in order to send to Azure. - :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} - The base name of the input video {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. Any unsubstituted - macros will be collapsed and removed from the filename. + :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. Any + unsubstituted macros will be collapsed and removed from the filename. :type filename_pattern: str - :param odatatype: Required. Constant filled by server. - :type odatatype: str """ _validation = { + 'odata_type': {'required': True}, 'filename_pattern': {'required': True}, - 'odatatype': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'filename_pattern': {'key': 'filenamePattern', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, } _subtype_map = { - 'odatatype': {'#Microsoft.Media.ImageFormat': 'ImageFormat', '#Microsoft.Media.MultiBitrateFormat': 'MultiBitrateFormat'} + 'odata_type': {'#Microsoft.Media.ImageFormat': 'ImageFormat', '#Microsoft.Media.JpgFormat': 'JpgFormat', '#Microsoft.Media.MultiBitrateFormat': 'MultiBitrateFormat', '#Microsoft.Media.PngFormat': 'PngFormat'} } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Format, self).__init__(**kwargs) - self.filename_pattern = kwargs.get('filename_pattern', None) - self.odatatype = None + self.odata_type = None # type: Optional[str] + self.filename_pattern = kwargs['filename_pattern'] -class Layer(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. +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: VideoLayer, JpgLayer, PngLayer + sub-classes are: JpgLayer, PngLayer, VideoLayer. All required parameters must be populated in order to send to Azure. - :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. + :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. + :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. + :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 odatatype: Required. Constant filled by server. - :type odatatype: str """ _validation = { - 'odatatype': {'required': True}, + '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'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, } _subtype_map = { - 'odatatype': {'#Microsoft.Media.VideoLayer': 'VideoLayer', '#Microsoft.Media.JpgLayer': 'JpgLayer', '#Microsoft.Media.PngLayer': 'PngLayer'} + 'odata_type': {'#Microsoft.Media.JpgLayer': 'JpgLayer', '#Microsoft.Media.PngLayer': 'PngLayer', '#Microsoft.Media.VideoLayer': 'VideoLayer'} } - def __init__(self, **kwargs): + 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) - self.odatatype = None class VideoLayer(Layer): - """Describes the settings to be used when encoding the input video into a - desired output bitrate 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 + sub-classes are: H264Layer. All required parameters must be populated in order to send to Azure. - :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. + :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. + :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. + :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 odatatype: Required. Constant filled by server. - :type odatatype: 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. + :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. + :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. + :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. + :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. + :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_bframe: 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_bframe: bool + :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 = { - 'odatatype': {'required': True}, + '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'}, - 'odatatype': {'key': '@odata\\.type', '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_bframe': {'key': 'adaptiveBFrame', 'type': 'bool'}, + 'adaptive_b_frame': {'key': 'adaptiveBFrame', 'type': 'bool'}, } _subtype_map = { - 'odatatype': {'#Microsoft.Media.H264Layer': 'H264Layer'} + 'odata_type': {'#Microsoft.Media.H264Layer': 'H264Layer'} } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VideoLayer, self).__init__(**kwargs) - self.bitrate = kwargs.get('bitrate', None) + 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_bframe = kwargs.get('adaptive_bframe', None) - self.odatatype = '#Microsoft.Media.VideoLayer' + 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. + """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 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. + :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. + :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. + :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 odatatype: Required. Constant filled by server. - :type odatatype: 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. + :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. + :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. + :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. + :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. + :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_bframe: 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_bframe: bool - :param profile: We currently support Baseline, Main, High, High422, - High444. Default is Auto. Possible values include: 'Auto', 'Baseline', - 'Main', 'High', 'High422', 'High444' + :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. + :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: 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. + :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' + :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 = { - 'odatatype': {'required': True}, + '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'}, - 'odatatype': {'key': '@odata\\.type', '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_bframe': {'key': 'adaptiveBFrame', 'type': 'bool'}, + 'adaptive_b_frame': {'key': 'adaptiveBFrame', 'type': 'bool'}, 'profile': {'key': 'profile', 'type': 'str'}, 'level': {'key': 'level', 'type': 'str'}, 'buffer_window': {'key': 'bufferWindow', 'type': 'duration'}, @@ -2610,60 +2793,71 @@ class H264Layer(VideoLayer): 'entropy_mode': {'key': 'entropyMode', 'type': 'str'}, } - def __init__(self, **kwargs): + 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) - self.odatatype = '#Microsoft.Media.H264Layer' 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: Image, H264Video + sub-classes are: H264Video, Image. All required parameters must be populated in order to send to Azure. - :param label: An optional label for the codec. The label can be used to - control muxing behavior. + :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 odatatype: Required. Constant filled by server. - :type odatatype: str - :param key_frame_interval: The distance between two key frames, thereby - defining a group of pictures (GOP). The value should be a non-zero integer - in the range [1, 30] seconds, specified in ISO 8601 format. The default is - 2 seconds (PT2S). - :type key_frame_interval: 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' + :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 = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'label': {'key': 'label', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, 'key_frame_interval': {'key': 'keyFrameInterval', 'type': 'duration'}, 'stretch_mode': {'key': 'stretchMode', 'type': 'str'}, + 'sync_mode': {'key': 'syncMode', 'type': 'str'}, } _subtype_map = { - 'odatatype': {'#Microsoft.Media.Image': 'Image', '#Microsoft.Media.H264Video': 'H264Video'} + 'odata_type': {'#Microsoft.Media.H264Video': 'H264Video', '#Microsoft.Media.Image': 'Image'} } - def __init__(self, **kwargs): + 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.odatatype = '#Microsoft.Media.Video' + self.sync_mode = kwargs.get('sync_mode', None) class H264Video(Video): @@ -2671,61 +2865,66 @@ class H264Video(Video): All required parameters must be populated in order to send to Azure. - :param label: An optional label for the codec. The label can be used to - control muxing behavior. + :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 odatatype: Required. Constant filled by server. - :type odatatype: str - :param key_frame_interval: The distance between two key frames, thereby - defining a group of pictures (GOP). The value should be a non-zero integer - in the range [1, 30] seconds, specified in ISO 8601 format. The default is - 2 seconds (PT2S). - :type key_frame_interval: 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' + :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 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. + :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' + :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. + :param layers: The collection of output H.264 layers to be produced by the encoder. :type layers: list[~azure.mgmt.media.models.H264Layer] """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'label': {'key': 'label', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', '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): + 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) - self.odatatype = '#Microsoft.Media.H264Video' -class Hls(Model): - """The HLS configuration. +class Hls(msrest.serialization.Model): + """HTTP Live Streaming (HLS) packing setting for the live output. - :param fragments_per_ts_segment: The amount of fragments per HTTP Live - Streaming (HLS) segment. + :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 """ @@ -2733,121 +2932,138 @@ class Hls(Model): 'fragments_per_ts_segment': {'key': 'fragmentsPerTsSegment', 'type': 'int'}, } - def __init__(self, **kwargs): + 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. + """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 + sub-classes are: JpgImage, PngImage. All required parameters must be populated in order to send to Azure. - :param label: An optional label for the codec. The label can be used to - control muxing behavior. + :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 odatatype: Required. Constant filled by server. - :type odatatype: str - :param key_frame_interval: The distance between two key frames, thereby - defining a group of pictures (GOP). The value should be a non-zero integer - in the range [1, 30] seconds, specified in ISO 8601 format. The default is - 2 seconds (PT2S). - :type key_frame_interval: 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' + :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 start: Required. The position in the input video from where to - start generating thumbnails. The value can be in absolute timestamp (ISO - 8601, e.g: PT05S), or a frame count (For example, 10 for the 10th frame), - or a relative value (For example, 1%). Also supports a macro {Best}, which - tells the encoder to select the best thumbnail from the first few seconds - of the video. + :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 absolute timestamp (ISO 8601, e.g: PT05S for one image every 5 - seconds), or a frame count (For example, 30 for every 30 frames), or a - relative value (For example, 1%). + :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 in the input video at which to stop generating - thumbnails. The value can be in absolute timestamp (ISO 8601, e.g: PT5M30S - to stop at 5 minutes and 30 seconds), or a frame count (For example, 300 - to stop at the 300th frame), or a relative value (For example, 100%). + :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 = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, 'start': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'label': {'key': 'label', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', '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 = { - 'odatatype': {'#Microsoft.Media.JpgImage': 'JpgImage', '#Microsoft.Media.PngImage': 'PngImage'} + 'odata_type': {'#Microsoft.Media.JpgImage': 'JpgImage', '#Microsoft.Media.PngImage': 'PngImage'} } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Image, self).__init__(**kwargs) - self.start = kwargs.get('start', None) + self.odata_type = '#Microsoft.Media.Image' # type: str + self.start = kwargs['start'] self.step = kwargs.get('step', None) self.range = kwargs.get('range', None) - self.odatatype = '#Microsoft.Media.Image' 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 filename_pattern: Required. The pattern of the file names for the - generated output files. The following macros are supported in the file - name: {Basename} - The base name of the input video {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. Any unsubstituted - macros will be collapsed and removed from the filename. + :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. Any + unsubstituted macros will be collapsed and removed from the filename. :type filename_pattern: str - :param odatatype: Required. Constant filled by server. - :type odatatype: str """ _validation = { + 'odata_type': {'required': True}, 'filename_pattern': {'required': True}, - 'odatatype': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'filename_pattern': {'key': 'filenamePattern', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, - } - - _subtype_map = { - 'odatatype': {'#Microsoft.Media.JpgFormat': 'JpgFormat', '#Microsoft.Media.PngFormat': 'PngFormat'} } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ImageFormat, self).__init__(**kwargs) - self.odatatype = '#Microsoft.Media.ImageFormat' + self.odata_type = '#Microsoft.Media.ImageFormat' # type: str -class IPAccessControl(Model): +class IPAccessControl(msrest.serialization.Model): """The IP access control. :param allow: The IP allow list. @@ -2858,20 +3074,22 @@ class IPAccessControl(Model): 'allow': {'key': 'allow', 'type': '[IPRange]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(IPAccessControl, self).__init__(**kwargs) self.allow = kwargs.get('allow', None) -class IPRange(Model): +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). + :param subnet_prefix_length: The subnet mask prefix length (see CIDR notation). :type subnet_prefix_length: int """ @@ -2881,57 +3099,55 @@ class IPRange(Model): 'subnet_prefix_length': {'key': 'subnetPrefixLength', 'type': 'int'}, } - def __init__(self, **kwargs): + 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. +class Job(Resource): + """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. - - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. + :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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar created: The UTC date and time when the Job was created, in - 'YYYY-MM-DDThh:mm:ssZ' format. - :vartype created: datetime - :ivar state: The current state of the job. Possible values include: - 'Canceled', 'Canceling', 'Error', 'Finished', 'Processing', 'Queued', - 'Scheduled' + :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: Required. The inputs for the Job. + :param input: The inputs for the Job. :type input: ~azure.mgmt.media.models.JobInput - :ivar last_modified: The UTC date and time when the Job was last updated, - in 'YYYY-MM-DDThh:mm:ssZ' format. - :vartype last_modified: datetime - :param outputs: Required. The outputs for the Job. + :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' + :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. + :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 - :ivar end_time: The UTC date and time at which this Job finished - processing. - :vartype end_time: datetime + :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 = { @@ -2940,9 +3156,7 @@ class Job(ProxyResource): 'type': {'readonly': True}, 'created': {'readonly': True}, 'state': {'readonly': True}, - 'input': {'required': True}, 'last_modified': {'readonly': True}, - 'outputs': {'required': True}, 'start_time': {'readonly': True}, 'end_time': {'readonly': True}, } @@ -2963,7 +3177,10 @@ class Job(ProxyResource): 'end_time': {'key': 'properties.endTime', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Job, self).__init__(**kwargs) self.created = None self.state = None @@ -2977,29 +3194,50 @@ def __init__(self, **kwargs): self.end_time = None -class JobError(Model): +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. + 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' + :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. + :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' + :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' + :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. + :ivar details: An array of details about specific errors that led to this reported error. :vartype details: list[~azure.mgmt.media.models.JobErrorDetail] """ @@ -3019,7 +3257,10 @@ class JobError(Model): 'details': {'key': 'details', 'type': '[JobErrorDetail]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(JobError, self).__init__(**kwargs) self.code = None self.message = None @@ -3028,11 +3269,10 @@ def __init__(self, **kwargs): self.details = None -class JobErrorDetail(Model): +class JobErrorDetail(msrest.serialization.Model): """Details of JobOutput errors. - Variables are only populated by the server, and will be ignored when - sending a request. + 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 @@ -3050,75 +3290,79 @@ class JobErrorDetail(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(JobErrorDetail, self).__init__(**kwargs) self.code = None self.message = None -class JobInput(Model): +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, JobInputs + sub-classes are: JobInputClip, JobInputs. All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str + :param odata_type: Required. The discriminator for derived types.Constant filled by server. + :type odata_type: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, } _subtype_map = { - 'odatatype': {'#Microsoft.Media.JobInputClip': 'JobInputClip', '#Microsoft.Media.JobInputs': 'JobInputs'} + 'odata_type': {'#Microsoft.Media.JobInputClip': 'JobInputClip', '#Microsoft.Media.JobInputs': 'JobInputs'} } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(JobInput, self).__init__(**kwargs) - self.odatatype = None + 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 + sub-classes are: JobInputAsset, JobInputHttp. All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str - :param files: List of files. Required for JobInputHttp. Maximum of 4000 - characters each. + :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. :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. + :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. + :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'. + :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 """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'files': {'key': 'files', 'type': '[str]'}, 'start': {'key': 'start', 'type': 'ClipTime'}, 'end': {'key': 'end', 'type': 'ClipTime'}, @@ -3126,16 +3370,19 @@ class JobInputClip(JobInput): } _subtype_map = { - 'odatatype': {'#Microsoft.Media.JobInputAsset': 'JobInputAsset', '#Microsoft.Media.JobInputHttp': 'JobInputHttp'} + 'odata_type': {'#Microsoft.Media.JobInputAsset': 'JobInputAsset', '#Microsoft.Media.JobInputHttp': 'JobInputHttp'} } - def __init__(self, **kwargs): + 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.odatatype = '#Microsoft.Media.JobInputClip' class JobInputAsset(JobInputClip): @@ -3143,35 +3390,33 @@ class JobInputAsset(JobInputClip): All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str - :param files: List of files. Required for JobInputHttp. Maximum of 4000 - characters each. + :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. :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. + :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. + :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'. + :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 asset_name: Required. The name of the input Asset. :type asset_name: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, 'asset_name': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'files': {'key': 'files', 'type': '[str]'}, 'start': {'key': 'start', 'type': 'ClipTime'}, 'end': {'key': 'end', 'type': 'ClipTime'}, @@ -3179,10 +3424,13 @@ class JobInputAsset(JobInputClip): 'asset_name': {'key': 'assetName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(JobInputAsset, self).__init__(**kwargs) - self.asset_name = kwargs.get('asset_name', None) - self.odatatype = '#Microsoft.Media.JobInputAsset' + self.odata_type = '#Microsoft.Media.JobInputAsset' # type: str + self.asset_name = kwargs['asset_name'] class JobInputHttp(JobInputClip): @@ -3190,37 +3438,34 @@ class JobInputHttp(JobInputClip): All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str - :param files: List of files. Required for JobInputHttp. Maximum of 4000 - characters each. + :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. :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. + :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. + :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'. + :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 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. + :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. :type base_uri: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'files': {'key': 'files', 'type': '[str]'}, 'start': {'key': 'start', 'type': 'ClipTime'}, 'end': {'key': 'end', 'type': 'ClipTime'}, @@ -3228,10 +3473,13 @@ class JobInputHttp(JobInputClip): 'base_uri': {'key': 'baseUri', 'type': 'str'}, } - def __init__(self, **kwargs): + 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) - self.odatatype = '#Microsoft.Media.JobInputHttp' class JobInputs(JobInput): @@ -3239,274 +3487,295 @@ class JobInputs(JobInput): All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str + :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 = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'inputs': {'key': 'inputs', 'type': '[JobInput]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(JobInputs, self).__init__(**kwargs) + self.odata_type = '#Microsoft.Media.JobInputs' # type: str self.inputs = kwargs.get('inputs', None) - self.odatatype = '#Microsoft.Media.JobInputs' -class JobOutput(Model): +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 + sub-classes are: JobOutputAsset. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar error: If the JobOutput is in the Error state, it contains the - details of the error. + :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 - :ivar state: Describes the state of the JobOutput. Possible values - include: 'Canceled', 'Canceling', 'Error', 'Finished', 'Processing', - 'Queued', 'Scheduled' + :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. + :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. + :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 - :ivar end_time: The UTC date and time at which this Job Output finished - processing. - :vartype end_time: datetime - :param odatatype: Required. Constant filled by server. - :type odatatype: 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}, - 'odatatype': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'error': {'key': 'error', 'type': 'JobError'}, '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'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, } _subtype_map = { - 'odatatype': {'#Microsoft.Media.JobOutputAsset': 'JobOutputAsset'} + 'odata_type': {'#Microsoft.Media.JobOutputAsset': 'JobOutputAsset'} } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(JobOutput, self).__init__(**kwargs) + self.odata_type = None # type: Optional[str] self.error = None self.state = None self.progress = None self.label = kwargs.get('label', None) self.start_time = None self.end_time = None - self.odatatype = 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. + 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 error: If the JobOutput is in the Error state, it contains the - details of the error. + :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 - :ivar state: Describes the state of the JobOutput. Possible values - include: 'Canceled', 'Canceling', 'Error', 'Finished', 'Processing', - 'Queued', 'Scheduled' + :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. + :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. + :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 - :ivar end_time: The UTC date and time at which this Job Output finished - processing. - :vartype end_time: datetime - :param odatatype: Required. Constant filled by server. - :type odatatype: 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}, - 'odatatype': {'required': True}, 'asset_name': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'error': {'key': 'error', 'type': 'JobError'}, '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'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, 'asset_name': {'key': 'assetName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(JobOutputAsset, self).__init__(**kwargs) - self.asset_name = kwargs.get('asset_name', None) - self.odatatype = '#Microsoft.Media.JobOutputAsset' + self.odata_type = '#Microsoft.Media.JobOutputAsset' # type: str + self.asset_name = kwargs['asset_name'] -class JpgFormat(ImageFormat): +class JpgFormat(Format): """Describes the settings for producing JPEG thumbnails. All required parameters must be populated in order to send to Azure. - :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} - The base name of the input video {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. Any unsubstituted - macros will be collapsed and removed from the filename. + :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. Any + unsubstituted macros will be collapsed and removed from the filename. :type filename_pattern: str - :param odatatype: Required. Constant filled by server. - :type odatatype: str """ _validation = { + 'odata_type': {'required': True}, 'filename_pattern': {'required': True}, - 'odatatype': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'filename_pattern': {'key': 'filenamePattern', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(JpgFormat, self).__init__(**kwargs) - self.odatatype = '#Microsoft.Media.JpgFormat' + 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. + """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 label: An optional label for the codec. The label can be used to - control muxing behavior. + :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 odatatype: Required. Constant filled by server. - :type odatatype: str - :param key_frame_interval: The distance between two key frames, thereby - defining a group of pictures (GOP). The value should be a non-zero integer - in the range [1, 30] seconds, specified in ISO 8601 format. The default is - 2 seconds (PT2S). - :type key_frame_interval: 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' + :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 start: Required. The position in the input video from where to - start generating thumbnails. The value can be in absolute timestamp (ISO - 8601, e.g: PT05S), or a frame count (For example, 10 for the 10th frame), - or a relative value (For example, 1%). Also supports a macro {Best}, which - tells the encoder to select the best thumbnail from the first few seconds - of the video. + :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 absolute timestamp (ISO 8601, e.g: PT05S for one image every 5 - seconds), or a frame count (For example, 30 for every 30 frames), or a - relative value (For example, 1%). + :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 in the input video at which to stop generating - thumbnails. The value can be in absolute timestamp (ISO 8601, e.g: PT5M30S - to stop at 5 minutes and 30 seconds), or a frame count (For example, 300 - to stop at the 300th frame), or a relative value (For example, 100%). + :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. + :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 = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, 'start': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'label': {'key': 'label', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', '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): + def __init__( + self, + **kwargs + ): super(JpgImage, self).__init__(**kwargs) + self.odata_type = '#Microsoft.Media.JpgImage' # type: str self.layers = kwargs.get('layers', None) - self.odatatype = '#Microsoft.Media.JpgImage' + self.sprite_column = kwargs.get('sprite_column', None) class JpgLayer(Layer): @@ -3514,53 +3783,86 @@ class JpgLayer(Layer): All required parameters must be populated in order to send to Azure. - :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. + :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. + :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. + :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 odatatype: Required. Constant filled by server. - :type odatatype: str - :param quality: The compression quality of the JPEG output. Range is from - 0-100 and the default is 70. + :param quality: The compression quality of the JPEG output. Range is from 0-100 and the default + is 70. :type quality: int """ _validation = { - 'odatatype': {'required': True}, + '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'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, 'quality': {'key': 'quality', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(JpgLayer, self).__init__(**kwargs) + self.odata_type = '#Microsoft.Media.JpgLayer' # type: str self.quality = kwargs.get('quality', None) - self.odatatype = '#Microsoft.Media.JpgLayer' -class ListContainerSasInput(Model): +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 + :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 = { @@ -3568,30 +3870,35 @@ class ListContainerSasInput(Model): 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + 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(Model): +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] + :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): + def __init__( + self, + **kwargs + ): super(ListContentKeysResponse, self).__init__(**kwargs) self.content_keys = kwargs.get('content_keys', None) -class ListEdgePoliciesInput(Model): +class ListEdgePoliciesInput(msrest.serialization.Model): """ListEdgePoliciesInput. :param device_id: Unique identifier of the edge device. @@ -3602,19 +3909,20 @@ class ListEdgePoliciesInput(Model): 'device_id': {'key': 'deviceId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ListEdgePoliciesInput, self).__init__(**kwargs) self.device_id = kwargs.get('device_id', None) -class ListPathsResponse(Model): +class ListPathsResponse(msrest.serialization.Model): """Class of response for listPaths action. - :param streaming_paths: Streaming Paths supported by current Streaming - Locator + :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 + :param download_paths: Download Paths supported by current Streaming Locator. :type download_paths: list[str] """ @@ -3623,21 +3931,22 @@ class ListPathsResponse(Model): 'download_paths': {'key': 'downloadPaths', 'type': '[str]'}, } - def __init__(self, **kwargs): + 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(Model): +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. + 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] + :vartype streaming_locators: list[~azure.mgmt.media.models.AssetStreamingLocator] """ _validation = { @@ -3648,26 +3957,32 @@ class ListStreamingLocatorsResponse(Model): 'streaming_locators': {'key': 'streamingLocators', 'type': '[AssetStreamingLocator]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ListStreamingLocatorsResponse, self).__init__(**kwargs) self.streaming_locators = None class TrackedResource(Resource): - """The resource model definition for a ARM tracked 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. - 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. + :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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param location: The Azure Region of the resource. + :param location: Required. The geo-location where the resource lives. :type location: str """ @@ -3675,6 +3990,7 @@ class TrackedResource(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'location': {'required': True}, } _attribute_map = { @@ -3685,65 +4001,81 @@ class TrackedResource(Resource): 'location': {'key': 'location', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TrackedResource, self).__init__(**kwargs) self.tags = kwargs.get('tags', None) - self.location = kwargs.get('location', None) + self.location = kwargs['location'] class LiveEvent(TrackedResource): - """The Live Event. + """The live event. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. + :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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param location: The Azure Region of the resource. + :param location: Required. The geo-location where the resource lives. :type location: str - :param description: The Live Event description. + :param description: A description for the live event. :type description: str - :param input: Required. The Live Event input. + :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: The Live Event preview. + :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: The Live Event encoding. + :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 - :ivar provisioning_state: The provisioning state of the Live Event. + :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. Possible - values include: 'Stopped', 'Starting', 'Running', 'Stopping', 'Deleting' - :vartype resource_state: str or - ~azure.mgmt.media.models.LiveEventResourceState - :param cross_site_access_policies: The Live Event access policies. - :type cross_site_access_policies: - ~azure.mgmt.media.models.CrossSiteAccessPolicies - :param vanity_url: Specifies whether to use a vanity url with the Live - Event. This value is specified at creation time and cannot be updated. - :type vanity_url: bool - :param stream_options: The options to use for the LiveEvent. This value - is specified at creation time and cannot be updated. - :type stream_options: list[str or - ~azure.mgmt.media.models.StreamOptionsFlag] - :ivar created: The exact time the Live Event was created. - :vartype created: datetime - :ivar last_modified: The exact time the Live Event was last modified. - :vartype last_modified: datetime + :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}, - 'input': {'required': True}, + 'location': {'required': True}, 'provisioning_state': {'readonly': True}, 'resource_state': {'readonly': True}, 'created': {'readonly': True}, @@ -3760,35 +4092,43 @@ class LiveEvent(TrackedResource): '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'}, - 'vanity_url': {'key': 'properties.vanityUrl', 'type': 'bool'}, + '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): + def __init__( + self, + **kwargs + ): super(LiveEvent, self).__init__(**kwargs) 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.vanity_url = kwargs.get('vanity_url', 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(Model): +class LiveEventActionInput(msrest.serialization.Model): """The LiveEvent action input parameter definition. - :param remove_outputs_on_stop: The flag indicates if remove LiveOutputs on - Stop. + :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 """ @@ -3796,36 +4136,61 @@ class LiveEventActionInput(Model): 'remove_outputs_on_stop': {'key': 'removeOutputsOnStop', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(LiveEventActionInput, self).__init__(**kwargs) self.remove_outputs_on_stop = kwargs.get('remove_outputs_on_stop', None) -class LiveEventEncoding(Model): - """The Live Event encoding. +class LiveEventEncoding(msrest.serialization.Model): + """Specifies the live event type and optional encoding settings for encoding live events. - :param encoding_type: The encoding type for Live Event. This value is - specified at creation time and cannot be updated. Possible values include: - 'None', 'Basic', 'Standard', 'Premium1080p' + :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". :type encoding_type: str or ~azure.mgmt.media.models.LiveEventEncodingType - :param preset_name: The encoding preset name. This value is specified at - creation time and cannot be updated. + :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): + 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(Model): - """The Live Event endpoint. +class LiveEventEndpoint(msrest.serialization.Model): + """The live event endpoint. :param protocol: The endpoint protocol. :type protocol: str @@ -3838,32 +4203,34 @@ class LiveEventEndpoint(Model): 'url': {'key': 'url', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(LiveEventEndpoint, self).__init__(**kwargs) self.protocol = kwargs.get('protocol', None) self.url = kwargs.get('url', None) -class LiveEventInput(Model): - """The Live Event input. +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 streaming 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: The access control for LiveEvent Input. + :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 timespan duration of the key - frame interval duration. + :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 unique identifier for a stream. This can be - specified at creation time but cannot be updated. If omitted, the service - will generate a unique value. + :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. + :param endpoints: The input endpoints for the live event. :type endpoints: list[~azure.mgmt.media.models.LiveEventEndpoint] """ @@ -3879,17 +4246,20 @@ class LiveEventInput(Model): 'endpoints': {'key': 'endpoints', 'type': '[LiveEventEndpoint]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(LiveEventInput, self).__init__(**kwargs) - self.streaming_protocol = kwargs.get('streaming_protocol', None) + 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(Model): - """The IP access control for Live Event Input. +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 @@ -3899,35 +4269,119 @@ class LiveEventInputAccessControl(Model): 'ip': {'key': 'ip', 'type': 'IPAccessControl'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(LiveEventInputAccessControl, self).__init__(**kwargs) self.ip = kwargs.get('ip', None) -class LiveEventPreview(Model): - """The Live Event preview. +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. + :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 LiveEvent 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. + :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 - LiveEvent preview. This value is specified at creation time and cannot be - updated. + :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 StreamingLocator 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. + :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 """ @@ -3939,7 +4393,10 @@ class LiveEventPreview(Model): 'alternative_media_id': {'key': 'alternativeMediaId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(LiveEventPreview, self).__init__(**kwargs) self.endpoints = kwargs.get('endpoints', None) self.access_control = kwargs.get('access_control', None) @@ -3948,8 +4405,8 @@ def __init__(self, **kwargs): self.alternative_media_id = kwargs.get('alternative_media_id', None) -class LiveEventPreviewAccessControl(Model): - """The IP access control for Live Event preview. +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 @@ -3959,58 +4416,93 @@ class LiveEventPreviewAccessControl(Model): 'ip': {'key': 'ip', 'type': 'IPAccessControl'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(LiveEventPreviewAccessControl, self).__init__(**kwargs) self.ip = kwargs.get('ip', None) -class LiveOutput(ProxyResource): - """The Live Output. +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. - Variables are only populated by the server, and will be ignored when - sending a request. + :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 + """ - All required parameters must be populated in order to send to Azure. + _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(Resource): + """The Live Output. - :ivar id: Fully qualified resource ID for the 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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param description: The description of the Live Output. + :param description: The description of the live output. :type description: str - :param asset_name: Required. The asset name. + :param asset_name: The asset that the live output will write to. :type asset_name: str - :param archive_window_length: Required. ISO 8601 timespan duration of the - archive window length. This is duration that customer want to retain the - recorded content. - :type archive_window_length: timedelta - :param manifest_name: The manifest file name. If not provided, the - service will generate one automatically. + :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: The HLS configuration. + :param hls: HTTP Live Streaming (HLS) packing setting for the live output. :type hls: ~azure.mgmt.media.models.Hls - :param output_snap_time: The output snapshot time. + :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 exact time the Live Output was created. - :vartype created: datetime - :ivar last_modified: The exact time the Live Output was last modified. - :vartype last_modified: datetime - :ivar provisioning_state: The provisioning state of the Live Output. + :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 + :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}, - 'asset_name': {'required': True}, - 'archive_window_length': {'required': True}, 'created': {'readonly': True}, 'last_modified': {'readonly': True}, 'provisioning_state': {'readonly': True}, @@ -4033,7 +4525,10 @@ class LiveOutput(ProxyResource): 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(LiveOutput, self).__init__(**kwargs) self.description = kwargs.get('description', None) self.asset_name = kwargs.get('asset_name', None) @@ -4047,7 +4542,35 @@ def __init__(self, **kwargs): self.resource_state = None -class Location(Model): +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 Location(msrest.serialization.Model): """Location. All required parameters must be populated in order to send to Azure. @@ -4064,37 +4587,85 @@ class Location(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Location, self).__init__(**kwargs) - self.name = kwargs.get('name', None) + self.name = kwargs['name'] + + +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. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. + 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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param location: The Azure Region of the resource. + :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 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 """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'location': {'required': True}, 'media_service_id': {'readonly': True}, } @@ -4104,77 +4675,95 @@ class MediaService(TrackedResource): 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', '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'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MediaService, self).__init__(**kwargs) + 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) -class Metric(Model): - """A metric emitted by service. - - Variables are only populated by the server, and will be ignored when - sending a request. +class MediaServiceCollection(msrest.serialization.Model): + """A collection of MediaService items. - :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 dimensions: The metric dimensions. - :vartype dimensions: list[~azure.mgmt.media.models.MetricDimension] + :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 """ - _validation = { - 'name': {'readonly': True}, - 'display_name': {'readonly': True}, - 'display_description': {'readonly': True}, - 'unit': {'readonly': True}, - 'aggregation_type': {'readonly': True}, - 'dimensions': {'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'}, - 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, + 'value': {'key': 'value', 'type': '[MediaService]'}, + 'odata_next_link': {'key': '@odata\\.nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): - super(Metric, self).__init__(**kwargs) - self.name = None - self.display_name = None - self.display_description = None - self.unit = None - self.aggregation_type = None - self.dimensions = None + 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 MetricDimension(Model): - """A metric dimension. +class MediaServiceIdentity(msrest.serialization.Model): + """MediaServiceIdentity. - Variables are only populated by the server, and will be ignored when - sending a request. + 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 + All required parameters must be populated in order to send to Azure. + + :param type: Required. The identity type. Possible values include: "SystemAssigned", "None". + :type type: str or ~azure.mgmt.media.models.ManagedIdentityType + :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 + """ + + _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'}, + } + + def __init__( + self, + **kwargs + ): + super(MediaServiceIdentity, self).__init__(**kwargs) + self.type = kwargs['type'] + self.principal_id = None + self.tenant_id = 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 """ @@ -4191,84 +4780,119 @@ class MetricDimension(Model): 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MetricDimension, self).__init__(**kwargs) self.name = None self.display_name = None self.to_be_exported_for_shoebox = None -class MetricProperties(Model): - """Metric properties. +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. + 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 + :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 + :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] """ _validation = { - 'service_specification': {'readonly': True}, + 'name': {'readonly': True}, + 'display_name': {'readonly': True}, + 'display_description': {'readonly': True}, + 'unit': {'readonly': True}, + 'aggregation_type': {'readonly': True}, + 'dimensions': {'readonly': True}, } _attribute_map = { - 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, + 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, } - def __init__(self, **kwargs): - super(MetricProperties, self).__init__(**kwargs) - self.service_specification = None + 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.supported_aggregation_types = kwargs.get('supported_aggregation_types', None) + self.dimensions = 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. + """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 + sub-classes are: Mp4Format, TransportStreamFormat. All required parameters must be populated in order to send to Azure. - :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} - The base name of the input video {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. Any unsubstituted - macros will be collapsed and removed from the filename. + :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. Any + unsubstituted macros will be collapsed and removed from the filename. :type filename_pattern: str - :param odatatype: Required. Constant filled by server. - :type odatatype: 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 . + :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}, - 'odatatype': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'filename_pattern': {'key': 'filenamePattern', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, 'output_files': {'key': 'outputFiles', 'type': '[OutputFile]'}, } _subtype_map = { - 'odatatype': {'#Microsoft.Media.Mp4Format': 'Mp4Format', '#Microsoft.Media.TransportStreamFormat': 'TransportStreamFormat'} + 'odata_type': {'#Microsoft.Media.Mp4Format': 'Mp4Format', '#Microsoft.Media.TransportStreamFormat': 'TransportStreamFormat'} } - def __init__(self, **kwargs): + 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) - self.odatatype = '#Microsoft.Media.MultiBitrateFormat' class Mp4Format(MultiBitrateFormat): @@ -4276,42 +4900,47 @@ class Mp4Format(MultiBitrateFormat): All required parameters must be populated in order to send to Azure. - :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} - The base name of the input video {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. Any unsubstituted - macros will be collapsed and removed from the filename. + :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. Any + unsubstituted macros will be collapsed and removed from the filename. :type filename_pattern: str - :param odatatype: Required. Constant filled by server. - :type odatatype: 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 . + :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}, - 'odatatype': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'filename_pattern': {'key': 'filenamePattern', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, 'output_files': {'key': 'outputFiles', 'type': '[OutputFile]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Mp4Format, self).__init__(**kwargs) - self.odatatype = '#Microsoft.Media.Mp4Format' + self.odata_type = '#Microsoft.Media.Mp4Format' # type: str -class NoEncryption(Model): +class NoEncryption(msrest.serialization.Model): """Class for NoEncryption scheme. - :param enabled_protocols: Representing supported protocols + :param enabled_protocols: Representing supported protocols. :type enabled_protocols: ~azure.mgmt.media.models.EnabledProtocols """ @@ -4319,20 +4948,22 @@ class NoEncryption(Model): 'enabled_protocols': {'key': 'enabledProtocols', 'type': 'EnabledProtocols'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NoEncryption, self).__init__(**kwargs) self.enabled_protocols = kwargs.get('enabled_protocols', None) -class ODataError(Model): +class ODataError(msrest.serialization.Model): """Information about an error. :param code: A language-independent error name. :type code: str :param message: The error message. :type message: str - :param target: The target of the error (for example, the name of the - property in error). + :param target: The target of the error (for example, the name of the property in error). :type target: str :param details: The error details. :type details: list[~azure.mgmt.media.models.ODataError] @@ -4345,7 +4976,10 @@ class ODataError(Model): 'details': {'key': 'details', 'type': '[ODataError]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ODataError, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -4353,7 +4987,7 @@ def __init__(self, **kwargs): self.details = kwargs.get('details', None) -class Operation(Model): +class Operation(msrest.serialization.Model): """An operation. All required parameters must be populated in order to send to Azure. @@ -4365,7 +4999,7 @@ class Operation(Model): :param origin: Origin of the operation. :type origin: str :param properties: Operation properties format. - :type properties: ~azure.mgmt.media.models.MetricProperties + :type properties: ~azure.mgmt.media.models.Properties """ _validation = { @@ -4376,18 +5010,45 @@ class Operation(Model): 'name': {'key': 'name', 'type': 'str'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'MetricProperties'}, + 'properties': {'key': 'properties', 'type': 'Properties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) + self.name = kwargs['name'] self.display = kwargs.get('display', None) self.origin = kwargs.get('origin', None) self.properties = kwargs.get('properties', None) -class OperationDisplay(Model): +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] + :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': '[Operation]'}, + 'odata_next_link': {'key': '@odata\\.nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.odata_next_link = kwargs.get('odata_next_link', None) + + +class OperationDisplay(msrest.serialization.Model): """Operation details. :param provider: The service provider. @@ -4407,7 +5068,10 @@ class OperationDisplay(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(OperationDisplay, self).__init__(**kwargs) self.provider = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -4415,17 +5079,16 @@ def __init__(self, **kwargs): self.description = kwargs.get('description', None) -class OutputFile(Model): +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. + :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] """ @@ -4437,106 +5100,129 @@ class OutputFile(Model): 'labels': {'key': 'labels', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(OutputFile, self).__init__(**kwargs) - self.labels = kwargs.get('labels', None) + self.labels = kwargs['labels'] -class PngFormat(ImageFormat): +class PngFormat(Format): """Describes the settings for producing PNG thumbnails. All required parameters must be populated in order to send to Azure. - :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} - The base name of the input video {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. Any unsubstituted - macros will be collapsed and removed from the filename. + :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. Any + unsubstituted macros will be collapsed and removed from the filename. :type filename_pattern: str - :param odatatype: Required. Constant filled by server. - :type odatatype: str """ _validation = { + 'odata_type': {'required': True}, 'filename_pattern': {'required': True}, - 'odatatype': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'filename_pattern': {'key': 'filenamePattern', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PngFormat, self).__init__(**kwargs) - self.odatatype = '#Microsoft.Media.PngFormat' + 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. + """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 label: An optional label for the codec. The label can be used to - control muxing behavior. + :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 odatatype: Required. Constant filled by server. - :type odatatype: str - :param key_frame_interval: The distance between two key frames, thereby - defining a group of pictures (GOP). The value should be a non-zero integer - in the range [1, 30] seconds, specified in ISO 8601 format. The default is - 2 seconds (PT2S). - :type key_frame_interval: 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' + :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 start: Required. The position in the input video from where to - start generating thumbnails. The value can be in absolute timestamp (ISO - 8601, e.g: PT05S), or a frame count (For example, 10 for the 10th frame), - or a relative value (For example, 1%). Also supports a macro {Best}, which - tells the encoder to select the best thumbnail from the first few seconds - of the video. + :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 absolute timestamp (ISO 8601, e.g: PT05S for one image every 5 - seconds), or a frame count (For example, 30 for every 30 frames), or a - relative value (For example, 1%). + :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 in the input video at which to stop generating - thumbnails. The value can be in absolute timestamp (ISO 8601, e.g: PT5M30S - to stop at 5 minutes and 30 seconds), or a frame count (For example, 300 - to stop at the 300th frame), or a relative value (For example, 100%). + :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] + :param layers: A collection of output PNG image layers to be produced by the encoder. + :type layers: list[~azure.mgmt.media.models.Layer] """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, 'start': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'label': {'key': 'label', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', '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]'}, + 'layers': {'key': 'layers', 'type': '[Layer]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PngImage, self).__init__(**kwargs) + self.odata_type = '#Microsoft.Media.PngImage' # type: str self.layers = kwargs.get('layers', None) - self.odatatype = '#Microsoft.Media.PngImage' class PngLayer(Layer): @@ -4544,41 +5230,42 @@ class PngLayer(Layer): All required parameters must be populated in order to send to Azure. - :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. + :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. + :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. + :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 odatatype: Required. Constant filled by server. - :type odatatype: str """ _validation = { - 'odatatype': {'required': True}, + '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'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PngLayer, self).__init__(**kwargs) - self.odatatype = '#Microsoft.Media.PngLayer' + self.odata_type = '#Microsoft.Media.PngLayer' # type: str -class PresentationTimeRange(Model): - """The presentation time range, this is asset related and not recommended for - Account Filter. +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 @@ -4590,8 +5277,7 @@ class PresentationTimeRange(Model): :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. + :param force_end_timestamp: The indicator of forcing existing of end time stamp. :type force_end_timestamp: bool """ @@ -4604,7 +5290,10 @@ class PresentationTimeRange(Model): 'force_end_timestamp': {'key': 'forceEndTimestamp', 'type': 'bool'}, } - def __init__(self, **kwargs): + 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) @@ -4614,7 +5303,223 @@ def __init__(self, **kwargs): self.force_end_timestamp = kwargs.get('force_end_timestamp', None) -class Provider(Model): +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 Provider(msrest.serialization.Model): """A resource provider. All required parameters must be populated in order to send to Azure. @@ -4631,30 +5536,62 @@ class Provider(Model): 'provider_name': {'key': 'providerName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Provider, self).__init__(**kwargs) - self.provider_name = kwargs.get('provider_name', None) + self.provider_name = kwargs['provider_name'] -class Rectangle(Model): - """Describes the properties of a rectangular window applied to the input media - before processing it. +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. - :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%). + :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 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%). + :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%). + :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%). + :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 """ @@ -4665,7 +5602,10 @@ class Rectangle(Model): 'height': {'key': 'height', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Rectangle, self).__init__(**kwargs) self.left = kwargs.get('left', None) self.top = kwargs.get('top', None) @@ -4673,82 +5613,88 @@ def __init__(self, **kwargs): self.height = kwargs.get('height', None) -class ServiceSpecification(Model): +class ServiceSpecification(msrest.serialization.Model): """The service metric specifications. - Variables are only populated by the server, and will be ignored when - sending a request. + 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.Metric] + :vartype metric_specifications: list[~azure.mgmt.media.models.MetricSpecification] """ _validation = { + 'log_specifications': {'readonly': True}, 'metric_specifications': {'readonly': True}, } _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[Metric]'}, + 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, } - def __init__(self, **kwargs): + 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. + """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 odatatype: Required. Constant filled by server. - :type odatatype: str - :param filters: One or more filtering operations that are applied to the - input media before encoding. + :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. + :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. + :param formats: Required. The list of outputs to be produced by the encoder. :type formats: list[~azure.mgmt.media.models.Format] """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, 'codecs': {'required': True}, 'formats': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + '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): + 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.get('codecs', None) - self.formats = kwargs.get('formats', None) - self.odatatype = '#Microsoft.Media.StandardEncoderPreset' + self.codecs = kwargs['codecs'] + self.formats = kwargs['formats'] -class StorageAccount(Model): +class StorageAccount(msrest.serialization.Model): """The storage account details. 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. + :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' + :param type: Required. The type of the storage account. Possible values include: "Primary", + "Secondary". :type type: str or ~azure.mgmt.media.models.StorageAccountType """ @@ -4761,15 +5707,17 @@ class StorageAccount(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StorageAccount, self).__init__(**kwargs) self.id = kwargs.get('id', None) - self.type = kwargs.get('type', None) + self.type = kwargs['type'] -class StorageEncryptedAssetDecryptionData(Model): - """Data needed to decrypt asset files encrypted with legacy storage - encryption. +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 @@ -4783,48 +5731,47 @@ class StorageEncryptedAssetDecryptionData(Model): 'asset_file_encryption_metadata': {'key': 'assetFileEncryptionMetadata', 'type': '[AssetFileEncryptionMetadata]'}, } - def __init__(self, **kwargs): + 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 StreamingEndpoint. + """The streaming endpoint. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. + :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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param location: The Azure Region of the resource. + :param location: Required. The geo-location where the resource lives. :type location: str - :param description: The StreamingEndpoint description. + :param description: The streaming endpoint description. :type description: str - :param scale_units: Required. The number of scale units. Use the Scale - operation to adjust this value. + :param scale_units: The number of scale units. Use the Scale operation to adjust this value. :type scale_units: int - :param availability_set_name: The name of the AvailabilitySet used with - this StreamingEndpoint for high availability streaming. This value can - only be set at creation time. + :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 - StreamingEndpoint. - :type access_control: - ~azure.mgmt.media.models.StreamingEndpointAccessControl - :param max_cache_age: Max cache age + :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 StreamingEndpoint + :param custom_host_names: The custom host names of the streaming endpoint. :type custom_host_names: list[str] - :ivar host_name: The StreamingEndpoint host name. + :ivar host_name: The streaming endpoint host name. :vartype host_name: str :param cdn_enabled: The CDN enabled flag. :type cdn_enabled: bool @@ -4832,30 +5779,26 @@ class StreamingEndpoint(TrackedResource): :type cdn_provider: str :param cdn_profile: The CDN profile name. :type cdn_profile: str - :ivar provisioning_state: The provisioning state of the StreamingEndpoint. + :ivar provisioning_state: The provisioning state of the streaming endpoint. :vartype provisioning_state: str - :ivar resource_state: The resource state of the StreamingEndpoint. - 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 StreamingEndpoint access policies. - :type cross_site_access_policies: - ~azure.mgmt.media.models.CrossSiteAccessPolicies + :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 - :ivar created: The exact time the StreamingEndpoint was created. - :vartype created: datetime - :ivar last_modified: The exact time the StreamingEndpoint was last - modified. - :vartype last_modified: datetime + :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}, - 'scale_units': {'required': True}, + 'location': {'required': True}, 'host_name': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'resource_state': {'readonly': True}, @@ -4888,7 +5831,10 @@ class StreamingEndpoint(TrackedResource): 'last_modified': {'key': 'properties.lastModified', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StreamingEndpoint, self).__init__(**kwargs) self.description = kwargs.get('description', None) self.scale_units = kwargs.get('scale_units', None) @@ -4908,12 +5854,12 @@ def __init__(self, **kwargs): self.last_modified = None -class StreamingEndpointAccessControl(Model): - """StreamingEndpoint access control definition. +class StreamingEndpointAccessControl(msrest.serialization.Model): + """Streaming endpoint access control definition. - :param akamai: The access control of Akamai + :param akamai: The access control of Akamai. :type akamai: ~azure.mgmt.media.models.AkamaiAccessControl - :param ip: The IP access control of the StreamingEndpoint. + :param ip: The IP access control of the streaming endpoint. :type ip: ~azure.mgmt.media.models.IPAccessControl """ @@ -4922,16 +5868,47 @@ class StreamingEndpointAccessControl(Model): 'ip': {'key': 'ip', 'type': 'IPAccessControl'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StreamingEndpointAccessControl, self).__init__(**kwargs) self.akamai = kwargs.get('akamai', None) self.ip = kwargs.get('ip', None) -class StreamingEntityScaleUnit(Model): +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 StreamingEndpoint. + :param scale_unit: The scale unit number of the streaming endpoint. :type scale_unit: int """ @@ -4939,55 +5916,51 @@ class StreamingEntityScaleUnit(Model): 'scale_unit': {'key': 'scaleUnit', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StreamingEntityScaleUnit, self).__init__(**kwargs) self.scale_unit = kwargs.get('scale_unit', None) -class StreamingLocator(ProxyResource): +class StreamingLocator(Resource): """A Streaming Locator resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. + :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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param asset_name: Required. Asset Name + :param asset_name: Asset Name. :type asset_name: str :ivar created: The creation time of the Streaming Locator. - :vartype created: datetime + :vartype created: ~datetime.datetime :param start_time: The start time of the Streaming Locator. - :type start_time: datetime + :type start_time: ~datetime.datetime :param end_time: The end time of the Streaming Locator. - :type end_time: datetime - :param streaming_locator_id: The StreamingLocatorId 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: Required. 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' + :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. + :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 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 + :param filters: A list of asset or account filters which apply to this streaming locator. :type filters: list[str] """ @@ -4995,9 +5968,7 @@ class StreamingLocator(ProxyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'asset_name': {'required': True}, 'created': {'readonly': True}, - 'streaming_policy_name': {'required': True}, } _attribute_map = { @@ -5016,7 +5987,10 @@ class StreamingLocator(ProxyResource): 'filters': {'key': 'properties.filters', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StreamingLocator, self).__init__(**kwargs) self.asset_name = kwargs.get('asset_name', None) self.created = None @@ -5030,28 +6004,50 @@ def __init__(self, **kwargs): self.filters = kwargs.get('filters', None) -class StreamingLocatorContentKey(Model): +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. + 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 + :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 + :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 + :param value: Value of Content Key. :type value: str - :ivar policy_name: ContentKeyPolicy used by Content Key + :ivar policy_name: ContentKeyPolicy used by Content Key. :vartype policy_name: str - :ivar tracks: Tracks which use this Content Key + :ivar tracks: Tracks which use this Content Key. :vartype tracks: list[~azure.mgmt.media.models.TrackSelection] """ @@ -5071,9 +6067,12 @@ class StreamingLocatorContentKey(Model): 'tracks': {'key': 'tracks', 'type': '[TrackSelection]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StreamingLocatorContentKey, self).__init__(**kwargs) - self.id = kwargs.get('id', None) + 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) @@ -5081,20 +6080,18 @@ def __init__(self, **kwargs): self.tracks = None -class StreamingPath(Model): +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' + :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 + :param paths: Streaming paths for each protocol and encryptionScheme pair. :type paths: list[str] """ @@ -5109,39 +6106,40 @@ class StreamingPath(Model): 'paths': {'key': 'paths', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StreamingPath, self).__init__(**kwargs) - self.streaming_protocol = kwargs.get('streaming_protocol', None) - self.encryption_scheme = kwargs.get('encryption_scheme', None) + self.streaming_protocol = kwargs['streaming_protocol'] + self.encryption_scheme = kwargs['encryption_scheme'] self.paths = kwargs.get('paths', None) -class StreamingPolicy(ProxyResource): +class StreamingPolicy(Resource): """A Streaming Policy resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. + :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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar created: Creation time of Streaming Policy - :vartype created: datetime - :param default_content_key_policy_name: Default ContentKey used by current - Streaming Policy + :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 + :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 + :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 """ @@ -5164,7 +6162,10 @@ class StreamingPolicy(ProxyResource): 'no_encryption': {'key': 'properties.noEncryption', 'type': 'NoEncryption'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StreamingPolicy, self).__init__(**kwargs) self.created = None self.default_content_key_policy_name = kwargs.get('default_content_key_policy_name', None) @@ -5174,15 +6175,38 @@ def __init__(self, **kwargs): self.no_encryption = kwargs.get('no_encryption', None) -class StreamingPolicyContentKey(Model): +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 + :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 + :param policy_name: Policy used by Content Key. :type policy_name: str - :param tracks: Tracks which use this content key + :param tracks: Tracks which use this content key. :type tracks: list[~azure.mgmt.media.models.TrackSelection] """ @@ -5192,22 +6216,23 @@ class StreamingPolicyContentKey(Model): 'tracks': {'key': 'tracks', 'type': '[TrackSelection]'}, } - def __init__(self, **kwargs): + 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(Model): +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 + :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] + :param key_to_track_mappings: Representing tracks needs separate content key. + :type key_to_track_mappings: list[~azure.mgmt.media.models.StreamingPolicyContentKey] """ _attribute_map = { @@ -5215,28 +6240,29 @@ class StreamingPolicyContentKeys(Model): 'key_to_track_mappings': {'key': 'keyToTrackMappings', 'type': '[StreamingPolicyContentKey]'}, } - def __init__(self, **kwargs): + 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(Model): +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. + :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 + :param allow_persistent_license: Required. All license to be persistent or not. :type allow_persistent_license: bool """ @@ -5249,25 +6275,27 @@ class StreamingPolicyFairPlayConfiguration(Model): 'allow_persistent_license': {'key': 'allowPersistentLicense', 'type': 'bool'}, } - def __init__(self, **kwargs): + 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.get('allow_persistent_license', None) + self.allow_persistent_license = kwargs['allow_persistent_license'] -class StreamingPolicyPlayReadyConfiguration(Model): +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. + :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 + :param play_ready_custom_attributes: Custom attributes for PlayReady. :type play_ready_custom_attributes: str """ @@ -5276,23 +6304,25 @@ class StreamingPolicyPlayReadyConfiguration(Model): 'play_ready_custom_attributes': {'key': 'playReadyCustomAttributes', 'type': 'str'}, } - def __init__(self, **kwargs): + 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(Model): +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. + :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 """ @@ -5300,57 +6330,15 @@ class StreamingPolicyWidevineConfiguration(Model): 'custom_license_acquisition_url_template': {'key': 'customLicenseAcquisitionUrlTemplate', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StreamingPolicyWidevineConfiguration, self).__init__(**kwargs) self.custom_license_acquisition_url_template = kwargs.get('custom_license_acquisition_url_template', None) -class SubscriptionMediaService(TrackedResource): - """A Media Services account. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified resource ID for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param location: The Azure Region of the resource. - :type location: str - :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] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'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'}, - 'media_service_id': {'key': 'properties.mediaServiceId', 'type': 'str'}, - 'storage_accounts': {'key': 'properties.storageAccounts', 'type': '[StorageAccount]'}, - } - - def __init__(self, **kwargs): - super(SubscriptionMediaService, self).__init__(**kwargs) - self.media_service_id = None - self.storage_accounts = kwargs.get('storage_accounts', None) - - -class SyncStorageKeysInput(Model): +class SyncStorageKeysInput(msrest.serialization.Model): """The input to the sync storage keys request. :param id: The ID of the storage account resource. @@ -5361,24 +6349,25 @@ class SyncStorageKeysInput(Model): 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SyncStorageKeysInput, self).__init__(**kwargs) self.id = kwargs.get('id', None) -class TrackPropertyCondition(Model): +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' + :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 + :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 """ @@ -5393,58 +6382,58 @@ class TrackPropertyCondition(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TrackPropertyCondition, self).__init__(**kwargs) - self.property = kwargs.get('property', None) - self.operation = kwargs.get('operation', None) + self.property = kwargs['property'] + self.operation = kwargs['operation'] self.value = kwargs.get('value', None) -class TrackSelection(Model): +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] + :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): + 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. +class Transform(Resource): + """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. + 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. + :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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar created: The UTC date and time when the Transform was created, in - 'YYYY-MM-DDThh:mm:ssZ' format. - :vartype created: datetime + :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 - :param outputs: Required. An array of one or more TransformOutputs that - the Transform should generate. + :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] """ @@ -5454,7 +6443,6 @@ class Transform(ProxyResource): 'type': {'readonly': True}, 'created': {'readonly': True}, 'last_modified': {'readonly': True}, - 'outputs': {'required': True}, } _attribute_map = { @@ -5467,7 +6455,10 @@ class Transform(ProxyResource): 'outputs': {'key': 'properties.outputs', 'type': '[TransformOutput]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Transform, self).__init__(**kwargs) self.created = None self.description = kwargs.get('description', None) @@ -5475,27 +6466,47 @@ def __init__(self, **kwargs): self.outputs = kwargs.get('outputs', None) -class TransformOutput(Model): - """Describes the properties of a TransformOutput, which are the rules to be - applied while generating the desired output. +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' + :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' + :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. + :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 """ @@ -5509,103 +6520,143 @@ class TransformOutput(Model): 'preset': {'key': 'preset', 'type': 'Preset'}, } - def __init__(self, **kwargs): + 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.get('preset', 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). + """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 filename_pattern: Required. The pattern of the file names for the - generated output files. The following macros are supported in the file - name: {Basename} - The base name of the input video {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. Any unsubstituted - macros will be collapsed and removed from the filename. + :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. Any + unsubstituted macros will be collapsed and removed from the filename. :type filename_pattern: str - :param odatatype: Required. Constant filled by server. - :type odatatype: 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 . + :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}, - 'odatatype': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'filename_pattern': {'key': 'filenamePattern', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, 'output_files': {'key': 'outputFiles', 'type': '[OutputFile]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TransportStreamFormat, self).__init__(**kwargs) - self.odatatype = '#Microsoft.Media.TransportStreamFormat' + self.odata_type = '#Microsoft.Media.TransportStreamFormat' # type: str + + +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. + """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 odatatype: Required. Constant filled by server. - :type odatatype: 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. - 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 + :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 experimental_options: Dictionary containing key value pairs for - parameters not exposed in the preset itself + :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' + :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 = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + '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): + 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) - self.odatatype = '#Microsoft.Media.VideoAnalyzerPreset' class VideoOverlay(Overlay): @@ -5613,69 +6664,69 @@ class VideoOverlay(Overlay): All required parameters must be populated in order to send to Azure. - :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 or PNG formats, 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. + :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 or PNG formats, 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 in to the input video. If - not specified the overlay starts from the beginning of the input video. - :type start: timedelta - :param end: The position in the input video at which the overlay ends. The - value should be in ISO 8601 duration format. For example, PT30S to end the - overlay at 30 seconds in to the input video. If not specified the overlay - will be applied until the end of the input video if inputLoop is true. - Else, if inputLoop is false, then overlay will last as long as the - duration of the overlay media. - :type end: 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: 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: 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. + :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 odatatype: Required. Constant filled by server. - :type odatatype: str - :param position: The location in the input video where the overlay is - applied. + :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. + :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. + :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}, - 'odatatype': {'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'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, 'position': {'key': 'position', 'type': 'Rectangle'}, 'opacity': {'key': 'opacity', 'type': 'float'}, 'crop_rectangle': {'key': 'cropRectangle', 'type': 'Rectangle'}, } - def __init__(self, **kwargs): + 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) - self.odatatype = '#Microsoft.Media.VideoOverlay' 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 09952f9fcd00..95ae195c441d 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 @@ -1,96 +1,110 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError +import datetime +from typing import Dict, List, Optional, Union +from azure.core.exceptions import HttpResponseError +import msrest.serialization -class Codec(Model): +from ._azure_media_services_enums import * + + +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, CopyVideo, Video, CopyAudio + sub-classes are: Audio, CopyAudio, CopyVideo, Video. All required parameters must be populated in order to send to Azure. - :param label: An optional label for the codec. The label can be used to - control muxing behavior. + :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 odatatype: Required. Constant filled by server. - :type odatatype: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'label': {'key': 'label', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, } _subtype_map = { - 'odatatype': {'#Microsoft.Media.Audio': 'Audio', '#Microsoft.Media.CopyVideo': 'CopyVideo', '#Microsoft.Media.Video': 'Video', '#Microsoft.Media.CopyAudio': 'CopyAudio'} + 'odata_type': {'#Microsoft.Media.Audio': 'Audio', '#Microsoft.Media.CopyAudio': 'CopyAudio', '#Microsoft.Media.CopyVideo': 'CopyVideo', '#Microsoft.Media.Video': 'Video'} } - def __init__(self, *, label: str=None, **kwargs) -> None: + def __init__( + self, + *, + label: Optional[str] = None, + **kwargs + ): super(Codec, self).__init__(**kwargs) + self.odata_type = None # type: Optional[str] self.label = label - self.odatatype = 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 + sub-classes are: AacAudio. All required parameters must be populated in order to send to Azure. - :param label: An optional label for the codec. The label can be used to - control muxing behavior. + :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 odatatype: Required. Constant filled by server. - :type odatatype: 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. + :param bitrate: The bitrate, in bits per second, of the output encoded audio. :type bitrate: int """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'label': {'key': 'label', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, 'channels': {'key': 'channels', 'type': 'int'}, 'sampling_rate': {'key': 'samplingRate', 'type': 'int'}, 'bitrate': {'key': 'bitrate', 'type': 'int'}, } _subtype_map = { - 'odatatype': {'#Microsoft.Media.AacAudio': 'AacAudio'} - } - - def __init__(self, *, label: str=None, channels: int=None, sampling_rate: int=None, bitrate: int=None, **kwargs) -> None: + 'odata_type': {'#Microsoft.Media.AacAudio': 'AacAudio'} + } + + def __init__( + self, + *, + label: Optional[str] = None, + channels: Optional[int] = None, + sampling_rate: Optional[int] = None, + bitrate: Optional[int] = None, + **kwargs + ): super(Audio, self).__init__(label=label, **kwargs) + self.odata_type = '#Microsoft.Media.Audio' # type: str self.channels = channels self.sampling_rate = sampling_rate self.bitrate = bitrate - self.odatatype = '#Microsoft.Media.Audio' class AacAudio(Audio): @@ -98,147 +112,160 @@ class AacAudio(Audio): All required parameters must be populated in order to send to Azure. - :param label: An optional label for the codec. The label can be used to - control muxing behavior. + :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 odatatype: Required. Constant filled by server. - :type odatatype: 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. + :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' + :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 = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'label': {'key': 'label', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', '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, *, label: str=None, channels: int=None, sampling_rate: int=None, bitrate: int=None, profile=None, **kwargs) -> None: + def __init__( + self, + *, + label: Optional[str] = None, + channels: Optional[int] = None, + sampling_rate: Optional[int] = None, + bitrate: Optional[int] = None, + profile: Optional[Union[str, "AacAudioProfile"]] = None, + **kwargs + ): 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 - self.odatatype = '#Microsoft.Media.AacAudio' -class ClipTime(Model): - """Base class for specifying a clip time. Use sub classes of this class to - specify the time position in the media. +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 + sub-classes are: AbsoluteClipTime, UtcClipTime. All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str + :param odata_type: Required. The discriminator for derived types.Constant filled by server. + :type odata_type: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, } _subtype_map = { - 'odatatype': {'#Microsoft.Media.AbsoluteClipTime': 'AbsoluteClipTime'} + 'odata_type': {'#Microsoft.Media.AbsoluteClipTime': 'AbsoluteClipTime', '#Microsoft.Media.UtcClipTime': 'UtcClipTime'} } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ClipTime, self).__init__(**kwargs) - self.odatatype = None + 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. + """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 odatatype: Required. Constant filled by server. - :type odatatype: 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: timedelta + :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 = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, 'time': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'time': {'key': 'time', 'type': 'duration'}, } - def __init__(self, *, time, **kwargs) -> None: + def __init__( + self, + *, + time: datetime.timedelta, + **kwargs + ): super(AbsoluteClipTime, self).__init__(**kwargs) + self.odata_type = '#Microsoft.Media.AbsoluteClipTime' # type: str self.time = time - self.odatatype = '#Microsoft.Media.AbsoluteClipTime' -class Resource(Model): - """The core properties of ARM resources. +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. - :ivar id: Fully qualified resource ID for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str + :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 """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + 'type': {'required': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'key_vault_properties': {'key': 'keyVaultProperties', 'type': 'KeyVaultProperties'}, } - def __init__(self, **kwargs) -> None: - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None + def __init__( + self, + *, + type: Union[str, "AccountEncryptionKeyType"], + key_vault_properties: Optional["KeyVaultProperties"] = None, + **kwargs + ): + super(AccountEncryption, self).__init__(**kwargs) + self.type = type + self.key_vault_properties = key_vault_properties -class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. +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. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. + :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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str """ @@ -254,25 +281,31 @@ class ProxyResource(Resource): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: - super(ProxyResource, self).__init__(**kwargs) + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None -class AccountFilter(ProxyResource): +class AccountFilter(Resource): """An Account Filter. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. + :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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param presentation_time_range: The presentation time range. - :type presentation_time_range: - ~azure.mgmt.media.models.PresentationTimeRange + :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. @@ -294,18 +327,51 @@ class AccountFilter(ProxyResource): 'tracks': {'key': 'properties.tracks', 'type': '[FilterTrackSelection]'}, } - def __init__(self, *, presentation_time_range=None, first_quality=None, tracks=None, **kwargs) -> None: + def __init__( + self, + *, + presentation_time_range: Optional["PresentationTimeRange"] = None, + first_quality: Optional["FirstQuality"] = None, + tracks: Optional[List["FilterTrackSelection"]] = None, + **kwargs + ): super(AccountFilter, self).__init__(**kwargs) self.presentation_time_range = presentation_time_range self.first_quality = first_quality self.tracks = tracks -class AkamaiAccessControl(Model): +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, + *, + value: Optional[List["AccountFilter"]] = None, + odata_next_link: Optional[str] = None, + **kwargs + ): + super(AccountFilterCollection, self).__init__(**kwargs) + self.value = value + self.odata_next_link = odata_next_link + + +class AkamaiAccessControl(msrest.serialization.Model): """Akamai access control. - :param akamai_signature_header_authentication_key_list: authentication key - list + :param akamai_signature_header_authentication_key_list: authentication key list. :type akamai_signature_header_authentication_key_list: list[~azure.mgmt.media.models.AkamaiSignatureHeaderAuthenticationKey] """ @@ -314,20 +380,25 @@ class AkamaiAccessControl(Model): 'akamai_signature_header_authentication_key_list': {'key': 'akamaiSignatureHeaderAuthenticationKeyList', 'type': '[AkamaiSignatureHeaderAuthenticationKey]'}, } - def __init__(self, *, akamai_signature_header_authentication_key_list=None, **kwargs) -> None: + def __init__( + self, + *, + akamai_signature_header_authentication_key_list: Optional[List["AkamaiSignatureHeaderAuthenticationKey"]] = None, + **kwargs + ): super(AkamaiAccessControl, self).__init__(**kwargs) self.akamai_signature_header_authentication_key_list = akamai_signature_header_authentication_key_list -class AkamaiSignatureHeaderAuthenticationKey(Model): +class AkamaiSignatureHeaderAuthenticationKey(msrest.serialization.Model): """Akamai Signature Header authentication key. - :param identifier: identifier of the key + :param identifier: identifier of the key. :type identifier: str - :param base64_key: authentication key + :param base64_key: authentication key. :type base64_key: str :param expiration: The expiration time of the authentication key. - :type expiration: datetime + :type expiration: ~datetime.datetime """ _attribute_map = { @@ -336,17 +407,24 @@ class AkamaiSignatureHeaderAuthenticationKey(Model): 'expiration': {'key': 'expiration', 'type': 'iso-8601'}, } - def __init__(self, *, identifier: str=None, base64_key: str=None, expiration=None, **kwargs) -> None: + def __init__( + self, + *, + identifier: Optional[str] = None, + base64_key: Optional[str] = None, + expiration: Optional[datetime.datetime] = None, + **kwargs + ): super(AkamaiSignatureHeaderAuthenticationKey, self).__init__(**kwargs) self.identifier = identifier self.base64_key = base64_key self.expiration = expiration -class ApiError(Model): +class ApiError(msrest.serialization.Model): """The API error. - :param error: ApiError. The error properties. + :param error: The error properties. :type error: ~azure.mgmt.media.models.ODataError """ @@ -354,41 +432,35 @@ class ApiError(Model): 'error': {'key': 'error', 'type': 'ODataError'}, } - def __init__(self, *, error=None, **kwargs) -> None: + def __init__( + self, + *, + error: Optional["ODataError"] = None, + **kwargs + ): super(ApiError, self).__init__(**kwargs) self.error = error -class ApiErrorException(HttpOperationError): - """Server responsed with exception of type: 'ApiError'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(ApiErrorException, self).__init__(deserialize, response, 'ApiError', *args) - - -class Asset(ProxyResource): +class Asset(Resource): """An Asset. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. + :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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar asset_id: The Asset ID. :vartype asset_id: str :ivar created: The creation date of the Asset. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar last_modified: The last modified date of the Asset. - :vartype last_modified: datetime + :vartype last_modified: ~datetime.datetime :param alternate_id: The alternate ID of the Asset. :type alternate_id: str :param description: The Asset description. @@ -397,9 +469,8 @@ class Asset(ProxyResource): :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' + :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 """ @@ -428,7 +499,15 @@ class Asset(ProxyResource): 'storage_encryption_format': {'key': 'properties.storageEncryptionFormat', 'type': 'str'}, } - def __init__(self, *, alternate_id: str=None, description: str=None, container: str=None, storage_account_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + alternate_id: Optional[str] = None, + description: Optional[str] = None, + container: Optional[str] = None, + storage_account_name: Optional[str] = None, + **kwargs + ): super(Asset, self).__init__(**kwargs) self.asset_id = None self.created = None @@ -440,7 +519,34 @@ def __init__(self, *, alternate_id: str=None, description: str=None, container: self.storage_encryption_format = None -class AssetContainerSas(Model): +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, + *, + value: Optional[List["Asset"]] = None, + odata_next_link: Optional[str] = None, + **kwargs + ): + super(AssetCollection, self).__init__(**kwargs) + self.value = value + self.odata_next_link = odata_next_link + + +class AssetContainerSas(msrest.serialization.Model): """The Asset Storage container SAS URLs. :param asset_container_sas_urls: The list of Asset container SAS URLs. @@ -451,12 +557,17 @@ class AssetContainerSas(Model): 'asset_container_sas_urls': {'key': 'assetContainerSasUrls', 'type': '[str]'}, } - def __init__(self, *, asset_container_sas_urls=None, **kwargs) -> None: + def __init__( + self, + *, + asset_container_sas_urls: Optional[List[str]] = None, + **kwargs + ): super(AssetContainerSas, self).__init__(**kwargs) self.asset_container_sas_urls = asset_container_sas_urls -class AssetFileEncryptionMetadata(Model): +class AssetFileEncryptionMetadata(msrest.serialization.Model): """The Asset File Storage encryption metadata. All required parameters must be populated in order to send to Azure. @@ -479,28 +590,35 @@ class AssetFileEncryptionMetadata(Model): 'asset_file_id': {'key': 'assetFileId', 'type': 'str'}, } - def __init__(self, *, asset_file_id: str, initialization_vector: str=None, asset_file_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + asset_file_id: str, + initialization_vector: Optional[str] = None, + asset_file_name: Optional[str] = None, + **kwargs + ): super(AssetFileEncryptionMetadata, self).__init__(**kwargs) self.initialization_vector = initialization_vector self.asset_file_name = asset_file_name self.asset_file_id = asset_file_id -class AssetFilter(ProxyResource): +class AssetFilter(Resource): """An Asset Filter. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. + :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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :param presentation_time_range: The presentation time range. - :type presentation_time_range: - ~azure.mgmt.media.models.PresentationTimeRange + :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. @@ -522,36 +640,68 @@ class AssetFilter(ProxyResource): 'tracks': {'key': 'properties.tracks', 'type': '[FilterTrackSelection]'}, } - def __init__(self, *, presentation_time_range=None, first_quality=None, tracks=None, **kwargs) -> None: + def __init__( + self, + *, + presentation_time_range: Optional["PresentationTimeRange"] = None, + first_quality: Optional["FirstQuality"] = None, + tracks: Optional[List["FilterTrackSelection"]] = None, + **kwargs + ): super(AssetFilter, self).__init__(**kwargs) self.presentation_time_range = presentation_time_range self.first_quality = first_quality self.tracks = tracks -class AssetStreamingLocator(Model): +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, + *, + value: Optional[List["AssetFilter"]] = None, + odata_next_link: Optional[str] = None, + **kwargs + ): + super(AssetFilterCollection, self).__init__(**kwargs) + self.value = value + self.odata_next_link = odata_next_link + + +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. + 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 + :vartype created: ~datetime.datetime :ivar start_time: The start time of the Streaming Locator. - :vartype start_time: datetime + :vartype start_time: ~datetime.datetime :ivar end_time: The end time of the Streaming Locator. - :vartype end_time: datetime + :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. + :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. + :ivar default_content_key_policy_name: Name of the default ContentKeyPolicy used by this + Streaming Locator. :vartype default_content_key_policy_name: str """ @@ -577,7 +727,10 @@ class AssetStreamingLocator(Model): 'default_content_key_policy_name': {'key': 'defaultContentKeyPolicyName', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(AssetStreamingLocator, self).__init__(**kwargs) self.name = None self.asset_name = None @@ -589,157 +742,176 @@ def __init__(self, **kwargs) -> None: self.default_content_key_policy_name = None -class Preset(Model): - """Base type for all Presets, which define the recipe or instructions on how - the input media files should be processed. +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: FaceDetectorPreset, AudioAnalyzerPreset, - BuiltInStandardEncoderPreset, StandardEncoderPreset + sub-classes are: AudioAnalyzerPreset, BuiltInStandardEncoderPreset, FaceDetectorPreset, StandardEncoderPreset. All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str + :param odata_type: Required. The discriminator for derived types.Constant filled by server. + :type odata_type: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, } _subtype_map = { - 'odatatype': {'#Microsoft.Media.FaceDetectorPreset': 'FaceDetectorPreset', '#Microsoft.Media.AudioAnalyzerPreset': 'AudioAnalyzerPreset', '#Microsoft.Media.BuiltInStandardEncoderPreset': 'BuiltInStandardEncoderPreset', '#Microsoft.Media.StandardEncoderPreset': 'StandardEncoderPreset'} + 'odata_type': {'#Microsoft.Media.AudioAnalyzerPreset': 'AudioAnalyzerPreset', '#Microsoft.Media.BuiltInStandardEncoderPreset': 'BuiltInStandardEncoderPreset', '#Microsoft.Media.FaceDetectorPreset': 'FaceDetectorPreset', '#Microsoft.Media.StandardEncoderPreset': 'StandardEncoderPreset'} } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(Preset, self).__init__(**kwargs) - self.odatatype = None + 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. + """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 + sub-classes are: VideoAnalyzerPreset. All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: 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. - 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 + :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 experimental_options: Dictionary containing key value pairs for - parameters not exposed in the preset itself + :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 = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + '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 = { - 'odatatype': {'#Microsoft.Media.VideoAnalyzerPreset': 'VideoAnalyzerPreset'} + 'odata_type': {'#Microsoft.Media.VideoAnalyzerPreset': 'VideoAnalyzerPreset'} } - def __init__(self, *, audio_language: str=None, experimental_options=None, **kwargs) -> None: + def __init__( + self, + *, + audio_language: Optional[str] = None, + mode: Optional[Union[str, "AudioAnalysisMode"]] = None, + experimental_options: Optional[Dict[str, str]] = None, + **kwargs + ): super(AudioAnalyzerPreset, self).__init__(**kwargs) + self.odata_type = '#Microsoft.Media.AudioAnalyzerPreset' # type: str self.audio_language = audio_language + self.mode = mode self.experimental_options = experimental_options - self.odatatype = '#Microsoft.Media.AudioAnalyzerPreset' -class Overlay(Model): +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 + sub-classes are: AudioOverlay, VideoOverlay. All required parameters must be populated in order to send to Azure. - :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 or PNG formats, 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. + :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 or PNG formats, 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 in to the input video. If - not specified the overlay starts from the beginning of the input video. - :type start: timedelta - :param end: The position in the input video at which the overlay ends. The - value should be in ISO 8601 duration format. For example, PT30S to end the - overlay at 30 seconds in to the input video. If not specified the overlay - will be applied until the end of the input video if inputLoop is true. - Else, if inputLoop is false, then overlay will last as long as the - duration of the overlay media. - :type end: 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: 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: 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. + :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 odatatype: Required. Constant filled by server. - :type odatatype: str """ _validation = { + 'odata_type': {'required': True}, 'input_label': {'required': True}, - 'odatatype': {'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'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, } _subtype_map = { - 'odatatype': {'#Microsoft.Media.AudioOverlay': 'AudioOverlay', '#Microsoft.Media.VideoOverlay': 'VideoOverlay'} - } - - def __init__(self, *, input_label: str, start=None, end=None, fade_in_duration=None, fade_out_duration=None, audio_gain_level: float=None, **kwargs) -> None: + 'odata_type': {'#Microsoft.Media.AudioOverlay': 'AudioOverlay', '#Microsoft.Media.VideoOverlay': 'VideoOverlay'} + } + + def __init__( + self, + *, + input_label: str, + start: Optional[datetime.timedelta] = None, + end: Optional[datetime.timedelta] = None, + fade_in_duration: Optional[datetime.timedelta] = None, + fade_out_duration: Optional[datetime.timedelta] = None, + audio_gain_level: Optional[float] = None, + **kwargs + ): super(Overlay, self).__init__(**kwargs) + self.odata_type = None # type: Optional[str] self.input_label = input_label self.start = start self.end = end self.fade_in_duration = fade_in_duration self.fade_out_duration = fade_out_duration self.audio_gain_level = audio_gain_level - self.odatatype = None class AudioOverlay(Overlay): @@ -747,105 +919,113 @@ class AudioOverlay(Overlay): All required parameters must be populated in order to send to Azure. - :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 or PNG formats, 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. + :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 or PNG formats, 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 in to the input video. If - not specified the overlay starts from the beginning of the input video. - :type start: timedelta - :param end: The position in the input video at which the overlay ends. The - value should be in ISO 8601 duration format. For example, PT30S to end the - overlay at 30 seconds in to the input video. If not specified the overlay - will be applied until the end of the input video if inputLoop is true. - Else, if inputLoop is false, then overlay will last as long as the - duration of the overlay media. - :type end: 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: 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: 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. + :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 odatatype: Required. Constant filled by server. - :type odatatype: str """ _validation = { + 'odata_type': {'required': True}, 'input_label': {'required': True}, - 'odatatype': {'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'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, } - def __init__(self, *, input_label: str, start=None, end=None, fade_in_duration=None, fade_out_duration=None, audio_gain_level: float=None, **kwargs) -> None: + def __init__( + self, + *, + input_label: str, + start: Optional[datetime.timedelta] = None, + end: Optional[datetime.timedelta] = None, + fade_in_duration: Optional[datetime.timedelta] = None, + fade_out_duration: Optional[datetime.timedelta] = None, + audio_gain_level: Optional[float] = None, + **kwargs + ): 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.odatatype = '#Microsoft.Media.AudioOverlay' + self.odata_type = '#Microsoft.Media.AudioOverlay' # type: str class BuiltInStandardEncoderPreset(Preset): - """Describes a built-in preset for encoding the input video with the Standard - Encoder. + """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 odatatype: Required. Constant filled by server. - :type odatatype: str - :param preset_name: Required. The built-in preset to be used for encoding - videos. Possible values include: 'H264SingleBitrateSD', - 'H264SingleBitrate720p', 'H264SingleBitrate1080p', 'AdaptiveStreaming', - 'AACGoodQualityAudio', 'ContentAwareEncodingExperimental', - 'ContentAwareEncoding', 'H264MultipleBitrate1080p', - 'H264MultipleBitrate720p', 'H264MultipleBitrateSD' + :param odata_type: Required. The discriminator for derived types.Constant filled by server. + :type odata_type: str + :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". :type preset_name: str or ~azure.mgmt.media.models.EncoderNamedPreset """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, 'preset_name': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'preset_name': {'key': 'presetName', 'type': 'str'}, } - def __init__(self, *, preset_name, **kwargs) -> None: + def __init__( + self, + *, + preset_name: Union[str, "EncoderNamedPreset"], + **kwargs + ): super(BuiltInStandardEncoderPreset, self).__init__(**kwargs) + self.odata_type = '#Microsoft.Media.BuiltInStandardEncoderPreset' # type: str self.preset_name = preset_name - self.odatatype = '#Microsoft.Media.BuiltInStandardEncoderPreset' -class CbcsDrmConfiguration(Model): - """Class to specify DRM configurations of CommonEncryptionCbcs scheme in - Streaming Policy. +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 + :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 = { @@ -854,23 +1034,27 @@ class CbcsDrmConfiguration(Model): 'widevine': {'key': 'widevine', 'type': 'StreamingPolicyWidevineConfiguration'}, } - def __init__(self, *, fair_play=None, play_ready=None, widevine=None, **kwargs) -> None: + def __init__( + self, + *, + fair_play: Optional["StreamingPolicyFairPlayConfiguration"] = None, + play_ready: Optional["StreamingPolicyPlayReadyConfiguration"] = None, + widevine: Optional["StreamingPolicyWidevineConfiguration"] = None, + **kwargs + ): super(CbcsDrmConfiguration, self).__init__(**kwargs) self.fair_play = fair_play self.play_ready = play_ready self.widevine = widevine -class CencDrmConfiguration(Model): - """Class to specify DRM configurations of CommonEncryptionCenc scheme in - Streaming Policy. +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 + :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 = { @@ -878,19 +1062,24 @@ class CencDrmConfiguration(Model): 'widevine': {'key': 'widevine', 'type': 'StreamingPolicyWidevineConfiguration'}, } - def __init__(self, *, play_ready=None, widevine=None, **kwargs) -> None: + def __init__( + self, + *, + play_ready: Optional["StreamingPolicyPlayReadyConfiguration"] = None, + widevine: Optional["StreamingPolicyWidevineConfiguration"] = None, + **kwargs + ): super(CencDrmConfiguration, self).__init__(**kwargs) self.play_ready = play_ready self.widevine = widevine -class CheckNameAvailabilityInput(Model): +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'. + :param type: The account type. For a Media Services account, this should be 'MediaServices'. :type type: str """ @@ -899,31 +1088,29 @@ class CheckNameAvailabilityInput(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, name: str=None, type: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[str] = None, + **kwargs + ): super(CheckNameAvailabilityInput, self).__init__(**kwargs) self.name = name self.type = type -class CloudError(Model): - """CloudError. - """ - - _attribute_map = { - } - - -class CommonEncryptionCbcs(Model): +class CommonEncryptionCbcs(msrest.serialization.Model): """Class for CommonEncryptionCbcs encryption scheme. - :param enabled_protocols: Representing supported protocols + :param enabled_protocols: Representing supported protocols. :type enabled_protocols: ~azure.mgmt.media.models.EnabledProtocols - :param clear_tracks: Representing which tracks should not be encrypted + :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 + :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 + :param drm: Configuration of DRMs for current encryption scheme. :type drm: ~azure.mgmt.media.models.CbcsDrmConfiguration """ @@ -934,7 +1121,15 @@ class CommonEncryptionCbcs(Model): 'drm': {'key': 'drm', 'type': 'CbcsDrmConfiguration'}, } - def __init__(self, *, enabled_protocols=None, clear_tracks=None, content_keys=None, drm=None, **kwargs) -> None: + def __init__( + self, + *, + enabled_protocols: Optional["EnabledProtocols"] = None, + clear_tracks: Optional[List["TrackSelection"]] = None, + content_keys: Optional["StreamingPolicyContentKeys"] = None, + drm: Optional["CbcsDrmConfiguration"] = None, + **kwargs + ): super(CommonEncryptionCbcs, self).__init__(**kwargs) self.enabled_protocols = enabled_protocols self.clear_tracks = clear_tracks @@ -942,18 +1137,17 @@ def __init__(self, *, enabled_protocols=None, clear_tracks=None, content_keys=No self.drm = drm -class CommonEncryptionCenc(Model): +class CommonEncryptionCenc(msrest.serialization.Model): """Class for envelope encryption scheme. - :param enabled_protocols: Representing supported protocols + :param enabled_protocols: Representing supported protocols. :type enabled_protocols: ~azure.mgmt.media.models.EnabledProtocols - :param clear_tracks: Representing which tracks should not be encrypted + :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 + :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 + :param drm: Configuration of DRMs for CommonEncryptionCenc encryption scheme. :type drm: ~azure.mgmt.media.models.CencDrmConfiguration """ @@ -964,7 +1158,15 @@ class CommonEncryptionCenc(Model): 'drm': {'key': 'drm', 'type': 'CencDrmConfiguration'}, } - def __init__(self, *, enabled_protocols=None, clear_tracks=None, content_keys=None, drm=None, **kwargs) -> None: + def __init__( + self, + *, + enabled_protocols: Optional["EnabledProtocols"] = None, + clear_tracks: Optional[List["TrackSelection"]] = None, + content_keys: Optional["StreamingPolicyContentKeys"] = None, + drm: Optional["CencDrmConfiguration"] = None, + **kwargs + ): super(CommonEncryptionCenc, self).__init__(**kwargs) self.enabled_protocols = enabled_protocols self.clear_tracks = clear_tracks @@ -972,29 +1174,28 @@ def __init__(self, *, enabled_protocols=None, clear_tracks=None, content_keys=No self.drm = drm -class ContentKeyPolicy(ProxyResource): +class ContentKeyPolicy(Resource): """A Content Key Policy resource. - 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. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. + :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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar policy_id: The legacy Policy ID. :vartype policy_id: str - :ivar created: The creation date of the Policy - :vartype created: datetime - :ivar last_modified: The last modified date of the Policy - :vartype last_modified: datetime + :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. + :param options: The Key Policy options. :type options: list[~azure.mgmt.media.models.ContentKeyPolicyOption] """ @@ -1005,7 +1206,6 @@ class ContentKeyPolicy(ProxyResource): 'policy_id': {'readonly': True}, 'created': {'readonly': True}, 'last_modified': {'readonly': True}, - 'options': {'required': True}, } _attribute_map = { @@ -1019,7 +1219,13 @@ class ContentKeyPolicy(ProxyResource): 'options': {'key': 'properties.options', 'type': '[ContentKeyPolicyOption]'}, } - def __init__(self, *, options, description: str=None, **kwargs) -> None: + def __init__( + self, + *, + description: Optional[str] = None, + options: Optional[List["ContentKeyPolicyOption"]] = None, + **kwargs + ): super(ContentKeyPolicy, self).__init__(**kwargs) self.policy_id = None self.created = None @@ -1028,38 +1234,36 @@ def __init__(self, *, options, description: str=None, **kwargs) -> None: self.options = options -class ContentKeyPolicyConfiguration(Model): - """Base class for Content Key Policy configuration. A derived class must be - used to create a configuration. +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, - ContentKeyPolicyUnknownConfiguration, - ContentKeyPolicyWidevineConfiguration, - ContentKeyPolicyPlayReadyConfiguration, - ContentKeyPolicyFairPlayConfiguration + sub-classes are: ContentKeyPolicyClearKeyConfiguration, ContentKeyPolicyFairPlayConfiguration, ContentKeyPolicyPlayReadyConfiguration, ContentKeyPolicyUnknownConfiguration, ContentKeyPolicyWidevineConfiguration. All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str + :param odata_type: Required. The discriminator for derived types.Constant filled by server. + :type odata_type: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, } _subtype_map = { - 'odatatype': {'#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration': 'ContentKeyPolicyClearKeyConfiguration', '#Microsoft.Media.ContentKeyPolicyUnknownConfiguration': 'ContentKeyPolicyUnknownConfiguration', '#Microsoft.Media.ContentKeyPolicyWidevineConfiguration': 'ContentKeyPolicyWidevineConfiguration', '#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration': 'ContentKeyPolicyPlayReadyConfiguration', '#Microsoft.Media.ContentKeyPolicyFairPlayConfiguration': 'ContentKeyPolicyFairPlayConfiguration'} + '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) -> None: + def __init__( + self, + **kwargs + ): super(ContentKeyPolicyConfiguration, self).__init__(**kwargs) - self.odatatype = None + self.odata_type = None # type: Optional[str] class ContentKeyPolicyClearKeyConfiguration(ContentKeyPolicyConfiguration): @@ -1067,21 +1271,51 @@ class ContentKeyPolicyClearKeyConfiguration(ContentKeyPolicyConfiguration): All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str + :param odata_type: Required. The discriminator for derived types.Constant filled by server. + :type odata_type: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ContentKeyPolicyClearKeyConfiguration, self).__init__(**kwargs) - self.odatatype = '#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration' + 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, + *, + value: Optional[List["ContentKeyPolicy"]] = None, + odata_next_link: Optional[str] = None, + **kwargs + ): + super(ContentKeyPolicyCollection, self).__init__(**kwargs) + self.value = value + self.odata_next_link = odata_next_link class ContentKeyPolicyFairPlayConfiguration(ContentKeyPolicyConfiguration): @@ -1089,32 +1323,29 @@ class ContentKeyPolicyFairPlayConfiguration(ContentKeyPolicyConfiguration): All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str - :param ask: Required. The key that must be used as FairPlay Application - Secret key. + :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. + :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). + :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' + :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. + :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 + :param offline_rental_configuration: Offline rental policy. :type offline_rental_configuration: ~azure.mgmt.media.models.ContentKeyPolicyFairPlayOfflineRentalConfiguration """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, 'ask': {'required': True}, 'fair_play_pfx_password': {'required': True}, 'fair_play_pfx': {'required': True}, @@ -1123,7 +1354,7 @@ class ContentKeyPolicyFairPlayConfiguration(ContentKeyPolicyConfiguration): } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + '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'}, @@ -1132,25 +1363,35 @@ class ContentKeyPolicyFairPlayConfiguration(ContentKeyPolicyConfiguration): 'offline_rental_configuration': {'key': 'offlineRentalConfiguration', 'type': 'ContentKeyPolicyFairPlayOfflineRentalConfiguration'}, } - def __init__(self, *, ask: bytearray, fair_play_pfx_password: str, fair_play_pfx: str, rental_and_lease_key_type, rental_duration: int, offline_rental_configuration=None, **kwargs) -> None: + def __init__( + self, + *, + ask: bytearray, + fair_play_pfx_password: str, + fair_play_pfx: str, + rental_and_lease_key_type: Union[str, "ContentKeyPolicyFairPlayRentalAndLeaseKeyType"], + rental_duration: int, + offline_rental_configuration: Optional["ContentKeyPolicyFairPlayOfflineRentalConfiguration"] = None, + **kwargs + ): super(ContentKeyPolicyFairPlayConfiguration, self).__init__(**kwargs) + self.odata_type = '#Microsoft.Media.ContentKeyPolicyFairPlayConfiguration' # type: str self.ask = ask self.fair_play_pfx_password = fair_play_pfx_password self.fair_play_pfx = fair_play_pfx self.rental_and_lease_key_type = rental_and_lease_key_type self.rental_duration = rental_duration self.offline_rental_configuration = offline_rental_configuration - self.odatatype = '#Microsoft.Media.ContentKeyPolicyFairPlayConfiguration' -class ContentKeyPolicyFairPlayOfflineRentalConfiguration(Model): +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 + :param playback_duration_seconds: Required. Playback duration. :type playback_duration_seconds: long - :param storage_duration_seconds: Required. Storage duration + :param storage_duration_seconds: Required. Storage duration. :type storage_duration_seconds: long """ @@ -1164,71 +1405,79 @@ class ContentKeyPolicyFairPlayOfflineRentalConfiguration(Model): 'storage_duration_seconds': {'key': 'storageDurationSeconds', 'type': 'long'}, } - def __init__(self, *, playback_duration_seconds: int, storage_duration_seconds: int, **kwargs) -> None: + def __init__( + self, + *, + playback_duration_seconds: int, + storage_duration_seconds: int, + **kwargs + ): super(ContentKeyPolicyFairPlayOfflineRentalConfiguration, self).__init__(**kwargs) self.playback_duration_seconds = playback_duration_seconds self.storage_duration_seconds = storage_duration_seconds -class ContentKeyPolicyRestriction(Model): - """Base class for Content Key Policy restrictions. A derived class must be - used to create a restriction. +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, - ContentKeyPolicyUnknownRestriction, ContentKeyPolicyTokenRestriction + sub-classes are: ContentKeyPolicyOpenRestriction, ContentKeyPolicyTokenRestriction, ContentKeyPolicyUnknownRestriction. All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str + :param odata_type: Required. The discriminator for derived types.Constant filled by server. + :type odata_type: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, } _subtype_map = { - 'odatatype': {'#Microsoft.Media.ContentKeyPolicyOpenRestriction': 'ContentKeyPolicyOpenRestriction', '#Microsoft.Media.ContentKeyPolicyUnknownRestriction': 'ContentKeyPolicyUnknownRestriction', '#Microsoft.Media.ContentKeyPolicyTokenRestriction': 'ContentKeyPolicyTokenRestriction'} + 'odata_type': {'#Microsoft.Media.ContentKeyPolicyOpenRestriction': 'ContentKeyPolicyOpenRestriction', '#Microsoft.Media.ContentKeyPolicyTokenRestriction': 'ContentKeyPolicyTokenRestriction', '#Microsoft.Media.ContentKeyPolicyUnknownRestriction': 'ContentKeyPolicyUnknownRestriction'} } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ContentKeyPolicyRestriction, self).__init__(**kwargs) - self.odatatype = None + self.odata_type = None # type: Optional[str] class ContentKeyPolicyOpenRestriction(ContentKeyPolicyRestriction): - """Represents an open restriction. License or key will be delivered on every - request. + """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 odatatype: Required. Constant filled by server. - :type odatatype: str + :param odata_type: Required. The discriminator for derived types.Constant filled by server. + :type odata_type: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ContentKeyPolicyOpenRestriction, self).__init__(**kwargs) - self.odatatype = '#Microsoft.Media.ContentKeyPolicyOpenRestriction' + self.odata_type = '#Microsoft.Media.ContentKeyPolicyOpenRestriction' # type: str -class ContentKeyPolicyOption(Model): +class ContentKeyPolicyOption(msrest.serialization.Model): """Represents a policy option. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. @@ -1237,10 +1486,9 @@ class ContentKeyPolicyOption(Model): :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 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 """ @@ -1257,7 +1505,14 @@ class ContentKeyPolicyOption(Model): 'restriction': {'key': 'restriction', 'type': 'ContentKeyPolicyRestriction'}, } - def __init__(self, *, configuration, restriction, name: str=None, **kwargs) -> None: + def __init__( + self, + *, + configuration: "ContentKeyPolicyConfiguration", + restriction: "ContentKeyPolicyRestriction", + name: Optional[str] = None, + **kwargs + ): super(ContentKeyPolicyOption, self).__init__(**kwargs) self.policy_option_id = None self.name = name @@ -1270,62 +1525,68 @@ class ContentKeyPolicyPlayReadyConfiguration(ContentKeyPolicyConfiguration): All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str + :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] + :type licenses: list[~azure.mgmt.media.models.ContentKeyPolicyPlayReadyLicense] :param response_custom_data: The custom response data. :type response_custom_data: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, 'licenses': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'licenses': {'key': 'licenses', 'type': '[ContentKeyPolicyPlayReadyLicense]'}, 'response_custom_data': {'key': 'responseCustomData', 'type': 'str'}, } - def __init__(self, *, licenses, response_custom_data: str=None, **kwargs) -> None: + def __init__( + self, + *, + licenses: List["ContentKeyPolicyPlayReadyLicense"], + response_custom_data: Optional[str] = None, + **kwargs + ): super(ContentKeyPolicyPlayReadyConfiguration, self).__init__(**kwargs) + self.odata_type = '#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration' # type: str self.licenses = licenses self.response_custom_data = response_custom_data - self.odatatype = '#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration' -class ContentKeyPolicyPlayReadyContentKeyLocation(Model): - """Base class for content key ID location. A derived class must be used to - represent the location. +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 + sub-classes are: ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader, ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier. All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str + :param odata_type: Required. The discriminator for derived types.Constant filled by server. + :type odata_type: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, } _subtype_map = { - 'odatatype': {'#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader': 'ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader', '#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier': 'ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier'} + 'odata_type': {'#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader': 'ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader', '#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier': 'ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier'} } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ContentKeyPolicyPlayReadyContentKeyLocation, self).__init__(**kwargs) - self.odatatype = None + self.odata_type = None # type: Optional[str] class ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader(ContentKeyPolicyPlayReadyContentKeyLocation): @@ -1333,62 +1594,68 @@ class ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader(ContentKeyPolicyPl All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str + :param odata_type: Required. The discriminator for derived types.Constant filled by server. + :type odata_type: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader, self).__init__(**kwargs) - self.odatatype = '#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader' + self.odata_type = '#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader' # type: str class ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier(ContentKeyPolicyPlayReadyContentKeyLocation): - """Specifies that the content key ID is specified in the PlayReady - configuration. + """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 odatatype: Required. Constant filled by server. - :type odatatype: str + :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 = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, 'key_id': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'key_id': {'key': 'keyId', 'type': 'str'}, } - def __init__(self, *, key_id: str, **kwargs) -> None: + def __init__( + self, + *, + key_id: str, + **kwargs + ): super(ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier, self).__init__(**kwargs) + self.odata_type = '#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier' # type: str self.key_id = key_id - self.odatatype = '#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier' -class ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction(Model): - """Configures the Explicit Analog Television Output Restriction control bits. - For further details see the PlayReady Compliance Rules. +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. + :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. + :param configuration_data: Required. Configures the restriction control bits. Must be between 0 + and 3 inclusive. :type configuration_data: int """ @@ -1402,45 +1669,47 @@ class ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction(Model): 'configuration_data': {'key': 'configurationData', 'type': 'int'}, } - def __init__(self, *, best_effort: bool, configuration_data: int, **kwargs) -> None: + def __init__( + self, + *, + best_effort: bool, + configuration_data: int, + **kwargs + ): super(ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction, self).__init__(**kwargs) self.best_effort = best_effort self.configuration_data = configuration_data -class ContentKeyPolicyPlayReadyLicense(Model): +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. + :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 + :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 + :type expiration_date: ~datetime.datetime :param relative_begin_date: The relative begin date of license. - :type relative_begin_date: timedelta + :type relative_begin_date: ~datetime.timedelta :param relative_expiration_date: The relative expiration date of license. - :type relative_expiration_date: timedelta + :type relative_expiration_date: ~datetime.timedelta :param grace_period: The grace period of license. - :type grace_period: 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 + :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 + :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 = { @@ -1463,7 +1732,21 @@ class ContentKeyPolicyPlayReadyLicense(Model): 'content_type': {'key': 'contentType', 'type': 'str'}, } - def __init__(self, *, allow_test_devices: bool, license_type, content_key_location, content_type, begin_date=None, expiration_date=None, relative_begin_date=None, relative_expiration_date=None, grace_period=None, play_right=None, **kwargs) -> None: + def __init__( + self, + *, + allow_test_devices: bool, + license_type: Union[str, "ContentKeyPolicyPlayReadyLicenseType"], + content_key_location: "ContentKeyPolicyPlayReadyContentKeyLocation", + content_type: Union[str, "ContentKeyPolicyPlayReadyContentType"], + begin_date: Optional[datetime.datetime] = None, + expiration_date: Optional[datetime.datetime] = None, + relative_begin_date: Optional[datetime.timedelta] = None, + relative_expiration_date: Optional[datetime.timedelta] = None, + grace_period: Optional[datetime.timedelta] = None, + play_right: Optional["ContentKeyPolicyPlayReadyPlayRight"] = None, + **kwargs + ): super(ContentKeyPolicyPlayReadyLicense, self).__init__(**kwargs) self.allow_test_devices = allow_test_devices self.begin_date = begin_date @@ -1477,55 +1760,51 @@ def __init__(self, *, allow_test_devices: bool, license_type, content_key_locati self.content_type = content_type -class ContentKeyPolicyPlayReadyPlayRight(Model): +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: timedelta - :param scms_restriction: Configures the Serial Copy Management System - (SCMS) in the license. Must be between 0 and 3 inclusive. + :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. + :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. + :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. + :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. + :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. + :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' + :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. + :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. + :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. + :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. + :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. + :param uncompressed_digital_audio_opl: Specifies the output protection level for uncompressed + digital audio. :type uncompressed_digital_audio_opl: int """ @@ -1552,7 +1831,24 @@ class ContentKeyPolicyPlayReadyPlayRight(Model): 'uncompressed_digital_audio_opl': {'key': 'uncompressedDigitalAudioOpl', 'type': 'int'}, } - def __init__(self, *, digital_video_only_content_restriction: bool, image_constraint_for_analog_component_video_restriction: bool, image_constraint_for_analog_computer_monitor_restriction: bool, allow_passing_video_content_to_unknown_output, first_play_expiration=None, scms_restriction: int=None, agc_and_color_stripe_restriction: int=None, explicit_analog_television_output_restriction=None, uncompressed_digital_video_opl: int=None, compressed_digital_video_opl: int=None, analog_video_opl: int=None, compressed_digital_audio_opl: int=None, uncompressed_digital_audio_opl: int=None, **kwargs) -> None: + def __init__( + self, + *, + digital_video_only_content_restriction: bool, + image_constraint_for_analog_component_video_restriction: bool, + image_constraint_for_analog_computer_monitor_restriction: bool, + allow_passing_video_content_to_unknown_output: Union[str, "ContentKeyPolicyPlayReadyUnknownOutputPassingOption"], + first_play_expiration: Optional[datetime.timedelta] = None, + scms_restriction: Optional[int] = None, + agc_and_color_stripe_restriction: Optional[int] = None, + explicit_analog_television_output_restriction: Optional["ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction"] = None, + uncompressed_digital_video_opl: Optional[int] = None, + compressed_digital_video_opl: Optional[int] = None, + analog_video_opl: Optional[int] = None, + compressed_digital_audio_opl: Optional[int] = None, + uncompressed_digital_audio_opl: Optional[int] = None, + **kwargs + ): super(ContentKeyPolicyPlayReadyPlayRight, self).__init__(**kwargs) self.first_play_expiration = first_play_expiration self.scms_restriction = scms_restriction @@ -1569,20 +1865,19 @@ def __init__(self, *, digital_video_only_content_restriction: bool, image_constr self.uncompressed_digital_audio_opl = uncompressed_digital_audio_opl -class ContentKeyPolicyProperties(Model): +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. + 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 - :ivar last_modified: The last modified date of the Policy - :vartype last_modified: datetime + :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. @@ -1604,7 +1899,13 @@ class ContentKeyPolicyProperties(Model): 'options': {'key': 'options', 'type': '[ContentKeyPolicyOption]'}, } - def __init__(self, *, options, description: str=None, **kwargs) -> None: + def __init__( + self, + *, + options: List["ContentKeyPolicyOption"], + description: Optional[str] = None, + **kwargs + ): super(ContentKeyPolicyProperties, self).__init__(**kwargs) self.policy_id = None self.created = None @@ -1613,35 +1914,36 @@ def __init__(self, *, options, description: str=None, **kwargs) -> None: self.options = options -class ContentKeyPolicyRestrictionTokenKey(Model): - """Base class for Content Key Policy key for token validation. A derived class - must be used to create a token key. +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: ContentKeyPolicySymmetricTokenKey, - ContentKeyPolicyRsaTokenKey, ContentKeyPolicyX509CertificateTokenKey + sub-classes are: ContentKeyPolicyRsaTokenKey, ContentKeyPolicySymmetricTokenKey, ContentKeyPolicyX509CertificateTokenKey. All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str + :param odata_type: Required. The discriminator for derived types.Constant filled by server. + :type odata_type: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, } _subtype_map = { - 'odatatype': {'#Microsoft.Media.ContentKeyPolicySymmetricTokenKey': 'ContentKeyPolicySymmetricTokenKey', '#Microsoft.Media.ContentKeyPolicyRsaTokenKey': 'ContentKeyPolicyRsaTokenKey', '#Microsoft.Media.ContentKeyPolicyX509CertificateTokenKey': 'ContentKeyPolicyX509CertificateTokenKey'} + 'odata_type': {'#Microsoft.Media.ContentKeyPolicyRsaTokenKey': 'ContentKeyPolicyRsaTokenKey', '#Microsoft.Media.ContentKeyPolicySymmetricTokenKey': 'ContentKeyPolicySymmetricTokenKey', '#Microsoft.Media.ContentKeyPolicyX509CertificateTokenKey': 'ContentKeyPolicyX509CertificateTokenKey'} } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ContentKeyPolicyRestrictionTokenKey, self).__init__(**kwargs) - self.odatatype = None + self.odata_type = None # type: Optional[str] class ContentKeyPolicyRsaTokenKey(ContentKeyPolicyRestrictionTokenKey): @@ -1649,31 +1951,37 @@ class ContentKeyPolicyRsaTokenKey(ContentKeyPolicyRestrictionTokenKey): All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str - :param exponent: Required. The RSA Parameter exponent + :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 + :param modulus: Required. The RSA Parameter modulus. :type modulus: bytearray """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, 'exponent': {'required': True}, 'modulus': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'exponent': {'key': 'exponent', 'type': 'bytearray'}, 'modulus': {'key': 'modulus', 'type': 'bytearray'}, } - def __init__(self, *, exponent: bytearray, modulus: bytearray, **kwargs) -> None: + def __init__( + self, + *, + exponent: bytearray, + modulus: bytearray, + **kwargs + ): super(ContentKeyPolicyRsaTokenKey, self).__init__(**kwargs) + self.odata_type = '#Microsoft.Media.ContentKeyPolicyRsaTokenKey' # type: str self.exponent = exponent self.modulus = modulus - self.odatatype = '#Microsoft.Media.ContentKeyPolicyRsaTokenKey' class ContentKeyPolicySymmetricTokenKey(ContentKeyPolicyRestrictionTokenKey): @@ -1681,29 +1989,34 @@ class ContentKeyPolicySymmetricTokenKey(ContentKeyPolicyRestrictionTokenKey): All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str - :param key_value: Required. The key value of the key + :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 = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, 'key_value': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'key_value': {'key': 'keyValue', 'type': 'bytearray'}, } - def __init__(self, *, key_value: bytearray, **kwargs) -> None: + def __init__( + self, + *, + key_value: bytearray, + **kwargs + ): super(ContentKeyPolicySymmetricTokenKey, self).__init__(**kwargs) + self.odata_type = '#Microsoft.Media.ContentKeyPolicySymmetricTokenKey' # type: str self.key_value = key_value - self.odatatype = '#Microsoft.Media.ContentKeyPolicySymmetricTokenKey' -class ContentKeyPolicyTokenClaim(Model): +class ContentKeyPolicyTokenClaim(msrest.serialization.Model): """Represents a token claim. :param claim_type: Token claim type. @@ -1717,45 +2030,46 @@ class ContentKeyPolicyTokenClaim(Model): 'claim_value': {'key': 'claimValue', 'type': 'str'}, } - def __init__(self, *, claim_type: str=None, claim_value: str=None, **kwargs) -> None: + def __init__( + self, + *, + claim_type: Optional[str] = None, + claim_value: Optional[str] = None, + **kwargs + ): super(ContentKeyPolicyTokenClaim, self).__init__(**kwargs) self.claim_type = claim_type self.claim_value = claim_value class ContentKeyPolicyTokenRestriction(ContentKeyPolicyRestriction): - """Represents a token restriction. Provided token must match these - requirements for successful license or key delivery. + """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 odatatype: Required. Constant filled by server. - :type odatatype: str + :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 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 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. + :param open_id_connect_discovery_document: The OpenID connect discovery document. :type open_id_connect_discovery_document: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, 'issuer': {'required': True}, 'audience': {'required': True}, 'primary_verification_key': {'required': True}, @@ -1763,7 +2077,7 @@ class ContentKeyPolicyTokenRestriction(ContentKeyPolicyRestriction): } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'issuer': {'key': 'issuer', 'type': 'str'}, 'audience': {'key': 'audience', 'type': 'str'}, 'primary_verification_key': {'key': 'primaryVerificationKey', 'type': 'ContentKeyPolicyRestrictionTokenKey'}, @@ -1773,8 +2087,20 @@ class ContentKeyPolicyTokenRestriction(ContentKeyPolicyRestriction): 'open_id_connect_discovery_document': {'key': 'openIdConnectDiscoveryDocument', 'type': 'str'}, } - def __init__(self, *, issuer: str, audience: str, primary_verification_key, restriction_token_type, alternate_verification_keys=None, required_claims=None, open_id_connect_discovery_document: str=None, **kwargs) -> None: + def __init__( + self, + *, + issuer: str, + audience: str, + primary_verification_key: "ContentKeyPolicyRestrictionTokenKey", + restriction_token_type: Union[str, "ContentKeyPolicyRestrictionTokenType"], + alternate_verification_keys: Optional[List["ContentKeyPolicyRestrictionTokenKey"]] = None, + required_claims: Optional[List["ContentKeyPolicyTokenClaim"]] = None, + open_id_connect_discovery_document: Optional[str] = None, + **kwargs + ): super(ContentKeyPolicyTokenRestriction, self).__init__(**kwargs) + self.odata_type = '#Microsoft.Media.ContentKeyPolicyTokenRestriction' # type: str self.issuer = issuer self.audience = audience self.primary_verification_key = primary_verification_key @@ -1782,53 +2108,56 @@ def __init__(self, *, issuer: str, audience: str, primary_verification_key, rest self.required_claims = required_claims self.restriction_token_type = restriction_token_type self.open_id_connect_discovery_document = open_id_connect_discovery_document - self.odatatype = '#Microsoft.Media.ContentKeyPolicyTokenRestriction' class ContentKeyPolicyUnknownConfiguration(ContentKeyPolicyConfiguration): - """Represents a ContentKeyPolicyConfiguration that is unavailable in the - current API version. + """Represents a ContentKeyPolicyConfiguration that is unavailable in the current API version. All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str + :param odata_type: Required. The discriminator for derived types.Constant filled by server. + :type odata_type: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ContentKeyPolicyUnknownConfiguration, self).__init__(**kwargs) - self.odatatype = '#Microsoft.Media.ContentKeyPolicyUnknownConfiguration' + self.odata_type = '#Microsoft.Media.ContentKeyPolicyUnknownConfiguration' # type: str class ContentKeyPolicyUnknownRestriction(ContentKeyPolicyRestriction): - """Represents a ContentKeyPolicyRestriction that is unavailable in the current - API version. + """Represents a ContentKeyPolicyRestriction that is unavailable in the current API version. All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str + :param odata_type: Required. The discriminator for derived types.Constant filled by server. + :type odata_type: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ContentKeyPolicyUnknownRestriction, self).__init__(**kwargs) - self.odatatype = '#Microsoft.Media.ContentKeyPolicyUnknownRestriction' + self.odata_type = '#Microsoft.Media.ContentKeyPolicyUnknownRestriction' # type: str class ContentKeyPolicyWidevineConfiguration(ContentKeyPolicyConfiguration): @@ -1836,26 +2165,31 @@ class ContentKeyPolicyWidevineConfiguration(ContentKeyPolicyConfiguration): All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str + :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 = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, 'widevine_template': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'widevine_template': {'key': 'widevineTemplate', 'type': 'str'}, } - def __init__(self, *, widevine_template: str, **kwargs) -> None: + def __init__( + self, + *, + widevine_template: str, + **kwargs + ): super(ContentKeyPolicyWidevineConfiguration, self).__init__(**kwargs) + self.odata_type = '#Microsoft.Media.ContentKeyPolicyWidevineConfiguration' # type: str self.widevine_template = widevine_template - self.odatatype = '#Microsoft.Media.ContentKeyPolicyWidevineConfiguration' class ContentKeyPolicyX509CertificateTokenKey(ContentKeyPolicyRestrictionTokenKey): @@ -1863,27 +2197,32 @@ class ContentKeyPolicyX509CertificateTokenKey(ContentKeyPolicyRestrictionTokenKe All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str - :param raw_body: Required. The raw data field of a certificate in PKCS 12 - format (X509Certificate2 in .NET) + :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 = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, 'raw_body': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'raw_body': {'key': 'rawBody', 'type': 'bytearray'}, } - def __init__(self, *, raw_body: bytearray, **kwargs) -> None: + def __init__( + self, + *, + raw_body: bytearray, + **kwargs + ): super(ContentKeyPolicyX509CertificateTokenKey, self).__init__(**kwargs) + self.odata_type = '#Microsoft.Media.ContentKeyPolicyX509CertificateTokenKey' # type: str self.raw_body = raw_body - self.odatatype = '#Microsoft.Media.ContentKeyPolicyX509CertificateTokenKey' class CopyAudio(Codec): @@ -1891,62 +2230,69 @@ class CopyAudio(Codec): All required parameters must be populated in order to send to Azure. - :param label: An optional label for the codec. The label can be used to - control muxing behavior. + :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 odatatype: Required. Constant filled by server. - :type odatatype: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'label': {'key': 'label', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, } - def __init__(self, *, label: str=None, **kwargs) -> None: + def __init__( + self, + *, + label: Optional[str] = None, + **kwargs + ): super(CopyAudio, self).__init__(label=label, **kwargs) - self.odatatype = '#Microsoft.Media.CopyAudio' + 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. + """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 label: An optional label for the codec. The label can be used to - control muxing behavior. + :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 odatatype: Required. Constant filled by server. - :type odatatype: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'label': {'key': 'label', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, } - def __init__(self, *, label: str=None, **kwargs) -> None: + def __init__( + self, + *, + label: Optional[str] = None, + **kwargs + ): super(CopyVideo, self).__init__(label=label, **kwargs) - self.odatatype = '#Microsoft.Media.CopyVideo' + self.odata_type = '#Microsoft.Media.CopyVideo' # type: str -class CrossSiteAccessPolicies(Model): +class CrossSiteAccessPolicies(msrest.serialization.Model): """The client access policy. - :param client_access_policy: The content of clientaccesspolicy.xml used by - Silverlight. + :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. + :param cross_domain_policy: The content of crossdomain.xml used by Silverlight. :type cross_domain_policy: str """ @@ -1955,20 +2301,24 @@ class CrossSiteAccessPolicies(Model): 'cross_domain_policy': {'key': 'crossDomainPolicy', 'type': 'str'}, } - def __init__(self, *, client_access_policy: str=None, cross_domain_policy: str=None, **kwargs) -> None: + def __init__( + self, + *, + client_access_policy: Optional[str] = None, + cross_domain_policy: Optional[str] = None, + **kwargs + ): super(CrossSiteAccessPolicies, self).__init__(**kwargs) self.client_access_policy = client_access_policy self.cross_domain_policy = cross_domain_policy -class DefaultKey(Model): - """Class to specify properties of default content key for each encryption - scheme. +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 + :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 + :param policy_name: Policy used by Default Key. :type policy_name: str """ @@ -1977,20 +2327,26 @@ class DefaultKey(Model): 'policy_name': {'key': 'policyName', 'type': 'str'}, } - def __init__(self, *, label: str=None, policy_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + label: Optional[str] = None, + policy_name: Optional[str] = None, + **kwargs + ): super(DefaultKey, self).__init__(**kwargs) self.label = label self.policy_name = policy_name -class Deinterlace(Model): +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' + :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' + :param mode: The deinterlacing mode. Defaults to AutoPixelAdaptive. Possible values include: + "Off", "AutoPixelAdaptive". :type mode: str or ~azure.mgmt.media.models.DeinterlaceMode """ @@ -1999,44 +2355,52 @@ class Deinterlace(Model): 'mode': {'key': 'mode', 'type': 'str'}, } - def __init__(self, *, parity=None, mode=None, **kwargs) -> None: + def __init__( + self, + *, + parity: Optional[Union[str, "DeinterlaceParity"]] = None, + mode: Optional[Union[str, "DeinterlaceMode"]] = None, + **kwargs + ): super(Deinterlace, self).__init__(**kwargs) self.parity = parity self.mode = mode -class EdgePolicies(Model): +class EdgePolicies(msrest.serialization.Model): """EdgePolicies. :param usage_data_collection_policy: - :type usage_data_collection_policy: - ~azure.mgmt.media.models.EdgeUsageDataCollectionPolicy + :type usage_data_collection_policy: ~azure.mgmt.media.models.EdgeUsageDataCollectionPolicy """ _attribute_map = { 'usage_data_collection_policy': {'key': 'usageDataCollectionPolicy', 'type': 'EdgeUsageDataCollectionPolicy'}, } - def __init__(self, *, usage_data_collection_policy=None, **kwargs) -> None: + def __init__( + self, + *, + usage_data_collection_policy: Optional["EdgeUsageDataCollectionPolicy"] = None, + **kwargs + ): super(EdgePolicies, self).__init__(**kwargs) self.usage_data_collection_policy = usage_data_collection_policy -class EdgeUsageDataCollectionPolicy(Model): +class EdgeUsageDataCollectionPolicy(msrest.serialization.Model): """EdgeUsageDataCollectionPolicy. - :param data_collection_frequency: Usage data collection frequency in ISO - 8601 duration format e.g. PT10M , PT5H. + :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. + :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. + :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. + :param event_hub_details: Details of Event Hub where the usage will be reported. :type event_hub_details: ~azure.mgmt.media.models.EdgeUsageDataEventHub """ @@ -2047,7 +2411,15 @@ class EdgeUsageDataCollectionPolicy(Model): 'event_hub_details': {'key': 'eventHubDetails', 'type': 'EdgeUsageDataEventHub'}, } - def __init__(self, *, data_collection_frequency: str=None, data_reporting_frequency: str=None, max_allowed_unreported_usage_duration: str=None, event_hub_details=None, **kwargs) -> None: + def __init__( + self, + *, + data_collection_frequency: Optional[str] = None, + data_reporting_frequency: Optional[str] = None, + max_allowed_unreported_usage_duration: Optional[str] = None, + event_hub_details: Optional["EdgeUsageDataEventHub"] = None, + **kwargs + ): super(EdgeUsageDataCollectionPolicy, self).__init__(**kwargs) self.data_collection_frequency = data_collection_frequency self.data_reporting_frequency = data_reporting_frequency @@ -2055,7 +2427,7 @@ def __init__(self, *, data_collection_frequency: str=None, data_reporting_freque self.event_hub_details = event_hub_details -class EdgeUsageDataEventHub(Model): +class EdgeUsageDataEventHub(msrest.serialization.Model): """EdgeUsageDataEventHub. :param name: Name of the Event Hub where usage will be reported. @@ -2072,25 +2444,32 @@ class EdgeUsageDataEventHub(Model): 'token': {'key': 'token', 'type': 'str'}, } - def __init__(self, *, name: str=None, namespace: str=None, token: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + namespace: Optional[str] = None, + token: Optional[str] = None, + **kwargs + ): super(EdgeUsageDataEventHub, self).__init__(**kwargs) self.name = name self.namespace = namespace self.token = token -class EnabledProtocols(Model): +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 + :param download: Required. Enable Download protocol or not. :type download: bool - :param dash: Required. Enable DASH protocol or not + :param dash: Required. Enable DASH protocol or not. :type dash: bool - :param hls: Required. Enable HLS protocol or not + :param hls: Required. Enable HLS protocol or not. :type hls: bool - :param smooth_streaming: Required. Enable SmoothStreaming protocol or not + :param smooth_streaming: Required. Enable SmoothStreaming protocol or not. :type smooth_streaming: bool """ @@ -2108,7 +2487,15 @@ class EnabledProtocols(Model): 'smooth_streaming': {'key': 'smoothStreaming', 'type': 'bool'}, } - def __init__(self, *, download: bool, dash: bool, hls: bool, smooth_streaming: bool, **kwargs) -> None: + def __init__( + self, + *, + download: bool, + dash: bool, + hls: bool, + smooth_streaming: bool, + **kwargs + ): super(EnabledProtocols, self).__init__(**kwargs) self.download = download self.dash = dash @@ -2116,7 +2503,7 @@ def __init__(self, *, download: bool, dash: bool, hls: bool, smooth_streaming: b self.smooth_streaming = smooth_streaming -class EntityNameAvailabilityCheckOutput(Model): +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. @@ -2125,8 +2512,7 @@ class EntityNameAvailabilityCheckOutput(Model): :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. + :param message: Specifies the detailed reason if the name is not available. :type message: str """ @@ -2140,31 +2526,37 @@ class EntityNameAvailabilityCheckOutput(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, name_available: bool, reason: str=None, message: str=None, **kwargs) -> None: + def __init__( + self, + *, + name_available: bool, + reason: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): super(EntityNameAvailabilityCheckOutput, self).__init__(**kwargs) self.name_available = name_available self.reason = reason self.message = message -class EnvelopeEncryption(Model): +class EnvelopeEncryption(msrest.serialization.Model): """Class for EnvelopeEncryption encryption scheme. - :param enabled_protocols: Representing supported protocols + :param enabled_protocols: Representing supported protocols. :type enabled_protocols: ~azure.mgmt.media.models.EnabledProtocols - :param clear_tracks: Representing which tracks should not be encrypted + :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 + :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 + :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. + StreamingLocatorId.AlternativeMediaId, and {ContentKeyId}, which is replaced with the value of + identifier of the key being requested. :type custom_key_acquisition_url_template: str """ @@ -2175,7 +2567,15 @@ class EnvelopeEncryption(Model): 'custom_key_acquisition_url_template': {'key': 'customKeyAcquisitionUrlTemplate', 'type': 'str'}, } - def __init__(self, *, enabled_protocols=None, clear_tracks=None, content_keys=None, custom_key_acquisition_url_template: str=None, **kwargs) -> None: + def __init__( + self, + *, + enabled_protocols: Optional["EnabledProtocols"] = None, + clear_tracks: Optional[List["TrackSelection"]] = None, + content_keys: Optional["StreamingPolicyContentKeys"] = None, + custom_key_acquisition_url_template: Optional[str] = None, + **kwargs + ): super(EnvelopeEncryption, self).__init__(**kwargs) self.enabled_protocols = enabled_protocols self.clear_tracks = clear_tracks @@ -2184,64 +2584,64 @@ def __init__(self, *, enabled_protocols=None, clear_tracks=None, content_keys=No class FaceDetectorPreset(Preset): - """Describes all the settings to be used when analyzing a video in order to - detect all the faces present. + """Describes all the settings to be used when analyzing a video in order to detect all the faces present. All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: 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' + :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 experimental_options: Dictionary containing key value pairs for - parameters not exposed in the preset itself + :param experimental_options: Dictionary containing key value pairs for parameters not exposed + in the preset itself. :type experimental_options: dict[str, str] """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'resolution': {'key': 'resolution', 'type': 'str'}, 'experimental_options': {'key': 'experimentalOptions', 'type': '{str}'}, } - def __init__(self, *, resolution=None, experimental_options=None, **kwargs) -> None: + def __init__( + self, + *, + resolution: Optional[Union[str, "AnalysisResolution"]] = None, + experimental_options: Optional[Dict[str, str]] = None, + **kwargs + ): super(FaceDetectorPreset, self).__init__(**kwargs) + self.odata_type = '#Microsoft.Media.FaceDetectorPreset' # type: str self.resolution = resolution self.experimental_options = experimental_options - self.odatatype = '#Microsoft.Media.FaceDetectorPreset' -class Filters(Model): - """Describes all the filtering operations, such as de-interlacing, rotation - etc. that are to be applied to the input media before encoding. +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' + :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. + :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. + :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] """ @@ -2252,7 +2652,15 @@ class Filters(Model): 'overlays': {'key': 'overlays', 'type': '[Overlay]'}, } - def __init__(self, *, deinterlace=None, rotation=None, crop=None, overlays=None, **kwargs) -> None: + def __init__( + self, + *, + deinterlace: Optional["Deinterlace"] = None, + rotation: Optional[Union[str, "Rotation"]] = None, + crop: Optional["Rectangle"] = None, + overlays: Optional[List["Overlay"]] = None, + **kwargs + ): super(Filters, self).__init__(**kwargs) self.deinterlace = deinterlace self.rotation = rotation @@ -2260,20 +2668,19 @@ def __init__(self, *, deinterlace=None, rotation=None, crop=None, overlays=None, self.overlays = overlays -class FilterTrackPropertyCondition(Model): +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' + :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 + :param operation: Required. The track property condition operation. Possible values include: + "Equal", "NotEqual". + :type operation: str or ~azure.mgmt.media.models.FilterTrackPropertyCompareOperation """ _validation = { @@ -2288,22 +2695,27 @@ class FilterTrackPropertyCondition(Model): 'operation': {'key': 'operation', 'type': 'str'}, } - def __init__(self, *, property, value: str, operation, **kwargs) -> None: + def __init__( + self, + *, + property: Union[str, "FilterTrackPropertyType"], + value: str, + operation: Union[str, "FilterTrackPropertyCompareOperation"], + **kwargs + ): super(FilterTrackPropertyCondition, self).__init__(**kwargs) self.property = property self.value = value self.operation = operation -class FilterTrackSelection(Model): - """Representing a list of FilterTrackPropertyConditions to select a track. - The filters are combined using a logical AND 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] + :type track_selections: list[~azure.mgmt.media.models.FilterTrackPropertyCondition] """ _validation = { @@ -2314,12 +2726,17 @@ class FilterTrackSelection(Model): 'track_selections': {'key': 'trackSelections', 'type': '[FilterTrackPropertyCondition]'}, } - def __init__(self, *, track_selections, **kwargs) -> None: + def __init__( + self, + *, + track_selections: List["FilterTrackPropertyCondition"], + **kwargs + ): super(FilterTrackSelection, self).__init__(**kwargs) self.track_selections = track_selections -class FirstQuality(Model): +class FirstQuality(msrest.serialization.Model): """Filter First Quality. All required parameters must be populated in order to send to Azure. @@ -2336,273 +2753,284 @@ class FirstQuality(Model): 'bitrate': {'key': 'bitrate', 'type': 'int'}, } - def __init__(self, *, bitrate: int, **kwargs) -> None: + def __init__( + self, + *, + bitrate: int, + **kwargs + ): super(FirstQuality, self).__init__(**kwargs) self.bitrate = bitrate -class Format(Model): +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 + sub-classes are: ImageFormat, JpgFormat, MultiBitrateFormat, PngFormat. All required parameters must be populated in order to send to Azure. - :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} - The base name of the input video {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. Any unsubstituted - macros will be collapsed and removed from the filename. + :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. Any + unsubstituted macros will be collapsed and removed from the filename. :type filename_pattern: str - :param odatatype: Required. Constant filled by server. - :type odatatype: str """ _validation = { + 'odata_type': {'required': True}, 'filename_pattern': {'required': True}, - 'odatatype': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'filename_pattern': {'key': 'filenamePattern', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, } _subtype_map = { - 'odatatype': {'#Microsoft.Media.ImageFormat': 'ImageFormat', '#Microsoft.Media.MultiBitrateFormat': 'MultiBitrateFormat'} + 'odata_type': {'#Microsoft.Media.ImageFormat': 'ImageFormat', '#Microsoft.Media.JpgFormat': 'JpgFormat', '#Microsoft.Media.MultiBitrateFormat': 'MultiBitrateFormat', '#Microsoft.Media.PngFormat': 'PngFormat'} } - def __init__(self, *, filename_pattern: str, **kwargs) -> None: + def __init__( + self, + *, + filename_pattern: str, + **kwargs + ): super(Format, self).__init__(**kwargs) + self.odata_type = None # type: Optional[str] self.filename_pattern = filename_pattern - self.odatatype = None -class Layer(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. +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: VideoLayer, JpgLayer, PngLayer + sub-classes are: JpgLayer, PngLayer, VideoLayer. All required parameters must be populated in order to send to Azure. - :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. + :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. + :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. + :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 odatatype: Required. Constant filled by server. - :type odatatype: str """ _validation = { - 'odatatype': {'required': True}, + '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'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, } _subtype_map = { - 'odatatype': {'#Microsoft.Media.VideoLayer': 'VideoLayer', '#Microsoft.Media.JpgLayer': 'JpgLayer', '#Microsoft.Media.PngLayer': 'PngLayer'} + 'odata_type': {'#Microsoft.Media.JpgLayer': 'JpgLayer', '#Microsoft.Media.PngLayer': 'PngLayer', '#Microsoft.Media.VideoLayer': 'VideoLayer'} } - def __init__(self, *, width: str=None, height: str=None, label: str=None, **kwargs) -> None: + def __init__( + self, + *, + width: Optional[str] = None, + height: Optional[str] = None, + label: Optional[str] = None, + **kwargs + ): super(Layer, self).__init__(**kwargs) + self.odata_type = None # type: Optional[str] self.width = width self.height = height self.label = label - self.odatatype = None class VideoLayer(Layer): - """Describes the settings to be used when encoding the input video into a - desired output bitrate 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 + sub-classes are: H264Layer. All required parameters must be populated in order to send to Azure. - :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. + :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. + :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. + :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 odatatype: Required. Constant filled by server. - :type odatatype: 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. + :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. + :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. + :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. + :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. + :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_bframe: 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_bframe: bool + :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 = { - 'odatatype': {'required': True}, + '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'}, - 'odatatype': {'key': '@odata\\.type', '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_bframe': {'key': 'adaptiveBFrame', 'type': 'bool'}, + 'adaptive_b_frame': {'key': 'adaptiveBFrame', 'type': 'bool'}, } _subtype_map = { - 'odatatype': {'#Microsoft.Media.H264Layer': 'H264Layer'} - } - - def __init__(self, *, bitrate: int, width: str=None, height: str=None, label: str=None, max_bitrate: int=None, b_frames: int=None, frame_rate: str=None, slices: int=None, adaptive_bframe: bool=None, **kwargs) -> None: + 'odata_type': {'#Microsoft.Media.H264Layer': 'H264Layer'} + } + + def __init__( + self, + *, + bitrate: int, + width: Optional[str] = None, + height: Optional[str] = None, + label: Optional[str] = None, + max_bitrate: Optional[int] = None, + b_frames: Optional[int] = None, + frame_rate: Optional[str] = None, + slices: Optional[int] = None, + adaptive_b_frame: Optional[bool] = None, + **kwargs + ): 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 self.frame_rate = frame_rate self.slices = slices - self.adaptive_bframe = adaptive_bframe - self.odatatype = '#Microsoft.Media.VideoLayer' + self.adaptive_b_frame = adaptive_b_frame 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. + """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 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. + :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. + :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. + :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 odatatype: Required. Constant filled by server. - :type odatatype: 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. + :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. + :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. + :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. + :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. + :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_bframe: 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_bframe: bool - :param profile: We currently support Baseline, Main, High, High422, - High444. Default is Auto. Possible values include: 'Auto', 'Baseline', - 'Main', 'High', 'High422', 'High444' + :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. + :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: 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. + :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' + :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 = { - 'odatatype': {'required': True}, + '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'}, - 'odatatype': {'key': '@odata\\.type', '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_bframe': {'key': 'adaptiveBFrame', 'type': 'bool'}, + 'adaptive_b_frame': {'key': 'adaptiveBFrame', 'type': 'bool'}, 'profile': {'key': 'profile', 'type': 'str'}, 'level': {'key': 'level', 'type': 'str'}, 'buffer_window': {'key': 'bufferWindow', 'type': 'duration'}, @@ -2610,60 +3038,91 @@ class H264Layer(VideoLayer): 'entropy_mode': {'key': 'entropyMode', 'type': 'str'}, } - def __init__(self, *, bitrate: int, width: str=None, height: str=None, label: str=None, max_bitrate: int=None, b_frames: int=None, frame_rate: str=None, slices: int=None, adaptive_bframe: bool=None, profile=None, level: str=None, buffer_window=None, reference_frames: int=None, entropy_mode=None, **kwargs) -> None: - 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_bframe=adaptive_bframe, **kwargs) + def __init__( + self, + *, + bitrate: int, + width: Optional[str] = None, + height: Optional[str] = None, + label: Optional[str] = None, + max_bitrate: Optional[int] = None, + b_frames: Optional[int] = None, + frame_rate: Optional[str] = None, + slices: Optional[int] = None, + adaptive_b_frame: Optional[bool] = None, + profile: Optional[Union[str, "H264VideoProfile"]] = None, + level: Optional[str] = None, + buffer_window: Optional[datetime.timedelta] = None, + reference_frames: Optional[int] = None, + entropy_mode: Optional[Union[str, "EntropyMode"]] = None, + **kwargs + ): + 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.reference_frames = reference_frames self.entropy_mode = entropy_mode - self.odatatype = '#Microsoft.Media.H264Layer' 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: Image, H264Video + sub-classes are: H264Video, Image. All required parameters must be populated in order to send to Azure. - :param label: An optional label for the codec. The label can be used to - control muxing behavior. + :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 odatatype: Required. Constant filled by server. - :type odatatype: str - :param key_frame_interval: The distance between two key frames, thereby - defining a group of pictures (GOP). The value should be a non-zero integer - in the range [1, 30] seconds, specified in ISO 8601 format. The default is - 2 seconds (PT2S). - :type key_frame_interval: 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' + :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 = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'label': {'key': 'label', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, 'key_frame_interval': {'key': 'keyFrameInterval', 'type': 'duration'}, 'stretch_mode': {'key': 'stretchMode', 'type': 'str'}, + 'sync_mode': {'key': 'syncMode', 'type': 'str'}, } _subtype_map = { - 'odatatype': {'#Microsoft.Media.Image': 'Image', '#Microsoft.Media.H264Video': 'H264Video'} - } - - def __init__(self, *, label: str=None, key_frame_interval=None, stretch_mode=None, **kwargs) -> None: + 'odata_type': {'#Microsoft.Media.H264Video': 'H264Video', '#Microsoft.Media.Image': 'Image'} + } + + def __init__( + self, + *, + label: Optional[str] = None, + key_frame_interval: Optional[datetime.timedelta] = None, + stretch_mode: Optional[Union[str, "StretchMode"]] = None, + sync_mode: Optional[Union[str, "VideoSyncMode"]] = None, + **kwargs + ): super(Video, self).__init__(label=label, **kwargs) + self.odata_type = '#Microsoft.Media.Video' # type: str self.key_frame_interval = key_frame_interval self.stretch_mode = stretch_mode - self.odatatype = '#Microsoft.Media.Video' + self.sync_mode = sync_mode class H264Video(Video): @@ -2671,61 +3130,74 @@ class H264Video(Video): All required parameters must be populated in order to send to Azure. - :param label: An optional label for the codec. The label can be used to - control muxing behavior. + :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 odatatype: Required. Constant filled by server. - :type odatatype: str - :param key_frame_interval: The distance between two key frames, thereby - defining a group of pictures (GOP). The value should be a non-zero integer - in the range [1, 30] seconds, specified in ISO 8601 format. The default is - 2 seconds (PT2S). - :type key_frame_interval: 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' + :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 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. + :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' + :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. + :param layers: The collection of output H.264 layers to be produced by the encoder. :type layers: list[~azure.mgmt.media.models.H264Layer] """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'label': {'key': 'label', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', '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, *, label: str=None, key_frame_interval=None, stretch_mode=None, scene_change_detection: bool=None, complexity=None, layers=None, **kwargs) -> None: - super(H264Video, self).__init__(label=label, key_frame_interval=key_frame_interval, stretch_mode=stretch_mode, **kwargs) + def __init__( + self, + *, + label: Optional[str] = None, + 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, + **kwargs + ): + 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.odatatype = '#Microsoft.Media.H264Video' -class Hls(Model): - """The HLS configuration. +class Hls(msrest.serialization.Model): + """HTTP Live Streaming (HLS) packing setting for the live output. - :param fragments_per_ts_segment: The amount of fragments per HTTP Live - Streaming (HLS) segment. + :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 """ @@ -2733,121 +3205,150 @@ class Hls(Model): 'fragments_per_ts_segment': {'key': 'fragmentsPerTsSegment', 'type': 'int'}, } - def __init__(self, *, fragments_per_ts_segment: int=None, **kwargs) -> None: + def __init__( + self, + *, + fragments_per_ts_segment: Optional[int] = None, + **kwargs + ): super(Hls, self).__init__(**kwargs) self.fragments_per_ts_segment = fragments_per_ts_segment class Image(Video): - """Describes the basic properties for generating thumbnails from the input - 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 + sub-classes are: JpgImage, PngImage. All required parameters must be populated in order to send to Azure. - :param label: An optional label for the codec. The label can be used to - control muxing behavior. + :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 odatatype: Required. Constant filled by server. - :type odatatype: str - :param key_frame_interval: The distance between two key frames, thereby - defining a group of pictures (GOP). The value should be a non-zero integer - in the range [1, 30] seconds, specified in ISO 8601 format. The default is - 2 seconds (PT2S). - :type key_frame_interval: 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' + :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 start: Required. The position in the input video from where to - start generating thumbnails. The value can be in absolute timestamp (ISO - 8601, e.g: PT05S), or a frame count (For example, 10 for the 10th frame), - or a relative value (For example, 1%). Also supports a macro {Best}, which - tells the encoder to select the best thumbnail from the first few seconds - of the video. + :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 absolute timestamp (ISO 8601, e.g: PT05S for one image every 5 - seconds), or a frame count (For example, 30 for every 30 frames), or a - relative value (For example, 1%). + :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 in the input video at which to stop generating - thumbnails. The value can be in absolute timestamp (ISO 8601, e.g: PT5M30S - to stop at 5 minutes and 30 seconds), or a frame count (For example, 300 - to stop at the 300th frame), or a relative value (For example, 100%). + :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 = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, 'start': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'label': {'key': 'label', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', '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 = { - 'odatatype': {'#Microsoft.Media.JpgImage': 'JpgImage', '#Microsoft.Media.PngImage': 'PngImage'} - } - - def __init__(self, *, start: str, label: str=None, key_frame_interval=None, stretch_mode=None, step: str=None, range: str=None, **kwargs) -> None: - super(Image, self).__init__(label=label, key_frame_interval=key_frame_interval, stretch_mode=stretch_mode, **kwargs) + 'odata_type': {'#Microsoft.Media.JpgImage': 'JpgImage', '#Microsoft.Media.PngImage': 'PngImage'} + } + + def __init__( + self, + *, + start: str, + label: Optional[str] = None, + key_frame_interval: Optional[datetime.timedelta] = None, + stretch_mode: Optional[Union[str, "StretchMode"]] = None, + sync_mode: Optional[Union[str, "VideoSyncMode"]] = None, + step: Optional[str] = None, + range: Optional[str] = None, + **kwargs + ): + 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 self.step = step self.range = range - self.odatatype = '#Microsoft.Media.Image' 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 filename_pattern: Required. The pattern of the file names for the - generated output files. The following macros are supported in the file - name: {Basename} - The base name of the input video {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. Any unsubstituted - macros will be collapsed and removed from the filename. + :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. Any + unsubstituted macros will be collapsed and removed from the filename. :type filename_pattern: str - :param odatatype: Required. Constant filled by server. - :type odatatype: str """ _validation = { + 'odata_type': {'required': True}, 'filename_pattern': {'required': True}, - 'odatatype': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'filename_pattern': {'key': 'filenamePattern', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, - } - - _subtype_map = { - 'odatatype': {'#Microsoft.Media.JpgFormat': 'JpgFormat', '#Microsoft.Media.PngFormat': 'PngFormat'} } - def __init__(self, *, filename_pattern: str, **kwargs) -> None: + def __init__( + self, + *, + filename_pattern: str, + **kwargs + ): super(ImageFormat, self).__init__(filename_pattern=filename_pattern, **kwargs) - self.odatatype = '#Microsoft.Media.ImageFormat' + self.odata_type = '#Microsoft.Media.ImageFormat' # type: str -class IPAccessControl(Model): +class IPAccessControl(msrest.serialization.Model): """The IP access control. :param allow: The IP allow list. @@ -2858,20 +3359,24 @@ class IPAccessControl(Model): 'allow': {'key': 'allow', 'type': '[IPRange]'}, } - def __init__(self, *, allow=None, **kwargs) -> None: + def __init__( + self, + *, + allow: Optional[List["IPRange"]] = None, + **kwargs + ): super(IPAccessControl, self).__init__(**kwargs) self.allow = allow -class IPRange(Model): +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). + :param subnet_prefix_length: The subnet mask prefix length (see CIDR notation). :type subnet_prefix_length: int """ @@ -2881,57 +3386,59 @@ class IPRange(Model): 'subnet_prefix_length': {'key': 'subnetPrefixLength', 'type': 'int'}, } - def __init__(self, *, name: str=None, address: str=None, subnet_prefix_length: int=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + address: Optional[str] = None, + subnet_prefix_length: Optional[int] = None, + **kwargs + ): super(IPRange, self).__init__(**kwargs) self.name = name self.address = address self.subnet_prefix_length = subnet_prefix_length -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. +class Job(Resource): + """A Job resource type. The progress and state can be obtained by polling a Job or subscribing to events using EventGrid. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. + :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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar created: The UTC date and time when the Job was created, in - 'YYYY-MM-DDThh:mm:ssZ' format. - :vartype created: datetime - :ivar state: The current state of the job. Possible values include: - 'Canceled', 'Canceling', 'Error', 'Finished', 'Processing', 'Queued', - 'Scheduled' + :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: Required. The inputs for the Job. + :param input: The inputs for the Job. :type input: ~azure.mgmt.media.models.JobInput - :ivar last_modified: The UTC date and time when the Job was last updated, - in 'YYYY-MM-DDThh:mm:ssZ' format. - :vartype last_modified: datetime - :param outputs: Required. The outputs for the Job. + :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' + :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. + :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 - :ivar end_time: The UTC date and time at which this Job finished - processing. - :vartype end_time: datetime + :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 = { @@ -2940,9 +3447,7 @@ class Job(ProxyResource): 'type': {'readonly': True}, 'created': {'readonly': True}, 'state': {'readonly': True}, - 'input': {'required': True}, 'last_modified': {'readonly': True}, - 'outputs': {'required': True}, 'start_time': {'readonly': True}, 'end_time': {'readonly': True}, } @@ -2963,7 +3468,16 @@ class Job(ProxyResource): 'end_time': {'key': 'properties.endTime', 'type': 'iso-8601'}, } - def __init__(self, *, input, outputs, description: str=None, priority=None, correlation_data=None, **kwargs) -> None: + def __init__( + self, + *, + description: Optional[str] = None, + input: Optional["JobInput"] = None, + outputs: Optional[List["JobOutput"]] = None, + priority: Optional[Union[str, "Priority"]] = None, + correlation_data: Optional[Dict[str, str]] = None, + **kwargs + ): super(Job, self).__init__(**kwargs) self.created = None self.state = None @@ -2977,29 +3491,53 @@ def __init__(self, *, input, outputs, description: str=None, priority=None, corr self.end_time = None -class JobError(Model): +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, + *, + value: Optional[List["Job"]] = None, + odata_next_link: Optional[str] = None, + **kwargs + ): + super(JobCollection, self).__init__(**kwargs) + self.value = value + self.odata_next_link = odata_next_link + + +class JobError(msrest.serialization.Model): """Details of JobOutput errors. - Variables are only populated by the server, and will be ignored when - sending a request. + 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' + :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. + :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' + :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' + :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. + :ivar details: An array of details about specific errors that led to this reported error. :vartype details: list[~azure.mgmt.media.models.JobErrorDetail] """ @@ -3019,7 +3557,10 @@ class JobError(Model): 'details': {'key': 'details', 'type': '[JobErrorDetail]'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(JobError, self).__init__(**kwargs) self.code = None self.message = None @@ -3028,11 +3569,10 @@ def __init__(self, **kwargs) -> None: self.details = None -class JobErrorDetail(Model): +class JobErrorDetail(msrest.serialization.Model): """Details of JobOutput errors. - Variables are only populated by the server, and will be ignored when - sending a request. + 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 @@ -3050,75 +3590,79 @@ class JobErrorDetail(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(JobErrorDetail, self).__init__(**kwargs) self.code = None self.message = None -class JobInput(Model): +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, JobInputs + sub-classes are: JobInputClip, JobInputs. All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str + :param odata_type: Required. The discriminator for derived types.Constant filled by server. + :type odata_type: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, } _subtype_map = { - 'odatatype': {'#Microsoft.Media.JobInputClip': 'JobInputClip', '#Microsoft.Media.JobInputs': 'JobInputs'} + 'odata_type': {'#Microsoft.Media.JobInputClip': 'JobInputClip', '#Microsoft.Media.JobInputs': 'JobInputs'} } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(JobInput, self).__init__(**kwargs) - self.odatatype = None + 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 + sub-classes are: JobInputAsset, JobInputHttp. All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str - :param files: List of files. Required for JobInputHttp. Maximum of 4000 - characters each. + :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. :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. + :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. + :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'. + :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 """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'files': {'key': 'files', 'type': '[str]'}, 'start': {'key': 'start', 'type': 'ClipTime'}, 'end': {'key': 'end', 'type': 'ClipTime'}, @@ -3126,16 +3670,24 @@ class JobInputClip(JobInput): } _subtype_map = { - 'odatatype': {'#Microsoft.Media.JobInputAsset': 'JobInputAsset', '#Microsoft.Media.JobInputHttp': 'JobInputHttp'} - } - - def __init__(self, *, files=None, start=None, end=None, label: str=None, **kwargs) -> None: + 'odata_type': {'#Microsoft.Media.JobInputAsset': 'JobInputAsset', '#Microsoft.Media.JobInputHttp': 'JobInputHttp'} + } + + def __init__( + self, + *, + files: Optional[List[str]] = None, + start: Optional["ClipTime"] = None, + end: Optional["ClipTime"] = None, + label: Optional[str] = None, + **kwargs + ): super(JobInputClip, self).__init__(**kwargs) + self.odata_type = '#Microsoft.Media.JobInputClip' # type: str self.files = files self.start = start self.end = end self.label = label - self.odatatype = '#Microsoft.Media.JobInputClip' class JobInputAsset(JobInputClip): @@ -3143,35 +3695,33 @@ class JobInputAsset(JobInputClip): All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str - :param files: List of files. Required for JobInputHttp. Maximum of 4000 - characters each. + :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. :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. + :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. + :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'. + :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 asset_name: Required. The name of the input Asset. :type asset_name: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, 'asset_name': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'files': {'key': 'files', 'type': '[str]'}, 'start': {'key': 'start', 'type': 'ClipTime'}, 'end': {'key': 'end', 'type': 'ClipTime'}, @@ -3179,10 +3729,19 @@ class JobInputAsset(JobInputClip): 'asset_name': {'key': 'assetName', 'type': 'str'}, } - def __init__(self, *, asset_name: str, files=None, start=None, end=None, label: str=None, **kwargs) -> None: + def __init__( + self, + *, + asset_name: str, + files: Optional[List[str]] = None, + start: Optional["ClipTime"] = None, + end: Optional["ClipTime"] = None, + label: Optional[str] = None, + **kwargs + ): super(JobInputAsset, self).__init__(files=files, start=start, end=end, label=label, **kwargs) + self.odata_type = '#Microsoft.Media.JobInputAsset' # type: str self.asset_name = asset_name - self.odatatype = '#Microsoft.Media.JobInputAsset' class JobInputHttp(JobInputClip): @@ -3190,37 +3749,34 @@ class JobInputHttp(JobInputClip): All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str - :param files: List of files. Required for JobInputHttp. Maximum of 4000 - characters each. + :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. :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. + :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. + :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'. + :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 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. + :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. :type base_uri: str """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'files': {'key': 'files', 'type': '[str]'}, 'start': {'key': 'start', 'type': 'ClipTime'}, 'end': {'key': 'end', 'type': 'ClipTime'}, @@ -3228,10 +3784,19 @@ class JobInputHttp(JobInputClip): 'base_uri': {'key': 'baseUri', 'type': 'str'}, } - def __init__(self, *, files=None, start=None, end=None, label: str=None, base_uri: str=None, **kwargs) -> None: + def __init__( + self, + *, + files: Optional[List[str]] = None, + start: Optional["ClipTime"] = None, + end: Optional["ClipTime"] = None, + label: Optional[str] = None, + base_uri: Optional[str] = None, + **kwargs + ): super(JobInputHttp, self).__init__(files=files, start=start, end=end, label=label, **kwargs) + self.odata_type = '#Microsoft.Media.JobInputHttp' # type: str self.base_uri = base_uri - self.odatatype = '#Microsoft.Media.JobInputHttp' class JobInputs(JobInput): @@ -3239,274 +3804,314 @@ class JobInputs(JobInput): All required parameters must be populated in order to send to Azure. - :param odatatype: Required. Constant filled by server. - :type odatatype: str + :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 = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'inputs': {'key': 'inputs', 'type': '[JobInput]'}, } - def __init__(self, *, inputs=None, **kwargs) -> None: + def __init__( + self, + *, + inputs: Optional[List["JobInput"]] = None, + **kwargs + ): super(JobInputs, self).__init__(**kwargs) + self.odata_type = '#Microsoft.Media.JobInputs' # type: str self.inputs = inputs - self.odatatype = '#Microsoft.Media.JobInputs' -class JobOutput(Model): +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 + sub-classes are: JobOutputAsset. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar error: If the JobOutput is in the Error state, it contains the - details of the error. + :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 - :ivar state: Describes the state of the JobOutput. Possible values - include: 'Canceled', 'Canceling', 'Error', 'Finished', 'Processing', - 'Queued', 'Scheduled' + :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. + :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. + :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 - :ivar end_time: The UTC date and time at which this Job Output finished - processing. - :vartype end_time: datetime - :param odatatype: Required. Constant filled by server. - :type odatatype: 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}, - 'odatatype': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'error': {'key': 'error', 'type': 'JobError'}, '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'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, } _subtype_map = { - 'odatatype': {'#Microsoft.Media.JobOutputAsset': 'JobOutputAsset'} + 'odata_type': {'#Microsoft.Media.JobOutputAsset': 'JobOutputAsset'} } - def __init__(self, *, label: str=None, **kwargs) -> None: + def __init__( + self, + *, + label: Optional[str] = None, + **kwargs + ): super(JobOutput, self).__init__(**kwargs) + self.odata_type = None # type: Optional[str] self.error = None self.state = None self.progress = None self.label = label self.start_time = None self.end_time = None - self.odatatype = 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. + 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 error: If the JobOutput is in the Error state, it contains the - details of the error. + :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 - :ivar state: Describes the state of the JobOutput. Possible values - include: 'Canceled', 'Canceling', 'Error', 'Finished', 'Processing', - 'Queued', 'Scheduled' + :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. + :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. + :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 - :ivar end_time: The UTC date and time at which this Job Output finished - processing. - :vartype end_time: datetime - :param odatatype: Required. Constant filled by server. - :type odatatype: 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}, - 'odatatype': {'required': True}, 'asset_name': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'error': {'key': 'error', 'type': 'JobError'}, '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'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, 'asset_name': {'key': 'assetName', 'type': 'str'}, } - def __init__(self, *, asset_name: str, label: str=None, **kwargs) -> None: + def __init__( + self, + *, + asset_name: str, + label: Optional[str] = None, + **kwargs + ): super(JobOutputAsset, self).__init__(label=label, **kwargs) + self.odata_type = '#Microsoft.Media.JobOutputAsset' # type: str self.asset_name = asset_name - self.odatatype = '#Microsoft.Media.JobOutputAsset' -class JpgFormat(ImageFormat): +class JpgFormat(Format): """Describes the settings for producing JPEG thumbnails. All required parameters must be populated in order to send to Azure. - :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} - The base name of the input video {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. Any unsubstituted - macros will be collapsed and removed from the filename. + :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. Any + unsubstituted macros will be collapsed and removed from the filename. :type filename_pattern: str - :param odatatype: Required. Constant filled by server. - :type odatatype: str """ _validation = { + 'odata_type': {'required': True}, 'filename_pattern': {'required': True}, - 'odatatype': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'filename_pattern': {'key': 'filenamePattern', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, } - def __init__(self, *, filename_pattern: str, **kwargs) -> None: + def __init__( + self, + *, + filename_pattern: str, + **kwargs + ): super(JpgFormat, self).__init__(filename_pattern=filename_pattern, **kwargs) - self.odatatype = '#Microsoft.Media.JpgFormat' + 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. + """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 label: An optional label for the codec. The label can be used to - control muxing behavior. + :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 odatatype: Required. Constant filled by server. - :type odatatype: str - :param key_frame_interval: The distance between two key frames, thereby - defining a group of pictures (GOP). The value should be a non-zero integer - in the range [1, 30] seconds, specified in ISO 8601 format. The default is - 2 seconds (PT2S). - :type key_frame_interval: 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' + :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 start: Required. The position in the input video from where to - start generating thumbnails. The value can be in absolute timestamp (ISO - 8601, e.g: PT05S), or a frame count (For example, 10 for the 10th frame), - or a relative value (For example, 1%). Also supports a macro {Best}, which - tells the encoder to select the best thumbnail from the first few seconds - of the video. + :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 absolute timestamp (ISO 8601, e.g: PT05S for one image every 5 - seconds), or a frame count (For example, 30 for every 30 frames), or a - relative value (For example, 1%). + :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 in the input video at which to stop generating - thumbnails. The value can be in absolute timestamp (ISO 8601, e.g: PT5M30S - to stop at 5 minutes and 30 seconds), or a frame count (For example, 300 - to stop at the 300th frame), or a relative value (For example, 100%). + :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. + :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 = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, 'start': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'label': {'key': 'label', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', '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]'}, - } - - def __init__(self, *, start: str, label: str=None, key_frame_interval=None, stretch_mode=None, step: str=None, range: str=None, layers=None, **kwargs) -> None: - super(JpgImage, self).__init__(label=label, key_frame_interval=key_frame_interval, stretch_mode=stretch_mode, start=start, step=step, range=range, **kwargs) + 'sprite_column': {'key': 'spriteColumn', 'type': 'int'}, + } + + def __init__( + self, + *, + start: str, + label: Optional[str] = None, + key_frame_interval: Optional[datetime.timedelta] = None, + stretch_mode: Optional[Union[str, "StretchMode"]] = None, + sync_mode: Optional[Union[str, "VideoSyncMode"]] = None, + step: Optional[str] = None, + range: Optional[str] = None, + layers: Optional[List["JpgLayer"]] = None, + sprite_column: Optional[int] = None, + **kwargs + ): + 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 - self.odatatype = '#Microsoft.Media.JpgImage' + self.sprite_column = sprite_column class JpgLayer(Layer): @@ -3514,53 +4119,93 @@ class JpgLayer(Layer): All required parameters must be populated in order to send to Azure. - :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. + :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. + :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. + :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 odatatype: Required. Constant filled by server. - :type odatatype: str - :param quality: The compression quality of the JPEG output. Range is from - 0-100 and the default is 70. + :param quality: The compression quality of the JPEG output. Range is from 0-100 and the default + is 70. :type quality: int """ _validation = { - 'odatatype': {'required': True}, + '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'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, 'quality': {'key': 'quality', 'type': 'int'}, } - def __init__(self, *, width: str=None, height: str=None, label: str=None, quality: int=None, **kwargs) -> None: + def __init__( + self, + *, + width: Optional[str] = None, + height: Optional[str] = None, + label: Optional[str] = None, + quality: Optional[int] = None, + **kwargs + ): super(JpgLayer, self).__init__(width=width, height=height, label=label, **kwargs) + self.odata_type = '#Microsoft.Media.JpgLayer' # type: str self.quality = quality - self.odatatype = '#Microsoft.Media.JpgLayer' -class ListContainerSasInput(Model): +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, + *, + key_identifier: Optional[str] = None, + **kwargs + ): + super(KeyVaultProperties, self).__init__(**kwargs) + self.key_identifier = key_identifier + 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 + :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 = { @@ -3568,30 +4213,40 @@ class ListContainerSasInput(Model): 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, } - def __init__(self, *, permissions=None, expiry_time=None, **kwargs) -> None: + def __init__( + self, + *, + permissions: Optional[Union[str, "AssetContainerPermission"]] = None, + expiry_time: Optional[datetime.datetime] = None, + **kwargs + ): super(ListContainerSasInput, self).__init__(**kwargs) self.permissions = permissions self.expiry_time = expiry_time -class ListContentKeysResponse(Model): +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] + :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, *, content_keys=None, **kwargs) -> None: + def __init__( + self, + *, + content_keys: Optional[List["StreamingLocatorContentKey"]] = None, + **kwargs + ): super(ListContentKeysResponse, self).__init__(**kwargs) self.content_keys = content_keys -class ListEdgePoliciesInput(Model): +class ListEdgePoliciesInput(msrest.serialization.Model): """ListEdgePoliciesInput. :param device_id: Unique identifier of the edge device. @@ -3602,19 +4257,22 @@ class ListEdgePoliciesInput(Model): 'device_id': {'key': 'deviceId', 'type': 'str'}, } - def __init__(self, *, device_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + device_id: Optional[str] = None, + **kwargs + ): super(ListEdgePoliciesInput, self).__init__(**kwargs) self.device_id = device_id -class ListPathsResponse(Model): +class ListPathsResponse(msrest.serialization.Model): """Class of response for listPaths action. - :param streaming_paths: Streaming Paths supported by current Streaming - Locator + :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 + :param download_paths: Download Paths supported by current Streaming Locator. :type download_paths: list[str] """ @@ -3623,21 +4281,25 @@ class ListPathsResponse(Model): 'download_paths': {'key': 'downloadPaths', 'type': '[str]'}, } - def __init__(self, *, streaming_paths=None, download_paths=None, **kwargs) -> None: + def __init__( + self, + *, + streaming_paths: Optional[List["StreamingPath"]] = None, + download_paths: Optional[List[str]] = None, + **kwargs + ): super(ListPathsResponse, self).__init__(**kwargs) self.streaming_paths = streaming_paths self.download_paths = download_paths -class ListStreamingLocatorsResponse(Model): +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. + 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] + :vartype streaming_locators: list[~azure.mgmt.media.models.AssetStreamingLocator] """ _validation = { @@ -3648,26 +4310,32 @@ class ListStreamingLocatorsResponse(Model): 'streaming_locators': {'key': 'streamingLocators', 'type': '[AssetStreamingLocator]'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ListStreamingLocatorsResponse, self).__init__(**kwargs) self.streaming_locators = None class TrackedResource(Resource): - """The resource model definition for a ARM tracked 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. + 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. + :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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param location: The Azure Region of the resource. + :param location: Required. The geo-location where the resource lives. :type location: str """ @@ -3675,6 +4343,7 @@ class TrackedResource(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'location': {'required': True}, } _attribute_map = { @@ -3685,65 +4354,84 @@ class TrackedResource(Resource): 'location': {'key': 'location', 'type': 'str'}, } - def __init__(self, *, tags=None, location: str=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(TrackedResource, self).__init__(**kwargs) self.tags = tags self.location = location class LiveEvent(TrackedResource): - """The Live Event. + """The live event. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. + :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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param location: The Azure Region of the resource. + :param location: Required. The geo-location where the resource lives. :type location: str - :param description: The Live Event description. + :param description: A description for the live event. :type description: str - :param input: Required. The Live Event input. + :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: The Live Event preview. + :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: The Live Event encoding. + :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 - :ivar provisioning_state: The provisioning state of the Live Event. + :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. Possible - values include: 'Stopped', 'Starting', 'Running', 'Stopping', 'Deleting' - :vartype resource_state: str or - ~azure.mgmt.media.models.LiveEventResourceState - :param cross_site_access_policies: The Live Event access policies. - :type cross_site_access_policies: - ~azure.mgmt.media.models.CrossSiteAccessPolicies - :param vanity_url: Specifies whether to use a vanity url with the Live - Event. This value is specified at creation time and cannot be updated. - :type vanity_url: bool - :param stream_options: The options to use for the LiveEvent. This value - is specified at creation time and cannot be updated. - :type stream_options: list[str or - ~azure.mgmt.media.models.StreamOptionsFlag] - :ivar created: The exact time the Live Event was created. - :vartype created: datetime - :ivar last_modified: The exact time the Live Event was last modified. - :vartype last_modified: datetime + :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}, - 'input': {'required': True}, + 'location': {'required': True}, 'provisioning_state': {'readonly': True}, 'resource_state': {'readonly': True}, 'created': {'readonly': True}, @@ -3760,35 +4448,55 @@ class LiveEvent(TrackedResource): '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'}, - 'vanity_url': {'key': 'properties.vanityUrl', 'type': 'bool'}, + '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, *, input, tags=None, location: str=None, description: str=None, preview=None, encoding=None, cross_site_access_policies=None, vanity_url: bool=None, stream_options=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + description: Optional[str] = None, + input: Optional["LiveEventInput"] = None, + preview: Optional["LiveEventPreview"] = None, + encoding: Optional["LiveEventEncoding"] = None, + transcriptions: Optional[List["LiveEventTranscription"]] = None, + cross_site_access_policies: Optional["CrossSiteAccessPolicies"] = None, + use_static_hostname: Optional[bool] = None, + hostname_prefix: Optional[str] = None, + stream_options: Optional[List[Union[str, "StreamOptionsFlag"]]] = None, + **kwargs + ): super(LiveEvent, self).__init__(tags=tags, location=location, **kwargs) self.description = description self.input = input self.preview = preview self.encoding = encoding + self.transcriptions = transcriptions self.provisioning_state = None self.resource_state = None self.cross_site_access_policies = cross_site_access_policies - self.vanity_url = vanity_url + self.use_static_hostname = use_static_hostname + self.hostname_prefix = hostname_prefix self.stream_options = stream_options self.created = None self.last_modified = None -class LiveEventActionInput(Model): +class LiveEventActionInput(msrest.serialization.Model): """The LiveEvent action input parameter definition. - :param remove_outputs_on_stop: The flag indicates if remove LiveOutputs on - Stop. + :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 """ @@ -3796,36 +4504,68 @@ class LiveEventActionInput(Model): 'remove_outputs_on_stop': {'key': 'removeOutputsOnStop', 'type': 'bool'}, } - def __init__(self, *, remove_outputs_on_stop: bool=None, **kwargs) -> None: + def __init__( + self, + *, + remove_outputs_on_stop: Optional[bool] = None, + **kwargs + ): super(LiveEventActionInput, self).__init__(**kwargs) self.remove_outputs_on_stop = remove_outputs_on_stop -class LiveEventEncoding(Model): - """The Live Event encoding. +class LiveEventEncoding(msrest.serialization.Model): + """Specifies the live event type and optional encoding settings for encoding live events. - :param encoding_type: The encoding type for Live Event. This value is - specified at creation time and cannot be updated. Possible values include: - 'None', 'Basic', 'Standard', 'Premium1080p' + :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". :type encoding_type: str or ~azure.mgmt.media.models.LiveEventEncodingType - :param preset_name: The encoding preset name. This value is specified at - creation time and cannot be updated. + :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, *, encoding_type=None, preset_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + encoding_type: Optional[Union[str, "LiveEventEncodingType"]] = None, + preset_name: Optional[str] = None, + stretch_mode: Optional[Union[str, "StretchMode"]] = None, + key_frame_interval: Optional[datetime.timedelta] = None, + **kwargs + ): super(LiveEventEncoding, self).__init__(**kwargs) self.encoding_type = encoding_type self.preset_name = preset_name + self.stretch_mode = stretch_mode + self.key_frame_interval = key_frame_interval -class LiveEventEndpoint(Model): - """The Live Event endpoint. +class LiveEventEndpoint(msrest.serialization.Model): + """The live event endpoint. :param protocol: The endpoint protocol. :type protocol: str @@ -3838,32 +4578,37 @@ class LiveEventEndpoint(Model): 'url': {'key': 'url', 'type': 'str'}, } - def __init__(self, *, protocol: str=None, url: str=None, **kwargs) -> None: + def __init__( + self, + *, + protocol: Optional[str] = None, + url: Optional[str] = None, + **kwargs + ): super(LiveEventEndpoint, self).__init__(**kwargs) self.protocol = protocol self.url = url -class LiveEventInput(Model): - """The Live Event input. +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 streaming 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: The access control for LiveEvent Input. + :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 timespan duration of the key - frame interval duration. + :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 unique identifier for a stream. This can be - specified at creation time but cannot be updated. If omitted, the service - will generate a unique value. + :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. + :param endpoints: The input endpoints for the live event. :type endpoints: list[~azure.mgmt.media.models.LiveEventEndpoint] """ @@ -3879,7 +4624,16 @@ class LiveEventInput(Model): 'endpoints': {'key': 'endpoints', 'type': '[LiveEventEndpoint]'}, } - def __init__(self, *, streaming_protocol, access_control=None, key_frame_interval_duration: str=None, access_token: str=None, endpoints=None, **kwargs) -> None: + def __init__( + self, + *, + streaming_protocol: Union[str, "LiveEventInputProtocol"], + access_control: Optional["LiveEventInputAccessControl"] = None, + key_frame_interval_duration: Optional[str] = None, + access_token: Optional[str] = None, + endpoints: Optional[List["LiveEventEndpoint"]] = None, + **kwargs + ): super(LiveEventInput, self).__init__(**kwargs) self.streaming_protocol = streaming_protocol self.access_control = access_control @@ -3888,8 +4642,8 @@ def __init__(self, *, streaming_protocol, access_control=None, key_frame_interva self.endpoints = endpoints -class LiveEventInputAccessControl(Model): - """The IP access control for Live Event Input. +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 @@ -3899,35 +4653,131 @@ class LiveEventInputAccessControl(Model): 'ip': {'key': 'ip', 'type': 'IPAccessControl'}, } - def __init__(self, *, ip=None, **kwargs) -> None: + def __init__( + self, + *, + ip: Optional["IPAccessControl"] = None, + **kwargs + ): super(LiveEventInputAccessControl, self).__init__(**kwargs) self.ip = ip -class LiveEventPreview(Model): - """The Live Event preview. +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, + *, + property: Optional[str] = None, + operation: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): + super(LiveEventInputTrackSelection, self).__init__(**kwargs) + self.property = property + self.operation = operation + self.value = value + + +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, + *, + value: Optional[List["LiveEvent"]] = None, + odata_count: Optional[int] = None, + odata_next_link: Optional[str] = None, + **kwargs + ): + super(LiveEventListResult, self).__init__(**kwargs) + self.value = value + self.odata_count = odata_count + self.odata_next_link = odata_next_link + + +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, + *, + track_name: str, + **kwargs + ): + super(LiveEventOutputTranscriptionTrack, self).__init__(**kwargs) + self.track_name = track_name + - :param endpoints: The endpoints for preview. +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 LiveEvent 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. + :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 - LiveEvent preview. This value is specified at creation time and cannot be - updated. + :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 StreamingLocator 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. + :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 """ @@ -3939,7 +4789,16 @@ class LiveEventPreview(Model): 'alternative_media_id': {'key': 'alternativeMediaId', 'type': 'str'}, } - def __init__(self, *, endpoints=None, access_control=None, preview_locator: str=None, streaming_policy_name: str=None, alternative_media_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + endpoints: Optional[List["LiveEventEndpoint"]] = None, + access_control: Optional["LiveEventPreviewAccessControl"] = None, + preview_locator: Optional[str] = None, + streaming_policy_name: Optional[str] = None, + alternative_media_id: Optional[str] = None, + **kwargs + ): super(LiveEventPreview, self).__init__(**kwargs) self.endpoints = endpoints self.access_control = access_control @@ -3948,8 +4807,8 @@ def __init__(self, *, endpoints=None, access_control=None, preview_locator: str= self.alternative_media_id = alternative_media_id -class LiveEventPreviewAccessControl(Model): - """The IP access control for Live Event preview. +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 @@ -3959,58 +4818,99 @@ class LiveEventPreviewAccessControl(Model): 'ip': {'key': 'ip', 'type': 'IPAccessControl'}, } - def __init__(self, *, ip=None, **kwargs) -> None: + def __init__( + self, + *, + ip: Optional["IPAccessControl"] = None, + **kwargs + ): super(LiveEventPreviewAccessControl, self).__init__(**kwargs) self.ip = ip -class LiveOutput(ProxyResource): - """The Live Output. +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. - Variables are only populated by the server, and will be ignored when - sending a request. + :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 + """ - All required parameters must be populated in order to send to Azure. + _attribute_map = { + 'language': {'key': 'language', 'type': 'str'}, + 'input_track_selection': {'key': 'inputTrackSelection', 'type': '[LiveEventInputTrackSelection]'}, + 'output_transcription_track': {'key': 'outputTranscriptionTrack', 'type': 'LiveEventOutputTranscriptionTrack'}, + } + + def __init__( + self, + *, + language: Optional[str] = None, + input_track_selection: Optional[List["LiveEventInputTrackSelection"]] = None, + output_transcription_track: Optional["LiveEventOutputTranscriptionTrack"] = None, + **kwargs + ): + super(LiveEventTranscription, self).__init__(**kwargs) + self.language = language + self.input_track_selection = input_track_selection + self.output_transcription_track = output_transcription_track + + +class LiveOutput(Resource): + """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. + :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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param description: The description of the Live Output. + :param description: The description of the live output. :type description: str - :param asset_name: Required. The asset name. + :param asset_name: The asset that the live output will write to. :type asset_name: str - :param archive_window_length: Required. ISO 8601 timespan duration of the - archive window length. This is duration that customer want to retain the - recorded content. - :type archive_window_length: timedelta - :param manifest_name: The manifest file name. If not provided, the - service will generate one automatically. + :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: The HLS configuration. + :param hls: HTTP Live Streaming (HLS) packing setting for the live output. :type hls: ~azure.mgmt.media.models.Hls - :param output_snap_time: The output snapshot time. + :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 exact time the Live Output was created. - :vartype created: datetime - :ivar last_modified: The exact time the Live Output was last modified. - :vartype last_modified: datetime - :ivar provisioning_state: The provisioning state of the Live Output. + :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 + :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}, - 'asset_name': {'required': True}, - 'archive_window_length': {'required': True}, 'created': {'readonly': True}, 'last_modified': {'readonly': True}, 'provisioning_state': {'readonly': True}, @@ -4033,7 +4933,17 @@ class LiveOutput(ProxyResource): 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, } - def __init__(self, *, asset_name: str, archive_window_length, description: str=None, manifest_name: str=None, hls=None, output_snap_time: int=None, **kwargs) -> None: + def __init__( + self, + *, + description: Optional[str] = None, + asset_name: Optional[str] = None, + archive_window_length: Optional[datetime.timedelta] = None, + manifest_name: Optional[str] = None, + hls: Optional["Hls"] = None, + output_snap_time: Optional[int] = None, + **kwargs + ): super(LiveOutput, self).__init__(**kwargs) self.description = description self.asset_name = asset_name @@ -4047,7 +4957,39 @@ def __init__(self, *, asset_name: str, archive_window_length, description: str=N self.resource_state = None -class Location(Model): +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, + *, + value: Optional[List["LiveOutput"]] = None, + odata_count: Optional[int] = None, + odata_next_link: Optional[str] = None, + **kwargs + ): + super(LiveOutputListResult, self).__init__(**kwargs) + self.value = value + self.odata_count = odata_count + self.odata_next_link = odata_next_link + + +class Location(msrest.serialization.Model): """Location. All required parameters must be populated in order to send to Azure. @@ -4064,37 +5006,87 @@ class Location(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, *, name: str, **kwargs) -> None: + def __init__( + self, + *, + name: str, + **kwargs + ): super(Location, self).__init__(**kwargs) self.name = name +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. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. + 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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param location: The Azure Region of the resource. + :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 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 """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'location': {'required': True}, 'media_service_id': {'readonly': True}, } @@ -4104,72 +5096,102 @@ class MediaService(TrackedResource): 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'MediaServiceIdentity'}, 'media_service_id': {'key': 'properties.mediaServiceId', 'type': 'str'}, 'storage_accounts': {'key': 'properties.storageAccounts', 'type': '[StorageAccount]'}, - } - - def __init__(self, *, tags=None, location: str=None, storage_accounts=None, **kwargs) -> None: + 'storage_authentication': {'key': 'properties.storageAuthentication', 'type': 'str'}, + 'encryption': {'key': 'properties.encryption', 'type': 'AccountEncryption'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional["MediaServiceIdentity"] = None, + storage_accounts: Optional[List["StorageAccount"]] = None, + storage_authentication: Optional[Union[str, "StorageAuthentication"]] = None, + encryption: Optional["AccountEncryption"] = None, + **kwargs + ): super(MediaService, self).__init__(tags=tags, location=location, **kwargs) + self.identity = identity self.media_service_id = None self.storage_accounts = storage_accounts + self.storage_authentication = storage_authentication + self.encryption = encryption -class Metric(Model): - """A metric emitted by service. +class MediaServiceCollection(msrest.serialization.Model): + """A collection of MediaService items. - Variables are only populated by the server, and will be ignored when - sending a request. + :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 + """ - :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 dimensions: The metric dimensions. - :vartype dimensions: list[~azure.mgmt.media.models.MetricDimension] + _attribute_map = { + 'value': {'key': 'value', 'type': '[MediaService]'}, + 'odata_next_link': {'key': '@odata\\.nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["MediaService"]] = None, + odata_next_link: Optional[str] = None, + **kwargs + ): + super(MediaServiceCollection, self).__init__(**kwargs) + self.value = value + self.odata_next_link = odata_next_link + + +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. Possible values include: "SystemAssigned", "None". + :type type: str or ~azure.mgmt.media.models.ManagedIdentityType + :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 """ _validation = { - 'name': {'readonly': True}, - 'display_name': {'readonly': True}, - 'display_description': {'readonly': True}, - 'unit': {'readonly': True}, - 'aggregation_type': {'readonly': True}, - 'dimensions': {'readonly': True}, + 'type': {'required': True}, + 'principal_id': {'readonly': True}, + 'tenant_id': {'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'}, - 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, + 'type': {'key': 'type', 'type': 'str'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: - super(Metric, self).__init__(**kwargs) - self.name = None - self.display_name = None - self.display_description = None - self.unit = None - self.aggregation_type = None - self.dimensions = None + def __init__( + self, + *, + type: Union[str, "ManagedIdentityType"], + **kwargs + ): + super(MediaServiceIdentity, self).__init__(**kwargs) + self.type = type + self.principal_id = None + self.tenant_id = None -class MetricDimension(Model): +class MetricDimension(msrest.serialization.Model): """A metric dimension. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar name: The metric dimension name. :vartype name: str @@ -4191,84 +5213,124 @@ class MetricDimension(Model): 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(MetricDimension, self).__init__(**kwargs) self.name = None self.display_name = None self.to_be_exported_for_shoebox = None -class MetricProperties(Model): - """Metric properties. +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. + 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 + :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 + :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] """ _validation = { - 'service_specification': {'readonly': True}, + 'name': {'readonly': True}, + 'display_name': {'readonly': True}, + 'display_description': {'readonly': True}, + 'unit': {'readonly': True}, + 'aggregation_type': {'readonly': True}, + 'dimensions': {'readonly': True}, } _attribute_map = { - 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, + 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, } - def __init__(self, **kwargs) -> None: - super(MetricProperties, self).__init__(**kwargs) - self.service_specification = None + def __init__( + self, + *, + supported_aggregation_types: Optional[List[str]] = None, + **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.supported_aggregation_types = supported_aggregation_types + self.dimensions = 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. + """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 + sub-classes are: Mp4Format, TransportStreamFormat. All required parameters must be populated in order to send to Azure. - :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} - The base name of the input video {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. Any unsubstituted - macros will be collapsed and removed from the filename. + :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. Any + unsubstituted macros will be collapsed and removed from the filename. :type filename_pattern: str - :param odatatype: Required. Constant filled by server. - :type odatatype: 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 . + :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}, - 'odatatype': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'filename_pattern': {'key': 'filenamePattern', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, 'output_files': {'key': 'outputFiles', 'type': '[OutputFile]'}, } _subtype_map = { - 'odatatype': {'#Microsoft.Media.Mp4Format': 'Mp4Format', '#Microsoft.Media.TransportStreamFormat': 'TransportStreamFormat'} + 'odata_type': {'#Microsoft.Media.Mp4Format': 'Mp4Format', '#Microsoft.Media.TransportStreamFormat': 'TransportStreamFormat'} } - def __init__(self, *, filename_pattern: str, output_files=None, **kwargs) -> None: + def __init__( + self, + *, + filename_pattern: str, + output_files: Optional[List["OutputFile"]] = None, + **kwargs + ): super(MultiBitrateFormat, self).__init__(filename_pattern=filename_pattern, **kwargs) + self.odata_type = '#Microsoft.Media.MultiBitrateFormat' # type: str self.output_files = output_files - self.odatatype = '#Microsoft.Media.MultiBitrateFormat' class Mp4Format(MultiBitrateFormat): @@ -4276,42 +5338,50 @@ class Mp4Format(MultiBitrateFormat): All required parameters must be populated in order to send to Azure. - :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} - The base name of the input video {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. Any unsubstituted - macros will be collapsed and removed from the filename. + :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. Any + unsubstituted macros will be collapsed and removed from the filename. :type filename_pattern: str - :param odatatype: Required. Constant filled by server. - :type odatatype: 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 . + :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}, - 'odatatype': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'filename_pattern': {'key': 'filenamePattern', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, 'output_files': {'key': 'outputFiles', 'type': '[OutputFile]'}, } - def __init__(self, *, filename_pattern: str, output_files=None, **kwargs) -> None: + def __init__( + self, + *, + filename_pattern: str, + output_files: Optional[List["OutputFile"]] = None, + **kwargs + ): super(Mp4Format, self).__init__(filename_pattern=filename_pattern, output_files=output_files, **kwargs) - self.odatatype = '#Microsoft.Media.Mp4Format' + self.odata_type = '#Microsoft.Media.Mp4Format' # type: str -class NoEncryption(Model): +class NoEncryption(msrest.serialization.Model): """Class for NoEncryption scheme. - :param enabled_protocols: Representing supported protocols + :param enabled_protocols: Representing supported protocols. :type enabled_protocols: ~azure.mgmt.media.models.EnabledProtocols """ @@ -4319,20 +5389,24 @@ class NoEncryption(Model): 'enabled_protocols': {'key': 'enabledProtocols', 'type': 'EnabledProtocols'}, } - def __init__(self, *, enabled_protocols=None, **kwargs) -> None: + def __init__( + self, + *, + enabled_protocols: Optional["EnabledProtocols"] = None, + **kwargs + ): super(NoEncryption, self).__init__(**kwargs) self.enabled_protocols = enabled_protocols -class ODataError(Model): +class ODataError(msrest.serialization.Model): """Information about an error. :param code: A language-independent error name. :type code: str :param message: The error message. :type message: str - :param target: The target of the error (for example, the name of the - property in error). + :param target: The target of the error (for example, the name of the property in error). :type target: str :param details: The error details. :type details: list[~azure.mgmt.media.models.ODataError] @@ -4345,7 +5419,15 @@ class ODataError(Model): 'details': {'key': 'details', 'type': '[ODataError]'}, } - def __init__(self, *, code: str=None, message: str=None, target: str=None, details=None, **kwargs) -> None: + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["ODataError"]] = None, + **kwargs + ): super(ODataError, self).__init__(**kwargs) self.code = code self.message = message @@ -4353,7 +5435,7 @@ def __init__(self, *, code: str=None, message: str=None, target: str=None, detai self.details = details -class Operation(Model): +class Operation(msrest.serialization.Model): """An operation. All required parameters must be populated in order to send to Azure. @@ -4365,7 +5447,7 @@ class Operation(Model): :param origin: Origin of the operation. :type origin: str :param properties: Operation properties format. - :type properties: ~azure.mgmt.media.models.MetricProperties + :type properties: ~azure.mgmt.media.models.Properties """ _validation = { @@ -4376,10 +5458,18 @@ class Operation(Model): 'name': {'key': 'name', 'type': 'str'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'MetricProperties'}, - } - - def __init__(self, *, name: str, display=None, origin: str=None, properties=None, **kwargs) -> None: + 'properties': {'key': 'properties', 'type': 'Properties'}, + } + + def __init__( + self, + *, + name: str, + display: Optional["OperationDisplay"] = None, + origin: Optional[str] = None, + properties: Optional["Properties"] = None, + **kwargs + ): super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -4387,7 +5477,34 @@ def __init__(self, *, name: str, display=None, origin: str=None, properties=None self.properties = properties -class OperationDisplay(Model): +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] + :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': '[Operation]'}, + 'odata_next_link': {'key': '@odata\\.nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Operation"]] = None, + odata_next_link: Optional[str] = None, + **kwargs + ): + super(OperationCollection, self).__init__(**kwargs) + self.value = value + self.odata_next_link = odata_next_link + + +class OperationDisplay(msrest.serialization.Model): """Operation details. :param provider: The service provider. @@ -4407,7 +5524,15 @@ class OperationDisplay(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, description: str=None, **kwargs) -> None: + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -4415,17 +5540,16 @@ def __init__(self, *, provider: str=None, resource: str=None, operation: str=Non self.description = description -class OutputFile(Model): +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. + :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] """ @@ -4437,106 +5561,142 @@ class OutputFile(Model): 'labels': {'key': 'labels', 'type': '[str]'}, } - def __init__(self, *, labels, **kwargs) -> None: + def __init__( + self, + *, + labels: List[str], + **kwargs + ): super(OutputFile, self).__init__(**kwargs) self.labels = labels -class PngFormat(ImageFormat): +class PngFormat(Format): """Describes the settings for producing PNG thumbnails. All required parameters must be populated in order to send to Azure. - :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} - The base name of the input video {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. Any unsubstituted - macros will be collapsed and removed from the filename. + :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. Any + unsubstituted macros will be collapsed and removed from the filename. :type filename_pattern: str - :param odatatype: Required. Constant filled by server. - :type odatatype: str """ _validation = { + 'odata_type': {'required': True}, 'filename_pattern': {'required': True}, - 'odatatype': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'filename_pattern': {'key': 'filenamePattern', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, } - def __init__(self, *, filename_pattern: str, **kwargs) -> None: + def __init__( + self, + *, + filename_pattern: str, + **kwargs + ): super(PngFormat, self).__init__(filename_pattern=filename_pattern, **kwargs) - self.odatatype = '#Microsoft.Media.PngFormat' + 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. + """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 label: An optional label for the codec. The label can be used to - control muxing behavior. + :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 odatatype: Required. Constant filled by server. - :type odatatype: str - :param key_frame_interval: The distance between two key frames, thereby - defining a group of pictures (GOP). The value should be a non-zero integer - in the range [1, 30] seconds, specified in ISO 8601 format. The default is - 2 seconds (PT2S). - :type key_frame_interval: 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' + :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 start: Required. The position in the input video from where to - start generating thumbnails. The value can be in absolute timestamp (ISO - 8601, e.g: PT05S), or a frame count (For example, 10 for the 10th frame), - or a relative value (For example, 1%). Also supports a macro {Best}, which - tells the encoder to select the best thumbnail from the first few seconds - of the video. + :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 absolute timestamp (ISO 8601, e.g: PT05S for one image every 5 - seconds), or a frame count (For example, 30 for every 30 frames), or a - relative value (For example, 1%). + :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 in the input video at which to stop generating - thumbnails. The value can be in absolute timestamp (ISO 8601, e.g: PT5M30S - to stop at 5 minutes and 30 seconds), or a frame count (For example, 300 - to stop at the 300th frame), or a relative value (For example, 100%). + :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] + :param layers: A collection of output PNG image layers to be produced by the encoder. + :type layers: list[~azure.mgmt.media.models.Layer] """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, 'start': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'label': {'key': 'label', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', '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, *, start: str, label: str=None, key_frame_interval=None, stretch_mode=None, step: str=None, range: str=None, layers=None, **kwargs) -> None: - super(PngImage, self).__init__(label=label, key_frame_interval=key_frame_interval, stretch_mode=stretch_mode, start=start, step=step, range=range, **kwargs) + 'layers': {'key': 'layers', 'type': '[Layer]'}, + } + + def __init__( + self, + *, + start: str, + label: Optional[str] = None, + key_frame_interval: Optional[datetime.timedelta] = None, + stretch_mode: Optional[Union[str, "StretchMode"]] = None, + sync_mode: Optional[Union[str, "VideoSyncMode"]] = None, + step: Optional[str] = None, + range: Optional[str] = None, + layers: Optional[List["Layer"]] = None, + **kwargs + ): + 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 - self.odatatype = '#Microsoft.Media.PngImage' class PngLayer(Layer): @@ -4544,41 +5704,46 @@ class PngLayer(Layer): All required parameters must be populated in order to send to Azure. - :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. + :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. + :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. + :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 odatatype: Required. Constant filled by server. - :type odatatype: str """ _validation = { - 'odatatype': {'required': True}, + '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'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, } - def __init__(self, *, width: str=None, height: str=None, label: str=None, **kwargs) -> None: + def __init__( + self, + *, + width: Optional[str] = None, + height: Optional[str] = None, + label: Optional[str] = None, + **kwargs + ): super(PngLayer, self).__init__(width=width, height=height, label=label, **kwargs) - self.odatatype = '#Microsoft.Media.PngLayer' + self.odata_type = '#Microsoft.Media.PngLayer' # type: str -class PresentationTimeRange(Model): - """The presentation time range, this is asset related and not recommended for - Account Filter. +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 @@ -4590,8 +5755,7 @@ class PresentationTimeRange(Model): :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. + :param force_end_timestamp: The indicator of forcing existing of end time stamp. :type force_end_timestamp: bool """ @@ -4604,7 +5768,17 @@ class PresentationTimeRange(Model): 'force_end_timestamp': {'key': 'forceEndTimestamp', 'type': 'bool'}, } - def __init__(self, *, start_timestamp: int=None, end_timestamp: int=None, presentation_window_duration: int=None, live_backoff_duration: int=None, timescale: int=None, force_end_timestamp: bool=None, **kwargs) -> None: + def __init__( + self, + *, + start_timestamp: Optional[int] = None, + end_timestamp: Optional[int] = None, + presentation_window_duration: Optional[int] = None, + live_backoff_duration: Optional[int] = None, + timescale: Optional[int] = None, + force_end_timestamp: Optional[bool] = None, + **kwargs + ): super(PresentationTimeRange, self).__init__(**kwargs) self.start_timestamp = start_timestamp self.end_timestamp = end_timestamp @@ -4614,7 +5788,236 @@ def __init__(self, *, start_timestamp: int=None, end_timestamp: int=None, presen self.force_end_timestamp = force_end_timestamp -class Provider(Model): +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, + *, + private_endpoint: Optional["PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + **kwargs + ): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + 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, + *, + value: Optional[List["PrivateEndpointConnection"]] = None, + **kwargs + ): + super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + self.value = value + + +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, + *, + required_zone_names: Optional[List[str]] = None, + **kwargs + ): + super(PrivateLinkResource, self).__init__(**kwargs) + self.group_id = None + self.required_members = None + self.required_zone_names = required_zone_names + + +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, + *, + value: Optional[List["PrivateLinkResource"]] = None, + **kwargs + ): + super(PrivateLinkResourceListResult, self).__init__(**kwargs) + self.value = value + + +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, + *, + status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[str] = None, + **kwargs + ): + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = status + self.description = description + self.actions_required = actions_required + + +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 Provider(msrest.serialization.Model): """A resource provider. All required parameters must be populated in order to send to Azure. @@ -4631,30 +6034,64 @@ class Provider(Model): 'provider_name': {'key': 'providerName', 'type': 'str'}, } - def __init__(self, *, provider_name: str, **kwargs) -> None: + def __init__( + self, + *, + provider_name: str, + **kwargs + ): super(Provider, self).__init__(**kwargs) self.provider_name = provider_name -class Rectangle(Model): - """Describes the properties of a rectangular window applied to the input media - before processing it. +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}, + } - :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%). + _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 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%). + :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%). + :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%). + :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 """ @@ -4665,7 +6102,15 @@ class Rectangle(Model): 'height': {'key': 'height', 'type': 'str'}, } - def __init__(self, *, left: str=None, top: str=None, width: str=None, height: str=None, **kwargs) -> None: + def __init__( + self, + *, + left: Optional[str] = None, + top: Optional[str] = None, + width: Optional[str] = None, + height: Optional[str] = None, + **kwargs + ): super(Rectangle, self).__init__(**kwargs) self.left = left self.top = top @@ -4673,82 +6118,92 @@ def __init__(self, *, left: str=None, top: str=None, width: str=None, height: st self.height = height -class ServiceSpecification(Model): +class ServiceSpecification(msrest.serialization.Model): """The service metric specifications. - Variables are only populated by the server, and will be ignored when - sending a request. + 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.Metric] + :vartype metric_specifications: list[~azure.mgmt.media.models.MetricSpecification] """ _validation = { + 'log_specifications': {'readonly': True}, 'metric_specifications': {'readonly': True}, } _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[Metric]'}, + 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, } - def __init__(self, **kwargs) -> None: + 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. + """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 odatatype: Required. Constant filled by server. - :type odatatype: str - :param filters: One or more filtering operations that are applied to the - input media before encoding. + :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. + :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. + :param formats: Required. The list of outputs to be produced by the encoder. :type formats: list[~azure.mgmt.media.models.Format] """ _validation = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, 'codecs': {'required': True}, 'formats': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + '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, *, codecs, formats, filters=None, **kwargs) -> None: + def __init__( + self, + *, + codecs: List["Codec"], + formats: List["Format"], + filters: Optional["Filters"] = None, + **kwargs + ): super(StandardEncoderPreset, self).__init__(**kwargs) + self.odata_type = '#Microsoft.Media.StandardEncoderPreset' # type: str self.filters = filters self.codecs = codecs self.formats = formats - self.odatatype = '#Microsoft.Media.StandardEncoderPreset' -class StorageAccount(Model): +class StorageAccount(msrest.serialization.Model): """The storage account details. 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. + :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' + :param type: Required. The type of the storage account. Possible values include: "Primary", + "Secondary". :type type: str or ~azure.mgmt.media.models.StorageAccountType """ @@ -4761,15 +6216,20 @@ class StorageAccount(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, type, id: str=None, **kwargs) -> None: + def __init__( + self, + *, + type: Union[str, "StorageAccountType"], + id: Optional[str] = None, + **kwargs + ): super(StorageAccount, self).__init__(**kwargs) self.id = id self.type = type -class StorageEncryptedAssetDecryptionData(Model): - """Data needed to decrypt asset files encrypted with legacy storage - encryption. +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 @@ -4783,48 +6243,50 @@ class StorageEncryptedAssetDecryptionData(Model): 'asset_file_encryption_metadata': {'key': 'assetFileEncryptionMetadata', 'type': '[AssetFileEncryptionMetadata]'}, } - def __init__(self, *, key: bytearray=None, asset_file_encryption_metadata=None, **kwargs) -> None: + def __init__( + self, + *, + key: Optional[bytearray] = None, + asset_file_encryption_metadata: Optional[List["AssetFileEncryptionMetadata"]] = None, + **kwargs + ): super(StorageEncryptedAssetDecryptionData, self).__init__(**kwargs) self.key = key self.asset_file_encryption_metadata = asset_file_encryption_metadata class StreamingEndpoint(TrackedResource): - """The StreamingEndpoint. + """The streaming endpoint. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. + :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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param location: The Azure Region of the resource. + :param location: Required. The geo-location where the resource lives. :type location: str - :param description: The StreamingEndpoint description. + :param description: The streaming endpoint description. :type description: str - :param scale_units: Required. The number of scale units. Use the Scale - operation to adjust this value. + :param scale_units: The number of scale units. Use the Scale operation to adjust this value. :type scale_units: int - :param availability_set_name: The name of the AvailabilitySet used with - this StreamingEndpoint for high availability streaming. This value can - only be set at creation time. + :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 - StreamingEndpoint. - :type access_control: - ~azure.mgmt.media.models.StreamingEndpointAccessControl - :param max_cache_age: Max cache age + :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 StreamingEndpoint + :param custom_host_names: The custom host names of the streaming endpoint. :type custom_host_names: list[str] - :ivar host_name: The StreamingEndpoint host name. + :ivar host_name: The streaming endpoint host name. :vartype host_name: str :param cdn_enabled: The CDN enabled flag. :type cdn_enabled: bool @@ -4832,30 +6294,26 @@ class StreamingEndpoint(TrackedResource): :type cdn_provider: str :param cdn_profile: The CDN profile name. :type cdn_profile: str - :ivar provisioning_state: The provisioning state of the StreamingEndpoint. + :ivar provisioning_state: The provisioning state of the streaming endpoint. :vartype provisioning_state: str - :ivar resource_state: The resource state of the StreamingEndpoint. - 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 StreamingEndpoint access policies. - :type cross_site_access_policies: - ~azure.mgmt.media.models.CrossSiteAccessPolicies + :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 - :ivar created: The exact time the StreamingEndpoint was created. - :vartype created: datetime - :ivar last_modified: The exact time the StreamingEndpoint was last - modified. - :vartype last_modified: datetime + :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}, - 'scale_units': {'required': True}, + 'location': {'required': True}, 'host_name': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'resource_state': {'readonly': True}, @@ -4888,7 +6346,23 @@ class StreamingEndpoint(TrackedResource): 'last_modified': {'key': 'properties.lastModified', 'type': 'iso-8601'}, } - def __init__(self, *, scale_units: int, tags=None, location: str=None, description: str=None, availability_set_name: str=None, access_control=None, max_cache_age: int=None, custom_host_names=None, cdn_enabled: bool=None, cdn_provider: str=None, cdn_profile: str=None, cross_site_access_policies=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + description: Optional[str] = None, + scale_units: Optional[int] = None, + availability_set_name: Optional[str] = None, + access_control: Optional["StreamingEndpointAccessControl"] = None, + max_cache_age: Optional[int] = None, + custom_host_names: Optional[List[str]] = None, + cdn_enabled: Optional[bool] = None, + cdn_provider: Optional[str] = None, + cdn_profile: Optional[str] = None, + cross_site_access_policies: Optional["CrossSiteAccessPolicies"] = None, + **kwargs + ): super(StreamingEndpoint, self).__init__(tags=tags, location=location, **kwargs) self.description = description self.scale_units = scale_units @@ -4908,12 +6382,12 @@ def __init__(self, *, scale_units: int, tags=None, location: str=None, descripti self.last_modified = None -class StreamingEndpointAccessControl(Model): - """StreamingEndpoint access control definition. +class StreamingEndpointAccessControl(msrest.serialization.Model): + """Streaming endpoint access control definition. - :param akamai: The access control of Akamai + :param akamai: The access control of Akamai. :type akamai: ~azure.mgmt.media.models.AkamaiAccessControl - :param ip: The IP access control of the StreamingEndpoint. + :param ip: The IP access control of the streaming endpoint. :type ip: ~azure.mgmt.media.models.IPAccessControl """ @@ -4922,16 +6396,54 @@ class StreamingEndpointAccessControl(Model): 'ip': {'key': 'ip', 'type': 'IPAccessControl'}, } - def __init__(self, *, akamai=None, ip=None, **kwargs) -> None: + def __init__( + self, + *, + akamai: Optional["AkamaiAccessControl"] = None, + ip: Optional["IPAccessControl"] = None, + **kwargs + ): super(StreamingEndpointAccessControl, self).__init__(**kwargs) self.akamai = akamai self.ip = ip -class StreamingEntityScaleUnit(Model): +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, + *, + value: Optional[List["StreamingEndpoint"]] = None, + odata_count: Optional[int] = None, + odata_next_link: Optional[str] = None, + **kwargs + ): + super(StreamingEndpointListResult, self).__init__(**kwargs) + self.value = value + self.odata_count = odata_count + self.odata_next_link = odata_next_link + + +class StreamingEntityScaleUnit(msrest.serialization.Model): """scale units definition. - :param scale_unit: The scale unit number of the StreamingEndpoint. + :param scale_unit: The scale unit number of the streaming endpoint. :type scale_unit: int """ @@ -4939,55 +6451,53 @@ class StreamingEntityScaleUnit(Model): 'scale_unit': {'key': 'scaleUnit', 'type': 'int'}, } - def __init__(self, *, scale_unit: int=None, **kwargs) -> None: + def __init__( + self, + *, + scale_unit: Optional[int] = None, + **kwargs + ): super(StreamingEntityScaleUnit, self).__init__(**kwargs) self.scale_unit = scale_unit -class StreamingLocator(ProxyResource): +class StreamingLocator(Resource): """A Streaming Locator resource. - 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. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. + :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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param asset_name: Required. Asset Name + :param asset_name: Asset Name. :type asset_name: str :ivar created: The creation time of the Streaming Locator. - :vartype created: datetime + :vartype created: ~datetime.datetime :param start_time: The start time of the Streaming Locator. - :type start_time: datetime + :type start_time: ~datetime.datetime :param end_time: The end time of the Streaming Locator. - :type end_time: datetime - :param streaming_locator_id: The StreamingLocatorId 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: Required. 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' + :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. + :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 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 + :param filters: A list of asset or account filters which apply to this streaming locator. :type filters: list[str] """ @@ -4995,9 +6505,7 @@ class StreamingLocator(ProxyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'asset_name': {'required': True}, 'created': {'readonly': True}, - 'streaming_policy_name': {'required': True}, } _attribute_map = { @@ -5016,7 +6524,20 @@ class StreamingLocator(ProxyResource): 'filters': {'key': 'properties.filters', 'type': '[str]'}, } - def __init__(self, *, asset_name: str, streaming_policy_name: str, start_time=None, end_time=None, streaming_locator_id: str=None, default_content_key_policy_name: str=None, content_keys=None, alternative_media_id: str=None, filters=None, **kwargs) -> None: + def __init__( + self, + *, + asset_name: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + streaming_locator_id: Optional[str] = None, + streaming_policy_name: Optional[str] = None, + default_content_key_policy_name: Optional[str] = None, + content_keys: Optional[List["StreamingLocatorContentKey"]] = None, + alternative_media_id: Optional[str] = None, + filters: Optional[List[str]] = None, + **kwargs + ): super(StreamingLocator, self).__init__(**kwargs) self.asset_name = asset_name self.created = None @@ -5030,28 +6551,53 @@ def __init__(self, *, asset_name: str, streaming_policy_name: str, start_time=No self.filters = filters -class StreamingLocatorContentKey(Model): +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, + *, + value: Optional[List["StreamingLocator"]] = None, + odata_next_link: Optional[str] = None, + **kwargs + ): + super(StreamingLocatorCollection, self).__init__(**kwargs) + self.value = value + self.odata_next_link = odata_next_link + + +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. + 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 + :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 + :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 + :param value: Value of Content Key. :type value: str - :ivar policy_name: ContentKeyPolicy used by Content Key + :ivar policy_name: ContentKeyPolicy used by Content Key. :vartype policy_name: str - :ivar tracks: Tracks which use this Content Key + :ivar tracks: Tracks which use this Content Key. :vartype tracks: list[~azure.mgmt.media.models.TrackSelection] """ @@ -5071,7 +6617,14 @@ class StreamingLocatorContentKey(Model): 'tracks': {'key': 'tracks', 'type': '[TrackSelection]'}, } - def __init__(self, *, id: str, label_reference_in_streaming_policy: str=None, value: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: str, + label_reference_in_streaming_policy: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): super(StreamingLocatorContentKey, self).__init__(**kwargs) self.id = id self.type = None @@ -5081,20 +6634,18 @@ def __init__(self, *, id: str, label_reference_in_streaming_policy: str=None, va self.tracks = None -class StreamingPath(Model): +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' + :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 + :param paths: Streaming paths for each protocol and encryptionScheme pair. :type paths: list[str] """ @@ -5109,39 +6660,44 @@ class StreamingPath(Model): 'paths': {'key': 'paths', 'type': '[str]'}, } - def __init__(self, *, streaming_protocol, encryption_scheme, paths=None, **kwargs) -> None: + def __init__( + self, + *, + streaming_protocol: Union[str, "StreamingPolicyStreamingProtocol"], + encryption_scheme: Union[str, "EncryptionScheme"], + paths: Optional[List[str]] = None, + **kwargs + ): super(StreamingPath, self).__init__(**kwargs) self.streaming_protocol = streaming_protocol self.encryption_scheme = encryption_scheme self.paths = paths -class StreamingPolicy(ProxyResource): +class StreamingPolicy(Resource): """A Streaming Policy resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. + :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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar created: Creation time of Streaming Policy - :vartype created: datetime - :param default_content_key_policy_name: Default ContentKey used by current - Streaming Policy + :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 + :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 + :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 """ @@ -5164,7 +6720,16 @@ class StreamingPolicy(ProxyResource): 'no_encryption': {'key': 'properties.noEncryption', 'type': 'NoEncryption'}, } - def __init__(self, *, default_content_key_policy_name: str=None, envelope_encryption=None, common_encryption_cenc=None, common_encryption_cbcs=None, no_encryption=None, **kwargs) -> None: + def __init__( + self, + *, + default_content_key_policy_name: Optional[str] = None, + envelope_encryption: Optional["EnvelopeEncryption"] = None, + common_encryption_cenc: Optional["CommonEncryptionCenc"] = None, + common_encryption_cbcs: Optional["CommonEncryptionCbcs"] = None, + no_encryption: Optional["NoEncryption"] = None, + **kwargs + ): super(StreamingPolicy, self).__init__(**kwargs) self.created = None self.default_content_key_policy_name = default_content_key_policy_name @@ -5174,15 +6739,41 @@ def __init__(self, *, default_content_key_policy_name: str=None, envelope_encryp self.no_encryption = no_encryption -class StreamingPolicyContentKey(Model): +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, + *, + value: Optional[List["StreamingPolicy"]] = None, + odata_next_link: Optional[str] = None, + **kwargs + ): + super(StreamingPolicyCollection, self).__init__(**kwargs) + self.value = value + self.odata_next_link = odata_next_link + + +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 + :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 + :param policy_name: Policy used by Content Key. :type policy_name: str - :param tracks: Tracks which use this content key + :param tracks: Tracks which use this content key. :type tracks: list[~azure.mgmt.media.models.TrackSelection] """ @@ -5192,22 +6783,27 @@ class StreamingPolicyContentKey(Model): 'tracks': {'key': 'tracks', 'type': '[TrackSelection]'}, } - def __init__(self, *, label: str=None, policy_name: str=None, tracks=None, **kwargs) -> None: + def __init__( + self, + *, + label: Optional[str] = None, + policy_name: Optional[str] = None, + tracks: Optional[List["TrackSelection"]] = None, + **kwargs + ): super(StreamingPolicyContentKey, self).__init__(**kwargs) self.label = label self.policy_name = policy_name self.tracks = tracks -class StreamingPolicyContentKeys(Model): +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 + :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] + :param key_to_track_mappings: Representing tracks needs separate content key. + :type key_to_track_mappings: list[~azure.mgmt.media.models.StreamingPolicyContentKey] """ _attribute_map = { @@ -5215,28 +6811,32 @@ class StreamingPolicyContentKeys(Model): 'key_to_track_mappings': {'key': 'keyToTrackMappings', 'type': '[StreamingPolicyContentKey]'}, } - def __init__(self, *, default_key=None, key_to_track_mappings=None, **kwargs) -> None: + def __init__( + self, + *, + default_key: Optional["DefaultKey"] = None, + key_to_track_mappings: Optional[List["StreamingPolicyContentKey"]] = None, + **kwargs + ): super(StreamingPolicyContentKeys, self).__init__(**kwargs) self.default_key = default_key self.key_to_track_mappings = key_to_track_mappings -class StreamingPolicyFairPlayConfiguration(Model): +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. + :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 + :param allow_persistent_license: Required. All license to be persistent or not. :type allow_persistent_license: bool """ @@ -5249,25 +6849,30 @@ class StreamingPolicyFairPlayConfiguration(Model): 'allow_persistent_license': {'key': 'allowPersistentLicense', 'type': 'bool'}, } - def __init__(self, *, allow_persistent_license: bool, custom_license_acquisition_url_template: str=None, **kwargs) -> None: + def __init__( + self, + *, + allow_persistent_license: bool, + custom_license_acquisition_url_template: Optional[str] = None, + **kwargs + ): super(StreamingPolicyFairPlayConfiguration, self).__init__(**kwargs) self.custom_license_acquisition_url_template = custom_license_acquisition_url_template self.allow_persistent_license = allow_persistent_license -class StreamingPolicyPlayReadyConfiguration(Model): +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. + :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 + :param play_ready_custom_attributes: Custom attributes for PlayReady. :type play_ready_custom_attributes: str """ @@ -5276,23 +6881,28 @@ class StreamingPolicyPlayReadyConfiguration(Model): 'play_ready_custom_attributes': {'key': 'playReadyCustomAttributes', 'type': 'str'}, } - def __init__(self, *, custom_license_acquisition_url_template: str=None, play_ready_custom_attributes: str=None, **kwargs) -> None: + def __init__( + self, + *, + custom_license_acquisition_url_template: Optional[str] = None, + play_ready_custom_attributes: Optional[str] = None, + **kwargs + ): 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 -class StreamingPolicyWidevineConfiguration(Model): +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. + :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 """ @@ -5300,57 +6910,17 @@ class StreamingPolicyWidevineConfiguration(Model): 'custom_license_acquisition_url_template': {'key': 'customLicenseAcquisitionUrlTemplate', 'type': 'str'}, } - def __init__(self, *, custom_license_acquisition_url_template: str=None, **kwargs) -> None: + def __init__( + self, + *, + custom_license_acquisition_url_template: Optional[str] = None, + **kwargs + ): super(StreamingPolicyWidevineConfiguration, self).__init__(**kwargs) self.custom_license_acquisition_url_template = custom_license_acquisition_url_template -class SubscriptionMediaService(TrackedResource): - """A Media Services account. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified resource ID for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param location: The Azure Region of the resource. - :type location: str - :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] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'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'}, - 'media_service_id': {'key': 'properties.mediaServiceId', 'type': 'str'}, - 'storage_accounts': {'key': 'properties.storageAccounts', 'type': '[StorageAccount]'}, - } - - def __init__(self, *, tags=None, location: str=None, storage_accounts=None, **kwargs) -> None: - super(SubscriptionMediaService, self).__init__(tags=tags, location=location, **kwargs) - self.media_service_id = None - self.storage_accounts = storage_accounts - - -class SyncStorageKeysInput(Model): +class SyncStorageKeysInput(msrest.serialization.Model): """The input to the sync storage keys request. :param id: The ID of the storage account resource. @@ -5361,24 +6931,27 @@ class SyncStorageKeysInput(Model): 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, *, id: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): super(SyncStorageKeysInput, self).__init__(**kwargs) self.id = id -class TrackPropertyCondition(Model): +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' + :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 + :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 """ @@ -5393,58 +6966,64 @@ class TrackPropertyCondition(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, *, property, operation, value: str=None, **kwargs) -> None: + def __init__( + self, + *, + property: Union[str, "TrackPropertyType"], + operation: Union[str, "TrackPropertyCompareOperation"], + value: Optional[str] = None, + **kwargs + ): super(TrackPropertyCondition, self).__init__(**kwargs) self.property = property self.operation = operation self.value = value -class TrackSelection(Model): +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] + :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, *, track_selections=None, **kwargs) -> None: + def __init__( + self, + *, + track_selections: Optional[List["TrackPropertyCondition"]] = None, + **kwargs + ): super(TrackSelection, self).__init__(**kwargs) self.track_selections = track_selections -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. +class Transform(Resource): + """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. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. + :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. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar created: The UTC date and time when the Transform was created, in - 'YYYY-MM-DDThh:mm:ssZ' format. - :vartype created: datetime + :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 - :param outputs: Required. An array of one or more TransformOutputs that - the Transform should generate. + :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] """ @@ -5454,7 +7033,6 @@ class Transform(ProxyResource): 'type': {'readonly': True}, 'created': {'readonly': True}, 'last_modified': {'readonly': True}, - 'outputs': {'required': True}, } _attribute_map = { @@ -5467,7 +7045,13 @@ class Transform(ProxyResource): 'outputs': {'key': 'properties.outputs', 'type': '[TransformOutput]'}, } - def __init__(self, *, outputs, description: str=None, **kwargs) -> None: + def __init__( + self, + *, + description: Optional[str] = None, + outputs: Optional[List["TransformOutput"]] = None, + **kwargs + ): super(Transform, self).__init__(**kwargs) self.created = None self.description = description @@ -5475,27 +7059,50 @@ def __init__(self, *, outputs, description: str=None, **kwargs) -> None: self.outputs = outputs -class TransformOutput(Model): - """Describes the properties of a TransformOutput, which are the rules to be - applied while generating the desired output. +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, + *, + value: Optional[List["Transform"]] = None, + odata_next_link: Optional[str] = None, + **kwargs + ): + super(TransformCollection, self).__init__(**kwargs) + self.value = value + self.odata_next_link = odata_next_link + + +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' + :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' + :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. + :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 """ @@ -5509,7 +7116,14 @@ class TransformOutput(Model): 'preset': {'key': 'preset', 'type': 'Preset'}, } - def __init__(self, *, preset, on_error=None, relative_priority=None, **kwargs) -> None: + def __init__( + self, + *, + preset: "Preset", + on_error: Optional[Union[str, "OnErrorType"]] = None, + relative_priority: Optional[Union[str, "Priority"]] = None, + **kwargs + ): super(TransformOutput, self).__init__(**kwargs) self.on_error = on_error self.relative_priority = relative_priority @@ -5517,95 +7131,142 @@ def __init__(self, *, preset, on_error=None, relative_priority=None, **kwargs) - class TransportStreamFormat(MultiBitrateFormat): - """Describes the properties for generating an MPEG-2 Transport Stream (ISO/IEC - 13818-1) output video file(s). + """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 filename_pattern: Required. The pattern of the file names for the - generated output files. The following macros are supported in the file - name: {Basename} - The base name of the input video {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. Any unsubstituted - macros will be collapsed and removed from the filename. + :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. Any + unsubstituted macros will be collapsed and removed from the filename. :type filename_pattern: str - :param odatatype: Required. Constant filled by server. - :type odatatype: 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 . + :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}, - 'odatatype': {'required': True}, } _attribute_map = { + 'odata_type': {'key': '@odata\\.type', 'type': 'str'}, 'filename_pattern': {'key': 'filenamePattern', 'type': 'str'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, 'output_files': {'key': 'outputFiles', 'type': '[OutputFile]'}, } - def __init__(self, *, filename_pattern: str, output_files=None, **kwargs) -> None: + def __init__( + self, + *, + filename_pattern: str, + output_files: Optional[List["OutputFile"]] = None, + **kwargs + ): super(TransportStreamFormat, self).__init__(filename_pattern=filename_pattern, output_files=output_files, **kwargs) - self.odatatype = '#Microsoft.Media.TransportStreamFormat' + self.odata_type = '#Microsoft.Media.TransportStreamFormat' # type: str + + +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, + *, + time: datetime.datetime, + **kwargs + ): + super(UtcClipTime, self).__init__(**kwargs) + self.odata_type = '#Microsoft.Media.UtcClipTime' # type: str + self.time = time class VideoAnalyzerPreset(AudioAnalyzerPreset): - """A video analyzer preset that extracts insights (rich metadata) from both - audio and video, and outputs a JSON format file. + """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 odatatype: Required. Constant filled by server. - :type odatatype: 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. - 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 + :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 experimental_options: Dictionary containing key value pairs for - parameters not exposed in the preset itself + :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' + :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 = { - 'odatatype': {'required': True}, + 'odata_type': {'required': True}, } _attribute_map = { - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, + '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, *, audio_language: str=None, experimental_options=None, insights_to_extract=None, **kwargs) -> None: - super(VideoAnalyzerPreset, self).__init__(audio_language=audio_language, experimental_options=experimental_options, **kwargs) + def __init__( + self, + *, + audio_language: Optional[str] = None, + mode: Optional[Union[str, "AudioAnalysisMode"]] = None, + experimental_options: Optional[Dict[str, str]] = None, + insights_to_extract: Optional[Union[str, "InsightsType"]] = None, + **kwargs + ): + 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 - self.odatatype = '#Microsoft.Media.VideoAnalyzerPreset' class VideoOverlay(Overlay): @@ -5613,69 +7274,79 @@ class VideoOverlay(Overlay): All required parameters must be populated in order to send to Azure. - :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 or PNG formats, 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. + :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 or PNG formats, 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 in to the input video. If - not specified the overlay starts from the beginning of the input video. - :type start: timedelta - :param end: The position in the input video at which the overlay ends. The - value should be in ISO 8601 duration format. For example, PT30S to end the - overlay at 30 seconds in to the input video. If not specified the overlay - will be applied until the end of the input video if inputLoop is true. - Else, if inputLoop is false, then overlay will last as long as the - duration of the overlay media. - :type end: 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: 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: 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. + :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 odatatype: Required. Constant filled by server. - :type odatatype: str - :param position: The location in the input video where the overlay is - applied. + :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. + :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. + :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}, - 'odatatype': {'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'}, - 'odatatype': {'key': '@odata\\.type', 'type': 'str'}, 'position': {'key': 'position', 'type': 'Rectangle'}, 'opacity': {'key': 'opacity', 'type': 'float'}, 'crop_rectangle': {'key': 'cropRectangle', 'type': 'Rectangle'}, } - def __init__(self, *, input_label: str, start=None, end=None, fade_in_duration=None, fade_out_duration=None, audio_gain_level: float=None, position=None, opacity: float=None, crop_rectangle=None, **kwargs) -> None: + def __init__( + self, + *, + input_label: str, + start: Optional[datetime.timedelta] = None, + end: Optional[datetime.timedelta] = None, + fade_in_duration: Optional[datetime.timedelta] = None, + fade_out_duration: Optional[datetime.timedelta] = None, + audio_gain_level: Optional[float] = None, + position: Optional["Rectangle"] = None, + opacity: Optional[float] = None, + crop_rectangle: Optional["Rectangle"] = None, + **kwargs + ): 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 - self.odatatype = '#Microsoft.Media.VideoOverlay' diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/models/_paged_models.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/models/_paged_models.py deleted file mode 100644 index 0cda239e7ac6..000000000000 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/models/_paged_models.py +++ /dev/null @@ -1,196 +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 msrest.paging import Paged - - -class AccountFilterPaged(Paged): - """ - A paging container for iterating over a list of :class:`AccountFilter ` object - """ - - _attribute_map = { - 'next_link': {'key': '@odata\\.nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[AccountFilter]'} - } - - def __init__(self, *args, **kwargs): - - super(AccountFilterPaged, self).__init__(*args, **kwargs) -class OperationPaged(Paged): - """ - A paging container for iterating over a list of :class:`Operation ` object - """ - - _attribute_map = { - 'next_link': {'key': '@odata\\.nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Operation]'} - } - - def __init__(self, *args, **kwargs): - - super(OperationPaged, self).__init__(*args, **kwargs) -class MediaServicePaged(Paged): - """ - A paging container for iterating over a list of :class:`MediaService ` object - """ - - _attribute_map = { - 'next_link': {'key': '@odata\\.nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[MediaService]'} - } - - def __init__(self, *args, **kwargs): - - super(MediaServicePaged, self).__init__(*args, **kwargs) -class SubscriptionMediaServicePaged(Paged): - """ - A paging container for iterating over a list of :class:`SubscriptionMediaService ` object - """ - - _attribute_map = { - 'next_link': {'key': '@odata\\.nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SubscriptionMediaService]'} - } - - def __init__(self, *args, **kwargs): - - super(SubscriptionMediaServicePaged, self).__init__(*args, **kwargs) -class AssetPaged(Paged): - """ - A paging container for iterating over a list of :class:`Asset ` object - """ - - _attribute_map = { - 'next_link': {'key': '@odata\\.nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Asset]'} - } - - def __init__(self, *args, **kwargs): - - super(AssetPaged, self).__init__(*args, **kwargs) -class AssetFilterPaged(Paged): - """ - A paging container for iterating over a list of :class:`AssetFilter ` object - """ - - _attribute_map = { - 'next_link': {'key': '@odata\\.nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[AssetFilter]'} - } - - def __init__(self, *args, **kwargs): - - super(AssetFilterPaged, self).__init__(*args, **kwargs) -class ContentKeyPolicyPaged(Paged): - """ - A paging container for iterating over a list of :class:`ContentKeyPolicy ` object - """ - - _attribute_map = { - 'next_link': {'key': '@odata\\.nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ContentKeyPolicy]'} - } - - def __init__(self, *args, **kwargs): - - super(ContentKeyPolicyPaged, self).__init__(*args, **kwargs) -class TransformPaged(Paged): - """ - A paging container for iterating over a list of :class:`Transform ` object - """ - - _attribute_map = { - 'next_link': {'key': '@odata\\.nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Transform]'} - } - - def __init__(self, *args, **kwargs): - - super(TransformPaged, self).__init__(*args, **kwargs) -class JobPaged(Paged): - """ - A paging container for iterating over a list of :class:`Job ` object - """ - - _attribute_map = { - 'next_link': {'key': '@odata\\.nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Job]'} - } - - def __init__(self, *args, **kwargs): - - super(JobPaged, self).__init__(*args, **kwargs) -class StreamingPolicyPaged(Paged): - """ - A paging container for iterating over a list of :class:`StreamingPolicy ` object - """ - - _attribute_map = { - 'next_link': {'key': '@odata\\.nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[StreamingPolicy]'} - } - - def __init__(self, *args, **kwargs): - - super(StreamingPolicyPaged, self).__init__(*args, **kwargs) -class StreamingLocatorPaged(Paged): - """ - A paging container for iterating over a list of :class:`StreamingLocator ` object - """ - - _attribute_map = { - 'next_link': {'key': '@odata\\.nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[StreamingLocator]'} - } - - def __init__(self, *args, **kwargs): - - super(StreamingLocatorPaged, self).__init__(*args, **kwargs) -class LiveEventPaged(Paged): - """ - A paging container for iterating over a list of :class:`LiveEvent ` object - """ - - _attribute_map = { - 'next_link': {'key': '@odata\\.nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[LiveEvent]'} - } - - def __init__(self, *args, **kwargs): - - super(LiveEventPaged, self).__init__(*args, **kwargs) -class LiveOutputPaged(Paged): - """ - A paging container for iterating over a list of :class:`LiveOutput ` object - """ - - _attribute_map = { - 'next_link': {'key': '@odata\\.nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[LiveOutput]'} - } - - def __init__(self, *args, **kwargs): - - super(LiveOutputPaged, self).__init__(*args, **kwargs) -class StreamingEndpointPaged(Paged): - """ - A paging container for iterating over a list of :class:`StreamingEndpoint ` object - """ - - _attribute_map = { - 'next_link': {'key': '@odata\\.nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[StreamingEndpoint]'} - } - - def __init__(self, *args, **kwargs): - - super(StreamingEndpointPaged, self).__init__(*args, **kwargs) 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 3f95a0430d22..795a18cd9d99 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 @@ -1,17 +1,16 @@ # 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. -# +# 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. +# 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 ._assets_operations import AssetsOperations from ._asset_filters_operations import AssetFiltersOperations @@ -28,6 +27,8 @@ 'AccountFiltersOperations', 'Operations', 'MediaservicesOperations', + 'PrivateLinkResourcesOperations', + 'PrivateEndpointConnectionsOperations', 'LocationsOperations', 'AssetsOperations', 'AssetFiltersOperations', 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 d5314c312e92..1a57ef87a8b4 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 @@ -1,383 +1,407 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +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.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class AccountFiltersOperations(object): """AccountFiltersOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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. - :ivar api_version: The Version of the API to be used with the client request. Constant value: "2018-07-01". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-07-01" - - self.config = config + self._config = config def list( - self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AccountFilterCollection"] """List Account Filters. List Account Filters in the Media Services account. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AccountFilter - :rtype: - ~azure.mgmt.media.models.AccountFilterPaged[~azure.mgmt.media.models.AccountFilter] - :raises: - :class:`ApiErrorException` + :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.paging.ItemPaged[~azure.mgmt.media.models.AccountFilterCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccountFilterCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'accountName': self._serialize.url("account_name", account_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AccountFilterCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.odata_next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.ApiErrorException(self._deserialize, response) - - return response + error = self._deserialize(_models.ApiError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AccountFilterPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters'} # type: ignore def get( - self, resource_group_name, account_name, filter_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + filter_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.AccountFilter"] """Get an Account Filter. Get the details of an Account Filter in the Media Services account. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 filter_name: The Account Filter name + :param filter_name: The Account Filter name. :type filter_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AccountFilter or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.AccountFilter or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccountFilter, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.AccountFilter or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AccountFilter"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'filterName': self._serialize.url("filter_name", filter_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('AccountFilter', response) + deserialized = self._deserialize('AccountFilter', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}'} # type: ignore def create_or_update( - self, resource_group_name, account_name, filter_name, parameters, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + filter_name, # type: str + parameters, # type: "_models.AccountFilter" + **kwargs # type: Any + ): + # type: (...) -> "_models.AccountFilter" """Create or update an Account Filter. Creates or updates an Account Filter in the Media Services account. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 filter_name: The Account Filter name + :param filter_name: The Account Filter name. :type filter_name: str - :param parameters: The request parameters + :param parameters: The request parameters. :type parameters: ~azure.mgmt.media.models.AccountFilter - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AccountFilter or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.AccountFilter or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccountFilter, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.AccountFilter + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccountFilter"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.create_or_update.metadata['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'), + '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') + 'filterName': self._serialize.url("filter_name", filter_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'AccountFilter') + 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') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('AccountFilter', response) + deserialized = self._deserialize('AccountFilter', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('AccountFilter', response) + deserialized = self._deserialize('AccountFilter', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}'} + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}'} # type: ignore def delete( - self, resource_group_name, account_name, filter_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + filter_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete an Account Filter. Deletes an Account Filter in the Media Services account. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 filter_name: The Account Filter name + :param filter_name: The Account Filter name. :type filter_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'filterName': self._serialize.url("filter_name", filter_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}'} + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}'} # type: ignore def update( - self, resource_group_name, account_name, filter_name, parameters, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + filter_name, # type: str + parameters, # type: "_models.AccountFilter" + **kwargs # type: Any + ): + # type: (...) -> "_models.AccountFilter" """Update an Account Filter. Updates an existing Account Filter in the Media Services account. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 filter_name: The Account Filter name + :param filter_name: The Account Filter name. :type filter_name: str - :param parameters: The request parameters + :param parameters: The request parameters. :type parameters: ~azure.mgmt.media.models.AccountFilter - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AccountFilter or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.AccountFilter or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccountFilter, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.AccountFilter + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccountFilter"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'filterName': self._serialize.url("filter_name", filter_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'AccountFilter') + 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') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AccountFilter', response) + deserialized = self._deserialize('AccountFilter', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}'} + 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 685c716c231b..574575db6c32 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 @@ -1,398 +1,427 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +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.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class AssetFiltersOperations(object): """AssetFiltersOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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. - :ivar api_version: The Version of the API to be used with the client request. Constant value: "2018-07-01". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-07-01" - - self.config = config + self._config = config def list( - self, resource_group_name, account_name, asset_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + asset_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AssetFilterCollection"] """List Asset Filters. List Asset Filters associated with the specified Asset. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AssetFilter - :rtype: - ~azure.mgmt.media.models.AssetFilterPaged[~azure.mgmt.media.models.AssetFilter] - :raises: - :class:`ApiErrorException` + :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) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.media.models.AssetFilterCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AssetFilterCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'assetName': self._serialize.url("asset_name", asset_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AssetFilterCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.odata_next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.ApiErrorException(self._deserialize, response) - - return response + error = self._deserialize(_models.ApiError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AssetFilterPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters'} # type: ignore def get( - self, resource_group_name, account_name, asset_name, filter_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + asset_name, # type: str + filter_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.AssetFilter"] """Get an Asset Filter. Get the details of an Asset Filter associated with the specified Asset. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 filter_name: The Asset Filter name + :param filter_name: The Asset Filter name. :type filter_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AssetFilter or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.AssetFilter or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AssetFilter, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.AssetFilter or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AssetFilter"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'filterName': self._serialize.url("filter_name", filter_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('AssetFilter', response) + deserialized = self._deserialize('AssetFilter', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}'} # type: ignore def create_or_update( - self, resource_group_name, account_name, asset_name, filter_name, parameters, custom_headers=None, raw=False, **operation_config): + 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" """Create or update an Asset Filter. Creates or updates an Asset Filter associated with the specified Asset. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 filter_name: The Asset Filter name + :param filter_name: The Asset Filter name. :type filter_name: str - :param parameters: The request parameters + :param parameters: The request parameters. :type parameters: ~azure.mgmt.media.models.AssetFilter - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AssetFilter or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.AssetFilter or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AssetFilter, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.AssetFilter + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AssetFilter"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.create_or_update.metadata['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'), + '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') + 'filterName': self._serialize.url("filter_name", filter_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'AssetFilter') + 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') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('AssetFilter', response) + deserialized = self._deserialize('AssetFilter', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('AssetFilter', response) + deserialized = self._deserialize('AssetFilter', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + 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}'} + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}'} # type: ignore def delete( - self, resource_group_name, account_name, asset_name, filter_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + asset_name, # type: str + filter_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete an Asset Filter. Deletes an Asset Filter associated with the specified Asset. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 filter_name: The Asset Filter name + :param filter_name: The Asset Filter name. :type filter_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'filterName': self._serialize.url("filter_name", filter_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}'} + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}'} # type: ignore def update( - self, resource_group_name, account_name, asset_name, filter_name, parameters, custom_headers=None, raw=False, **operation_config): + 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" """Update an Asset Filter. Updates an existing Asset Filter associated with the specified Asset. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 filter_name: The Asset Filter name + :param filter_name: The Asset Filter name. :type filter_name: str - :param parameters: The request parameters + :param parameters: The request parameters. :type parameters: ~azure.mgmt.media.models.AssetFilter - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AssetFilter or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.AssetFilter or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AssetFilter, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.AssetFilter + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AssetFilter"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'filterName': self._serialize.url("filter_name", filter_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'AssetFilter') + 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') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AssetFilter', response) + deserialized = self._deserialize('AssetFilter', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}'} + 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 0a111a31565c..8f60c1f59810 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 @@ -1,89 +1,106 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +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.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class AssetsOperations(object): """AssetsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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. - :ivar api_version: The Version of the API to be used with the client request. Constant value: "2018-07-01". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-07-01" - - self.config = config + self._config = config def list( - self, resource_group_name, account_name, filter=None, top=None, orderby=None, custom_headers=None, raw=False, **operation_config): + 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"] """List Assets. - List Assets in the Media Services account with optional filtering and - ordering. + List Assets in the Media Services account with optional filtering and ordering. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 filter: Restricts the set of items returned. :type filter: str - :param top: Specifies a non-negative integer n that limits the number - of items returned from a collection. The service returns the number of - available items up to but not greater than the specified value n. + :param top: Specifies a non-negative integer n that limits the number of items returned from a + collection. The service returns the number of available items up to but not greater than the + specified value n. :type top: int - :param orderby: Specifies the key by which the result collection - should be ordered. + :param orderby: Specifies the key by which the result collection should be ordered. :type orderby: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Asset - :rtype: - ~azure.mgmt.media.models.AssetPaged[~azure.mgmt.media.models.Asset] - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AssetCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.media.models.AssetCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AssetCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'accountName': self._serialize.url("account_name", account_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: @@ -91,525 +108,525 @@ def prepare_request(next_link=None): if orderby is not None: query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AssetCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.odata_next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.ApiErrorException(self._deserialize, response) - - return response + error = self._deserialize(_models.ApiError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AssetPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets'} # type: ignore def get( - self, resource_group_name, account_name, asset_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + asset_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.Asset"] """Get an Asset. Get the details of an Asset in the Media Services account. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Asset or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.Asset or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Asset, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.Asset or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Asset"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'assetName': self._serialize.url("asset_name", asset_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Asset', response) + deserialized = self._deserialize('Asset', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}'} # type: ignore def create_or_update( - self, resource_group_name, account_name, asset_name, parameters, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + asset_name, # type: str + parameters, # type: "_models.Asset" + **kwargs # type: Any + ): + # type: (...) -> "_models.Asset" """Create or update an Asset. Creates or updates an Asset in the Media Services account. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 parameters: The request parameters + :param parameters: The request parameters. :type parameters: ~azure.mgmt.media.models.Asset - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Asset or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.Asset or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Asset, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.Asset + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Asset"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.create_or_update.metadata['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'), + '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') + 'assetName': self._serialize.url("asset_name", asset_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'Asset') + 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') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Asset', response) + deserialized = self._deserialize('Asset', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('Asset', response) + deserialized = self._deserialize('Asset', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}'} + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}'} # type: ignore def delete( - self, resource_group_name, account_name, asset_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + asset_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete an Asset. Deletes an Asset in the Media Services account. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'assetName': self._serialize.url("asset_name", asset_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}'} + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}'} # type: ignore def update( - self, resource_group_name, account_name, asset_name, parameters, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + asset_name, # type: str + parameters, # type: "_models.Asset" + **kwargs # type: Any + ): + # type: (...) -> "_models.Asset" """Update an Asset. Updates an existing Asset in the Media Services account. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 parameters: The request parameters + :param parameters: The request parameters. :type parameters: ~azure.mgmt.media.models.Asset - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Asset or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.Asset or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Asset, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.Asset + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Asset"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'assetName': self._serialize.url("asset_name", asset_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'Asset') + 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') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Asset', response) + deserialized = self._deserialize('Asset', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}'} # type: ignore def list_container_sas( - self, resource_group_name, account_name, asset_name, permissions=None, expiry_time=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + asset_name, # type: str + parameters, # type: "_models.ListContainerSasInput" + **kwargs # type: Any + ): + # type: (...) -> "_models.AssetContainerSas" """List the Asset URLs. - Lists storage container URLs with shared access signatures (SAS) for - uploading and downloading Asset content. The signatures are derived - from the storage account keys. + Lists storage container URLs with shared access signatures (SAS) for uploading and downloading + Asset content. The signatures are derived from the storage account keys. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 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 - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AssetContainerSas or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.AssetContainerSas or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :param parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.ListContainerSasInput + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AssetContainerSas, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.AssetContainerSas + :raises: ~azure.core.exceptions.HttpResponseError """ - parameters = models.ListContainerSasInput(permissions=permissions, expiry_time=expiry_time) + cls = kwargs.pop('cls', None) # type: ClsType["_models.AssetContainerSas"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.list_container_sas.metadata['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'), + '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') + 'assetName': self._serialize.url("asset_name", asset_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'ListContainerSasInput') + 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') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AssetContainerSas', response) + deserialized = self._deserialize('AssetContainerSas', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_container_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/listContainerSas'} + list_container_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/listContainerSas'} # type: ignore def get_encryption_key( - self, resource_group_name, account_name, asset_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + asset_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.StorageEncryptedAssetDecryptionData" """Gets the Asset storage key. - Gets the Asset storage encryption keys used to decrypt content created - by version 2 of the Media Services API. + Gets the Asset storage encryption keys used to decrypt content created by version 2 of the + Media Services API. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StorageEncryptedAssetDecryptionData or ClientRawResponse if - raw=true + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageEncryptedAssetDecryptionData, or the result of cls(response) :rtype: ~azure.mgmt.media.models.StorageEncryptedAssetDecryptionData - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageEncryptedAssetDecryptionData"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.get_encryption_key.metadata['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'), + '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') + 'assetName': self._serialize.url("asset_name", asset_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageEncryptedAssetDecryptionData', response) + deserialized = self._deserialize('StorageEncryptedAssetDecryptionData', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_encryption_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/getEncryptionKey'} + get_encryption_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/getEncryptionKey'} # type: ignore def list_streaming_locators( - self, resource_group_name, account_name, asset_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + asset_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ListStreamingLocatorsResponse" """List Streaming Locators. Lists Streaming Locators which are associated with this asset. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ListStreamingLocatorsResponse or ClientRawResponse if - raw=true - :rtype: ~azure.mgmt.media.models.ListStreamingLocatorsResponse or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ListStreamingLocatorsResponse, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.ListStreamingLocatorsResponse + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListStreamingLocatorsResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.list_streaming_locators.metadata['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'), + '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') + 'assetName': self._serialize.url("asset_name", asset_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ListStreamingLocatorsResponse', response) + deserialized = self._deserialize('ListStreamingLocatorsResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_streaming_locators.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/listStreamingLocators'} + 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 a14aee227c22..4ea66ed93208 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 @@ -1,88 +1,106 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +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.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class ContentKeyPoliciesOperations(object): """ContentKeyPoliciesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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. - :ivar api_version: The Version of the API to be used with the client request. Constant value: "2018-07-01". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-07-01" - - self.config = config + self._config = config def list( - self, resource_group_name, account_name, filter=None, top=None, orderby=None, custom_headers=None, raw=False, **operation_config): + 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"] """List Content Key Policies. Lists the Content Key Policies in the account. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 filter: Restricts the set of items returned. :type filter: str - :param top: Specifies a non-negative integer n that limits the number - of items returned from a collection. The service returns the number of - available items up to but not greater than the specified value n. + :param top: Specifies a non-negative integer n that limits the number of items returned from a + collection. The service returns the number of available items up to but not greater than the + specified value n. :type top: int - :param orderby: Specifies the key by which the result collection - should be ordered. + :param orderby: Specifies the key by which the result collection should be ordered. :type orderby: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ContentKeyPolicy - :rtype: - ~azure.mgmt.media.models.ContentKeyPolicyPaged[~azure.mgmt.media.models.ContentKeyPolicy] - :raises: - :class:`ApiErrorException` + :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.paging.ItemPaged[~azure.mgmt.media.models.ContentKeyPolicyCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ContentKeyPolicyCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'accountName': self._serialize.url("account_name", account_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: @@ -90,383 +108,385 @@ def prepare_request(next_link=None): if orderby is not None: query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ContentKeyPolicyCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.odata_next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.ApiErrorException(self._deserialize, response) + error = self._deserialize(_models.ApiError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ContentKeyPolicyPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies'} # type: ignore def get( - self, resource_group_name, account_name, content_key_policy_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + content_key_policy_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.ContentKeyPolicy"] """Get a Content Key Policy. Get the details of a Content Key Policy in the Media Services account. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 content_key_policy_name: The Content Key Policy name. :type content_key_policy_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ContentKeyPolicy or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.ContentKeyPolicy or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ContentKeyPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.ContentKeyPolicy or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ContentKeyPolicy"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ContentKeyPolicy', response) + deserialized = self._deserialize('ContentKeyPolicy', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}'} # type: ignore def create_or_update( - self, resource_group_name, account_name, content_key_policy_name, options, description=None, custom_headers=None, raw=False, **operation_config): + 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" """Create or update an Content Key Policy. Create or update a Content Key Policy in the Media Services account. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 content_key_policy_name: The Content Key Policy name. :type content_key_policy_name: str - :param options: The Key Policy options. - :type options: list[~azure.mgmt.media.models.ContentKeyPolicyOption] - :param description: A description for the Policy. - :type description: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ContentKeyPolicy or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.ContentKeyPolicy or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :param parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.ContentKeyPolicy + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ContentKeyPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.ContentKeyPolicy + :raises: ~azure.core.exceptions.HttpResponseError """ - parameters = models.ContentKeyPolicy(description=description, options=options) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ContentKeyPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create_or_update.metadata['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'), + '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') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'ContentKeyPolicy') + 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') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ContentKeyPolicy', response) + deserialized = self._deserialize('ContentKeyPolicy', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('ContentKeyPolicy', response) + deserialized = self._deserialize('ContentKeyPolicy', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}'} + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}'} # type: ignore def delete( - self, resource_group_name, account_name, content_key_policy_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + content_key_policy_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a Content Key Policy. Deletes a Content Key Policy in the Media Services account. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 content_key_policy_name: The Content Key Policy name. :type content_key_policy_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}'} + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}'} # type: ignore def update( - self, resource_group_name, account_name, content_key_policy_name, options, description=None, custom_headers=None, raw=False, **operation_config): + 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" """Update a Content Key Policy. Updates an existing Content Key Policy in the Media Services account. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 content_key_policy_name: The Content Key Policy name. :type content_key_policy_name: str - :param options: The Key Policy options. - :type options: list[~azure.mgmt.media.models.ContentKeyPolicyOption] - :param description: A description for the Policy. - :type description: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ContentKeyPolicy or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.ContentKeyPolicy or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :param parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.ContentKeyPolicy + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ContentKeyPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.ContentKeyPolicy + :raises: ~azure.core.exceptions.HttpResponseError """ - parameters = models.ContentKeyPolicy(description=description, options=options) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ContentKeyPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'ContentKeyPolicy') + 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') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ContentKeyPolicy', response) + deserialized = self._deserialize('ContentKeyPolicy', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}'} # type: ignore def get_policy_properties_with_secrets( - self, resource_group_name, account_name, content_key_policy_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + content_key_policy_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.ContentKeyPolicyProperties"] """Get a Content Key Policy with secrets. Get a Content Key Policy including secret values. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 content_key_policy_name: The Content Key Policy name. :type content_key_policy_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ContentKeyPolicyProperties or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.ContentKeyPolicyProperties or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ContentKeyPolicyProperties, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.ContentKeyPolicyProperties or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ContentKeyPolicyProperties"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.get_policy_properties_with_secrets.metadata['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'), + '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') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ContentKeyPolicyProperties', response) + deserialized = self._deserialize('ContentKeyPolicyProperties', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + 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'} + 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 23583c1a8569..53e6ba0280f8 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 @@ -1,51 +1,65 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +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.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class JobsOperations(object): """JobsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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. - :ivar api_version: The Version of the API to be used with the client request. Constant value: "2018-07-01". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-07-01" - - self.config = config + self._config = config def list( - self, resource_group_name, account_name, transform_name, filter=None, orderby=None, custom_headers=None, raw=False, **operation_config): + 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"] """List Jobs. Lists all of the Jobs for the Transform. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 @@ -53,85 +67,90 @@ def list( :type transform_name: str :param filter: Restricts the set of items returned. :type filter: str - :param orderby: Specifies the key by which the result collection - should be ordered. + :param orderby: Specifies the key by which the result collection should be ordered. :type orderby: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Job - :rtype: - ~azure.mgmt.media.models.JobPaged[~azure.mgmt.media.models.Job] - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either JobCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.media.models.JobCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'transformName': self._serialize.url("transform_name", transform_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('JobCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.odata_next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.ApiErrorException(self._deserialize, response) + error = self._deserialize(_models.ApiError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.JobPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs'} # type: ignore def get( - self, resource_group_name, account_name, transform_name, job_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + transform_name, # type: str + job_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.Job"] """Get Job. Gets a Job. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 @@ -139,68 +158,72 @@ def get( :type transform_name: str :param job_name: The Job name. :type job_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Job or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.Job or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Job, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.Job or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Job"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'jobName': self._serialize.url("job_name", job_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Job', response) + deserialized = self._deserialize('Job', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}'} # type: ignore def create( - self, resource_group_name, account_name, transform_name, job_name, parameters, custom_headers=None, raw=False, **operation_config): + 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" """Create Job. Creates a Job. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 @@ -208,74 +231,76 @@ def create( :type transform_name: str :param job_name: The Job name. :type job_name: str - :param parameters: The request parameters + :param parameters: The request parameters. :type parameters: ~azure.mgmt.media.models.Job - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Job or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.Job or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Job, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.Job + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Job"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.create.metadata['url'] + url = self.create.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'jobName': self._serialize.url("job_name", job_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'Job') + 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') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize('Job', response) + deserialized = self._deserialize('Job', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}'} + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}'} # type: ignore def delete( - self, resource_group_name, account_name, transform_name, job_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + transform_name, # type: str + job_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete Job. Deletes a Job. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 @@ -283,62 +308,69 @@ def delete( :type transform_name: str :param job_name: The Job name. :type job_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'jobName': self._serialize.url("job_name", job_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}'} + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}'} # type: ignore def update( - self, resource_group_name, account_name, transform_name, job_name, parameters, custom_headers=None, raw=False, **operation_config): + 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" """Update Job. - Update is only supported for description and priority. Updating - Priority will take effect when the Job state is Queued or Scheduled and - depending on the timing the priority update may be ignored. + Update is only supported for description and priority. Updating Priority will take effect when + the Job state is Queued or Scheduled and depending on the timing the priority update may be + ignored. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 @@ -346,74 +378,76 @@ def update( :type transform_name: str :param job_name: The Job name. :type job_name: str - :param parameters: The request parameters + :param parameters: The request parameters. :type parameters: ~azure.mgmt.media.models.Job - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Job or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.Job or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Job, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.Job + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Job"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'jobName': self._serialize.url("job_name", job_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'Job') + 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') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Job', response) + deserialized = self._deserialize('Job', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}'} # type: ignore def cancel_job( - self, resource_group_name, account_name, transform_name, job_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + transform_name, # type: str + job_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Cancel Job. Cancel a Job. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 @@ -421,48 +455,48 @@ def cancel_job( :type transform_name: str :param job_name: The Job name. :type job_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.cancel_job.metadata['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'), + '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') + 'jobName': self._serialize.url("job_name", job_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - cancel_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}/cancelJob'} + 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 86967b51d56c..0366bf5a3dfd 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 @@ -1,751 +1,1093 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +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]] class LiveEventsOperations(object): """LiveEventsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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. - :ivar api_version: The Version of the API to be used with the client request. Constant value: "2018-07-01". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-07-01" - - self.config = config + self._config = config def list( - self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): - """List Live Events. + self, + resource_group_name, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.LiveEventListResult"] + """List live events. - Lists the Live Events in the account. + Lists all the live events in the account. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of LiveEvent - :rtype: - ~azure.mgmt.media.models.LiveEventPaged[~azure.mgmt.media.models.LiveEvent] - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LiveEventListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.media.models.LiveEventListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LiveEventListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'accountName': self._serialize.url("account_name", account_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('LiveEventListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.odata_next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.ApiErrorException(self._deserialize, response) - - return response + error = self._deserialize(_models.ApiError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.LiveEventPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents'} # type: ignore def get( - self, resource_group_name, account_name, live_event_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + live_event_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.LiveEvent"] """Get Live Event. - Gets a Live Event. + Gets properties of a live event. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 live_event_name: The name of the Live Event. + :param live_event_name: The name of the live event, maximum length is 32. :type live_event_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: LiveEvent or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.LiveEvent or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LiveEvent, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.LiveEvent or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LiveEvent"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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])*$') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('LiveEvent', response) + deserialized = self._deserialize('LiveEvent', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}'} # type: ignore def _create_initial( - self, resource_group_name, account_name, live_event_name, parameters, auto_start=None, custom_headers=None, raw=False, **operation_config): + 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" + 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 = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.create.metadata['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'), + '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])*$') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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 = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'LiveEvent') - - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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') - if response.status_code not in [200, 202]: - raise models.ApiErrorException(self._deserialize, response) + 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) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response - deserialized = None + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('LiveEvent', response) - if response.status_code == 202: - deserialized = self._deserialize('LiveEvent', response) + deserialized = self._deserialize('LiveEvent', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if response.status_code == 201: + deserialized = self._deserialize('LiveEvent', pipeline_response) - return deserialized + if cls: + return cls(pipeline_response, deserialized, {}) - def create( - self, resource_group_name, account_name, live_event_name, parameters, auto_start=None, custom_headers=None, raw=False, polling=True, **operation_config): + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}'} # type: ignore + + 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"] """Create Live Event. - Creates a Live Event. + Creates a new live event. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 live_event_name: The name of the Live Event. + :param live_event_name: The name of the live event, maximum length is 32. :type live_event_name: str - :param parameters: Live Event properties needed for creation. + :param parameters: Live event properties needed for creation. :type parameters: ~azure.mgmt.media.models.LiveEvent - :param auto_start: The flag indicates if the resource should be - automatically started on creation. + :param auto_start: The flag indicates if the resource should be automatically started on + creation. :type auto_start: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :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: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns LiveEvent or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.media.models.LiveEvent] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.media.models.LiveEvent]] - :raises: - :class:`ApiErrorException` + :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 LiveEvent or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.media.models.LiveEvent] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_initial( - resource_group_name=resource_group_name, - account_name=account_name, - live_event_name=live_event_name, - parameters=parameters, - auto_start=auto_start, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LiveEvent"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('LiveEvent', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + account_name=account_name, + live_event_name=live_event_name, + parameters=parameters, + auto_start=auto_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): + deserialized = self._deserialize('LiveEvent', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + 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) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}'} - + 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}'} # type: ignore def _update_initial( - self, resource_group_name, account_name, live_event_name, parameters, custom_headers=None, raw=False, **operation_config): + 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" + 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 = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.update.metadata['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'), + '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])*$') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'LiveEvent') + 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') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ApiErrorException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('LiveEvent', response) + deserialized = self._deserialize('LiveEvent', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('LiveEvent', response) + deserialized = self._deserialize('LiveEvent', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update( - self, resource_group_name, account_name, live_event_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): - """Updates a existing Live Event. - - :param resource_group_name: The name of the resource group within the - Azure subscription. + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}'} # type: ignore + + 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"] + """Updates settings on an existing live event. + + :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 live_event_name: The name of the Live Event. + :param live_event_name: The name of the live event, maximum length is 32. :type live_event_name: str - :param parameters: Live Event properties needed for creation. + :param parameters: Live event properties needed for patch. :type parameters: ~azure.mgmt.media.models.LiveEvent - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :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: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns LiveEvent or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.media.models.LiveEvent] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.media.models.LiveEvent]] - :raises: - :class:`ApiErrorException` + :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 LiveEvent or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.media.models.LiveEvent] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - account_name=account_name, - live_event_name=live_event_name, - parameters=parameters, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LiveEvent"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('LiveEvent', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + 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, + live_event_name=live_event_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('LiveEvent', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + 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) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}'} - + 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}/liveEvents/{liveEventName}'} # type: ignore def _delete_initial( - self, resource_group_name, account_name, live_event_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + live_event_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.delete.metadata['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'), + '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])*$') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - raise models.ApiErrorException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, account_name, live_event_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, 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 + + def begin_delete( + self, + resource_group_name, # type: str + account_name, # type: str + live_event_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete Live Event. - Deletes a Live Event. + Deletes a live event. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 live_event_name: The name of the Live Event. + :param live_event_name: The name of the live event, maximum length is 32. :type live_event_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :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: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`ApiErrorException` + :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: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - account_name=account_name, - live_event_name=live_event_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, 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, + live_event_name=live_event_name, + 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, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + 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])*$'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}'} - + 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}/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 + 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 = "2020-05-01" + accept = "application/json" - def _start_initial( - self, resource_group_name, account_name, live_event_name, custom_headers=None, raw=False, **operation_config): # Construct URL - url = self.start.metadata['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'), + '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])*$') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + if cls: + return cls(pipeline_response, None, {}) - def start( - self, resource_group_name, account_name, live_event_name, custom_headers=None, raw=False, polling=True, **operation_config): - """Start Live Event. + _allocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/allocate'} # type: ignore + + def begin_allocate( + self, + resource_group_name, # type: str + account_name, # type: str + live_event_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Allocate resources for a live event. - Starts an existing Live Event. + A live event is in StandBy state after allocation completes, and is ready to start. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 live_event_name: The name of the Live Event. + :param live_event_name: The name of the live event, maximum length is 32. :type live_event_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :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: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`ApiErrorException` + :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: """ - raw_result = self._start_initial( - resource_group_name=resource_group_name, - account_name=account_name, - live_event_name=live_event_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, 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._allocate_initial( + resource_group_name=resource_group_name, + account_name=account_name, + live_event_name=live_event_name, + 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, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + 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])*$'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/start'} + 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_allocate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/allocate'} # type: ignore - - def _stop_initial( - self, resource_group_name, account_name, live_event_name, remove_outputs_on_stop=None, custom_headers=None, raw=False, **operation_config): - parameters = models.LiveEventActionInput(remove_outputs_on_stop=remove_outputs_on_stop) + def _start_initial( + self, + resource_group_name, # type: str + account_name, # type: str + live_event_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 = "2020-05-01" + accept = "application/json" # Construct URL - url = self.stop.metadata['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'), + '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])*$') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'LiveEventActionInput') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, 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 + + def begin_start( + self, + resource_group_name, # type: str + account_name, # type: str + live_event_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Start Live Event. + + A live event in Stopped or StandBy state will be in Running state after the start operation + completes. + + :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 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for 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, 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._start_initial( + resource_group_name=resource_group_name, + account_name=account_name, + live_event_name=live_event_name, + 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) + 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_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 + 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 = "2020-05-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') + + # 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') - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + 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 - def stop( - self, resource_group_name, account_name, live_event_name, remove_outputs_on_stop=None, custom_headers=None, raw=False, polling=True, **operation_config): + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, 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 + + 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] """Stop Live Event. - Stops an existing Live Event. + Stops a running live event. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 live_event_name: The name of the Live Event. + :param live_event_name: The name of the live event, maximum length is 32. :type live_event_name: str - :param remove_outputs_on_stop: The flag indicates if remove - LiveOutputs on Stop. - :type remove_outputs_on_stop: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param parameters: LiveEvent stop parameters. + :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: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`ApiErrorException` + :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: """ - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - account_name=account_name, - live_event_name=live_event_name, - remove_outputs_on_stop=remove_outputs_on_stop, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, 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._stop_initial( + resource_group_name=resource_group_name, + account_name=account_name, + live_event_name=live_event_name, + parameters=parameters, + 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, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + 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])*$'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/stop'} - + 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_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/stop'} # type: ignore def _reset_initial( - self, resource_group_name, account_name, live_event_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + live_event_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.reset.metadata['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'), + '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])*$') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.ApiErrorException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def reset( - self, resource_group_name, account_name, live_event_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, 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 + + def begin_reset( + self, + resource_group_name, # type: str + account_name, # type: str + live_event_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Reset Live Event. - Resets an existing Live Event. + Resets an existing live event. All live outputs for the live event are deleted and the live + event is stopped and will be started again. All assets used by the live outputs and streaming + locators created on these assets are unaffected. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 live_event_name: The name of the Live Event. + :param live_event_name: The name of the live event, maximum length is 32. :type live_event_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :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: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`ApiErrorException` + :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: """ - raw_result = self._reset_initial( - resource_group_name=resource_group_name, - account_name=account_name, - live_event_name=live_event_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, 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._reset_initial( + resource_group_name=resource_group_name, + account_name=account_name, + live_event_name=live_event_name, + 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, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + 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])*$'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - reset.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/reset'} + 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_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 305682fa6c4e..2fa7656a3777 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 @@ -1,388 +1,477 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +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]] class LiveOutputsOperations(object): """LiveOutputsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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. - :ivar api_version: The Version of the API to be used with the client request. Constant value: "2018-07-01". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-07-01" - - self.config = config + self._config = config def list( - self, resource_group_name, account_name, live_event_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + live_event_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.LiveOutputListResult"] """List Live Outputs. - Lists the Live Outputs in the Live Event. + Lists the live outputs of a live event. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 live_event_name: The name of the Live Event. + :param live_event_name: The name of the live event, maximum length is 32. :type live_event_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of LiveOutput - :rtype: - ~azure.mgmt.media.models.LiveOutputPaged[~azure.mgmt.media.models.LiveOutput] - :raises: - :class:`ApiErrorException` + :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) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.media.models.LiveOutputListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LiveOutputListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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])*$') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('LiveOutputListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.odata_next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.ApiErrorException(self._deserialize, response) - - return response + error = self._deserialize(_models.ApiError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.LiveOutputPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs'} # type: ignore def get( - self, resource_group_name, account_name, live_event_name, live_output_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + live_event_name, # type: str + live_output_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.LiveOutput"] """Get Live Output. - Gets a Live Output. + Gets a live output. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 live_event_name: The name of the Live Event. + :param live_event_name: The name of the live event, maximum length is 32. :type live_event_name: str - :param live_output_name: The name of the Live Output. + :param live_output_name: The name of the live output. :type live_output_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: LiveOutput or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.LiveOutput or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LiveOutput, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.LiveOutput or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LiveOutput"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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])*$') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('LiveOutput', response) + deserialized = self._deserialize('LiveOutput', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}'} - + 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, account_name, live_event_name, live_output_name, parameters, custom_headers=None, raw=False, **operation_config): + 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" + 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 = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.create.metadata['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'), + '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])*$') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'LiveOutput') + 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') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202]: - raise models.ApiErrorException(self._deserialize, response) + 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 - deserialized = None + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('LiveOutput', response) - if response.status_code == 202: - deserialized = self._deserialize('LiveOutput', response) + deserialized = self._deserialize('LiveOutput', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if response.status_code == 201: + deserialized = self._deserialize('LiveOutput', pipeline_response) - return deserialized + if cls: + return cls(pipeline_response, deserialized, {}) - def create( - self, resource_group_name, account_name, live_event_name, live_output_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}'} # type: ignore + + 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"] """Create Live Output. - Creates a Live Output. + Creates a new live output. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 live_event_name: The name of the Live Event. + :param live_event_name: The name of the live event, maximum length is 32. :type live_event_name: str - :param live_output_name: The name of the Live Output. + :param live_output_name: The name of the live output. :type live_output_name: str :param parameters: Live Output properties needed for creation. :type parameters: ~azure.mgmt.media.models.LiveOutput - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :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: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns LiveOutput or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.media.models.LiveOutput] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.media.models.LiveOutput]] - :raises: - :class:`ApiErrorException` + :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 LiveOutput or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.media.models.LiveOutput] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_initial( - resource_group_name=resource_group_name, - account_name=account_name, - live_event_name=live_event_name, - live_output_name=live_output_name, - parameters=parameters, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LiveOutput"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('LiveOutput', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + account_name=account_name, + live_event_name=live_event_name, + live_output_name=live_output_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('LiveOutput', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + 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) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}'} - + 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}'} # type: ignore def _delete_initial( - self, resource_group_name, account_name, live_event_name, live_output_name, custom_headers=None, raw=False, **operation_config): + 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 + 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 = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.delete.metadata['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'), + '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])*$') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - raise models.ApiErrorException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, account_name, live_event_name, live_output_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, 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 + + 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] """Delete Live Output. - Deletes a Live Output. + Deletes a live output. Deleting a live output does not delete the asset the live output is + writing to. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 live_event_name: The name of the Live Event. + :param live_event_name: The name of the live event, maximum length is 32. :type live_event_name: str - :param live_output_name: The name of the Live Output. + :param live_output_name: The name of the live output. :type live_output_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :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: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`ApiErrorException` + :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: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - account_name=account_name, - live_event_name=live_event_name, - live_output_name=live_output_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, 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, + live_event_name=live_event_name, + live_output_name=live_output_name, + 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, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + 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])*$'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}'} + 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}/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 1a1b1ed4b337..cb328a32ae74 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 @@ -1,110 +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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +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.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class LocationsOperations(object): """LocationsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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. - :ivar api_version: The Version of the API to be used with the client request. Constant value: "2018-07-01". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-07-01" - - self.config = config + self._config = config def check_name_availability( - self, location_name, name=None, type=None, custom_headers=None, raw=False, **operation_config): + self, + location_name, # type: str + parameters, # type: "_models.CheckNameAvailabilityInput" + **kwargs # type: Any + ): + # type: (...) -> "_models.EntityNameAvailabilityCheckOutput" """Check Name Availability. Checks whether the Media Service resource name is available. - :param location_name: The name of the location + :param location_name: The name of the location. :type location_name: str - :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 - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: EntityNameAvailabilityCheckOutput or ClientRawResponse if - raw=true - :rtype: ~azure.mgmt.media.models.EntityNameAvailabilityCheckOutput or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :param parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.CheckNameAvailabilityInput + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EntityNameAvailabilityCheckOutput, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.EntityNameAvailabilityCheckOutput + :raises: ~azure.core.exceptions.HttpResponseError """ - parameters = models.CheckNameAvailabilityInput(name=name, type=type) + cls = kwargs.pop('cls', None) # type: ClsType["_models.EntityNameAvailabilityCheckOutput"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.check_name_availability.metadata['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') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'CheckNameAvailabilityInput') + 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') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('EntityNameAvailabilityCheckOutput', response) + deserialized = self._deserialize('EntityNameAvailabilityCheckOutput', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Media/locations/{locationName}/checkNameAvailability'} + 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 6960e503a27d..1c0e617f50ec 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 @@ -1,631 +1,651 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +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.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class MediaservicesOperations(object): """MediaservicesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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. - :ivar api_version: The Version of the API to be used with the client request. Constant value: "2018-07-01". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-07-01" - - self.config = config + self._config = config def list( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.MediaServiceCollection"] """List Media Services accounts. List Media Services accounts in the resource group. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :param resource_group_name: The name of the resource group within the Azure subscription. :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of MediaService - :rtype: - ~azure.mgmt.media.models.MediaServicePaged[~azure.mgmt.media.models.MediaService] - :raises: - :class:`ApiErrorException` + :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.paging.ItemPaged[~azure.mgmt.media.models.MediaServiceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MediaServiceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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'] + 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') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('MediaServiceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.odata_next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.ApiErrorException(self._deserialize, response) + error = self._deserialize(_models.ApiError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.MediaServicePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices'} # type: ignore def get( - self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.MediaService" """Get a Media Services account. Get the details of a Media Services account. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MediaService or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.MediaService or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MediaService, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.MediaService + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MediaService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'accountName': self._serialize.url("account_name", account_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('MediaService', response) + deserialized = self._deserialize('MediaService', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}'} # type: ignore def create_or_update( - self, resource_group_name, account_name, parameters, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + parameters, # type: "_models.MediaService" + **kwargs # type: Any + ): + # type: (...) -> "_models.MediaService" """Create or update a Media Services account. Creates or updates a Media Services account. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 parameters: The request parameters + :param parameters: The request parameters. :type parameters: ~azure.mgmt.media.models.MediaService - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MediaService or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.MediaService or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MediaService, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.MediaService + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MediaService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.create_or_update.metadata['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'), + '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') + 'accountName': self._serialize.url("account_name", account_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'MediaService') + 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') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MediaService', response) + deserialized = self._deserialize('MediaService', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('MediaService', response) + deserialized = self._deserialize('MediaService', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}'} + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}'} # type: ignore def delete( - self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a Media Services account. Deletes a Media Services account. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'accountName': self._serialize.url("account_name", account_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response - if response.status_code not in [200]: - raise models.ApiErrorException(self._deserialize, 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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}'} + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}'} # type: ignore def update( - self, resource_group_name, account_name, parameters, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + parameters, # type: "_models.MediaService" + **kwargs # type: Any + ): + # type: (...) -> "_models.MediaService" """Update a Media Services account. Updates an existing Media Services account. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 parameters: The request parameters + :param parameters: The request parameters. :type parameters: ~azure.mgmt.media.models.MediaService - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MediaService or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.MediaService or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MediaService, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.MediaService + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MediaService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'accountName': self._serialize.url("account_name", account_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'MediaService') + 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') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'MediaService') + 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]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('MediaService', response) + deserialized = self._deserialize('MediaService', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}'} # type: ignore def sync_storage_keys( - self, resource_group_name, account_name, id=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + parameters, # type: "_models.SyncStorageKeysInput" + **kwargs # type: Any + ): + # type: (...) -> None """Synchronizes Storage Account Keys. - Synchronizes storage account keys for a storage account associated with - the Media Service account. + Synchronizes storage account keys for a storage account associated with the Media Service + account. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 id: The ID of the storage account resource. - :type id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :param parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.SyncStorageKeysInput + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError """ - parameters = models.SyncStorageKeysInput(id=id) + 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 = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.sync_storage_keys.metadata['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'), + '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') + 'accountName': self._serialize.url("account_name", account_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'SyncStorageKeysInput') + 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') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - sync_storage_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/syncStorageKeys'} + if cls: + return cls(pipeline_response, None, {}) - def list_edge_policies( - self, resource_group_name, account_name, device_id=None, custom_headers=None, raw=False, **operation_config): - """List the media edge policies associated with the Media Services - account. + sync_storage_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/syncStorageKeys'} # type: ignore - List the media edge policies associated with the Media Services - account. - - :param resource_group_name: The name of the resource group within the - Azure subscription. + def list_edge_policies( + self, + resource_group_name, # type: str + account_name, # type: str + parameters, # type: "_models.ListEdgePoliciesInput" + **kwargs # type: Any + ): + # type: (...) -> "_models.EdgePolicies" + """List the media edge policies associated with the Media Services account. + + List the media edge policies associated with the Media Services account. + + :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 device_id: Unique identifier of the edge device. - :type device_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: EdgePolicies or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.EdgePolicies or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :param parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.ListEdgePoliciesInput + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EdgePolicies, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.EdgePolicies + :raises: ~azure.core.exceptions.HttpResponseError """ - parameters = models.ListEdgePoliciesInput(device_id=device_id) + cls = kwargs.pop('cls', None) # type: ClsType["_models.EdgePolicies"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.list_edge_policies.metadata['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'), + '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') + 'accountName': self._serialize.url("account_name", account_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'ListEdgePoliciesInput') + 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') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('EdgePolicies', response) + deserialized = self._deserialize('EdgePolicies', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_edge_policies.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/listEdgePolicies'} + list_edge_policies.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/listEdgePolicies'} # type: ignore def list_by_subscription( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.MediaServiceCollection"] """List Media Services accounts. List Media Services accounts in the subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SubscriptionMediaService - :rtype: - ~azure.mgmt.media.models.SubscriptionMediaServicePaged[~azure.mgmt.media.models.SubscriptionMediaService] - :raises: - :class:`ApiErrorException` + :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.paging.ItemPaged[~azure.mgmt.media.models.MediaServiceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MediaServiceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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'] + 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') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('MediaServiceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.odata_next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.ApiErrorException(self._deserialize, response) - - return response + error = self._deserialize(_models.ApiError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SubscriptionMediaServicePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Media/mediaservices'} + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Media/mediaservices'} # type: ignore def get_by_subscription( - self, account_name, custom_headers=None, raw=False, **operation_config): + self, + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.MediaService" """Get a Media Services account. Get the details of a Media Services account. :param account_name: The Media Services account name. :type account_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SubscriptionMediaService or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.SubscriptionMediaService or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MediaService, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.MediaService + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MediaService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.get_by_subscription.metadata['url'] + url = self.get_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'accountName': self._serialize.url("account_name", account_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SubscriptionMediaService', response) + deserialized = self._deserialize('MediaService', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Media/mediaservices/{accountName}'} + get_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Media/mediaservices/{accountName}'} # 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 59ca6d6cff7b..3454bbb9a7cb 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 @@ -1,102 +1,112 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +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.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class Operations(object): """Operations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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. - :ivar api_version: The Version of the API to be used with the client request. Constant value: "2018-07-01". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-07-01" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.OperationCollection"] """List Operations. Lists all the Media Services operations. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Operation - :rtype: - ~azure.mgmt.media.models.OperationPaged[~azure.mgmt.media.models.Operation] - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.media.models.OperationCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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'] - + url = self.list.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.odata_next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.ApiErrorException(self._deserialize, response) - - return response + error = self._deserialize(_models.ApiError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/providers/Microsoft.Media/operations'} + return ItemPaged( + get_next, extract_data + ) + 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 new file mode 100644 index 000000000000..c70a58def0a7 --- /dev/null +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,310 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionsOperations(object): + """PrivateEndpointConnectionsOperations 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 + + def list( + self, + resource_group_name, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateEndpointConnectionListResult" + """Get all private endpoint connections. + + Get all private endpoint connections. + + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.PrivateEndpointConnectionListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections'} # type: ignore + + def get( + self, + resource_group_name, # type: str + account_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateEndpointConnection" + """Get private endpoint connection. + + Get private endpoint connection. + + :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 name: + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections/{name}'} # type: ignore + + 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" + """Update private endpoint connection. + + Update private endpoint connection. + + :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 name: + :type name: str + :param parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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') + + # 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, '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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + 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 + + def delete( + self, + resource_group_name, # type: str + account_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete private endpoint connection. + + Delete private endpoint connection. + + :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 name: + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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') + + # 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, 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 new file mode 100644 index 000000000000..c8e683efb25b --- /dev/null +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_private_link_resources_operations.py @@ -0,0 +1,173 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class PrivateLinkResourcesOperations(object): + """PrivateLinkResourcesOperations 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 + + def list( + self, + resource_group_name, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateLinkResourceListResult" + """Get list of group IDs. + + Get list of group IDs. + + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourceListResult, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.PrivateLinkResourceListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateLinkResources'} # type: ignore + + def get( + self, + resource_group_name, # type: str + account_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateLinkResource" + """Get group ID. + + Get group ID. + + :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 name: + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.PrivateLinkResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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 = 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(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + + if cls: + 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 6147785d8d17..9b369800a00c 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 @@ -1,752 +1,972 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +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]] class StreamingEndpointsOperations(object): """StreamingEndpointsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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. - :ivar api_version: The Version of the API to be used with the client request. Constant value: "2018-07-01". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-07-01" - - self.config = config + self._config = config def list( - self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.StreamingEndpointListResult"] """List StreamingEndpoints. - Lists the StreamingEndpoints in the account. + Lists the streaming endpoints in the account. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of StreamingEndpoint - :rtype: - ~azure.mgmt.media.models.StreamingEndpointPaged[~azure.mgmt.media.models.StreamingEndpoint] - :raises: - :class:`ApiErrorException` + :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.paging.ItemPaged[~azure.mgmt.media.models.StreamingEndpointListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingEndpointListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'accountName': self._serialize.url("account_name", account_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('StreamingEndpointListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.odata_next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.ApiErrorException(self._deserialize, response) - - return response + error = self._deserialize(_models.ApiError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.StreamingEndpointPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints'} # type: ignore def get( - self, resource_group_name, account_name, streaming_endpoint_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + streaming_endpoint_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.StreamingEndpoint"] """Get StreamingEndpoint. - Gets a StreamingEndpoint. + Gets a streaming endpoint. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 StreamingEndpoint. + :param streaming_endpoint_name: The name of the streaming endpoint, maximum length is 24. :type streaming_endpoint_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StreamingEndpoint or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.StreamingEndpoint or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StreamingEndpoint, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.StreamingEndpoint or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StreamingEndpoint"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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])*$') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('StreamingEndpoint', response) + deserialized = self._deserialize('StreamingEndpoint', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}'} # type: ignore def _create_initial( - self, resource_group_name, account_name, streaming_endpoint_name, parameters, auto_start=None, custom_headers=None, raw=False, **operation_config): + 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" + 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 = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.create.metadata['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'), + '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])*$') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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 = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'StreamingEndpoint') + 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') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response - if response.status_code not in [200, 202]: - raise models.ApiErrorException(self._deserialize, response) - - deserialized = None + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('StreamingEndpoint', response) - if response.status_code == 202: - deserialized = self._deserialize('StreamingEndpoint', response) + deserialized = self._deserialize('StreamingEndpoint', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if response.status_code == 201: + deserialized = self._deserialize('StreamingEndpoint', pipeline_response) - return deserialized + if cls: + return cls(pipeline_response, deserialized, {}) - def create( - self, resource_group_name, account_name, streaming_endpoint_name, parameters, auto_start=None, custom_headers=None, raw=False, polling=True, **operation_config): + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}'} # type: ignore + + 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"] """Create StreamingEndpoint. - Creates a StreamingEndpoint. + Creates a streaming endpoint. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 StreamingEndpoint. + :param streaming_endpoint_name: The name of the streaming endpoint, maximum length is 24. :type streaming_endpoint_name: str - :param parameters: StreamingEndpoint properties needed for creation. + :param parameters: Streaming endpoint properties needed for creation. :type parameters: ~azure.mgmt.media.models.StreamingEndpoint - :param auto_start: The flag indicates if the resource should be - automatically started on creation. + :param auto_start: The flag indicates if the resource should be automatically started on + creation. :type auto_start: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :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: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns StreamingEndpoint or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.media.models.StreamingEndpoint] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.media.models.StreamingEndpoint]] - :raises: - :class:`ApiErrorException` + :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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.media.models.StreamingEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_initial( - resource_group_name=resource_group_name, - account_name=account_name, - streaming_endpoint_name=streaming_endpoint_name, - parameters=parameters, - auto_start=auto_start, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingEndpoint"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('StreamingEndpoint', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + account_name=account_name, + streaming_endpoint_name=streaming_endpoint_name, + parameters=parameters, + auto_start=auto_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): + deserialized = self._deserialize('StreamingEndpoint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + 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) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}'} - + 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}'} # type: ignore def _update_initial( - self, resource_group_name, account_name, streaming_endpoint_name, parameters, custom_headers=None, raw=False, **operation_config): + 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" + 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 = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.update.metadata['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'), + '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])*$') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'StreamingEndpoint') + 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') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ApiErrorException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('StreamingEndpoint', response) + deserialized = self._deserialize('StreamingEndpoint', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('StreamingEndpoint', response) + deserialized = self._deserialize('StreamingEndpoint', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update( - self, resource_group_name, account_name, streaming_endpoint_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}'} # type: ignore + + 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"] """Update StreamingEndpoint. - Updates a existing StreamingEndpoint. + Updates a existing streaming endpoint. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 StreamingEndpoint. + :param streaming_endpoint_name: The name of the streaming endpoint, maximum length is 24. :type streaming_endpoint_name: str - :param parameters: StreamingEndpoint properties needed for creation. + :param parameters: Streaming endpoint properties needed for creation. :type parameters: ~azure.mgmt.media.models.StreamingEndpoint - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :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: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns StreamingEndpoint or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.media.models.StreamingEndpoint] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.media.models.StreamingEndpoint]] - :raises: - :class:`ApiErrorException` + :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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.media.models.StreamingEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - account_name=account_name, - streaming_endpoint_name=streaming_endpoint_name, - parameters=parameters, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingEndpoint"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('StreamingEndpoint', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + 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, + streaming_endpoint_name=streaming_endpoint_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('StreamingEndpoint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + 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) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}'} - + 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}/streamingEndpoints/{streamingEndpointName}'} # type: ignore def _delete_initial( - self, resource_group_name, account_name, streaming_endpoint_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + streaming_endpoint_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.delete.metadata['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'), + '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])*$') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - raise models.ApiErrorException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, account_name, streaming_endpoint_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, 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 + + def begin_delete( + self, + resource_group_name, # type: str + account_name, # type: str + streaming_endpoint_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete StreamingEndpoint. - Deletes a StreamingEndpoint. + Deletes a streaming endpoint. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 StreamingEndpoint. + :param streaming_endpoint_name: The name of the streaming endpoint, maximum length is 24. :type streaming_endpoint_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :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: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`ApiErrorException` + :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: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - account_name=account_name, - streaming_endpoint_name=streaming_endpoint_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, 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, + streaming_endpoint_name=streaming_endpoint_name, + 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, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + 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])*$'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}'} - + 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}/streamingEndpoints/{streamingEndpointName}'} # type: ignore def _start_initial( - self, resource_group_name, account_name, streaming_endpoint_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + streaming_endpoint_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.start.metadata['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'), + '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])*$') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.ApiErrorException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def start( - self, resource_group_name, account_name, streaming_endpoint_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, 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 + + def begin_start( + self, + resource_group_name, # type: str + account_name, # type: str + streaming_endpoint_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Start StreamingEndpoint. - Starts an existing StreamingEndpoint. + Starts an existing streaming endpoint. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 StreamingEndpoint. + :param streaming_endpoint_name: The name of the streaming endpoint, maximum length is 24. :type streaming_endpoint_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :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: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`ApiErrorException` + :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: """ - raw_result = self._start_initial( - resource_group_name=resource_group_name, - account_name=account_name, - streaming_endpoint_name=streaming_endpoint_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, 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._start_initial( + resource_group_name=resource_group_name, + account_name=account_name, + streaming_endpoint_name=streaming_endpoint_name, + 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, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + 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])*$'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/start'} - + 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_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/start'} # type: ignore def _stop_initial( - self, resource_group_name, account_name, streaming_endpoint_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + streaming_endpoint_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.stop.metadata['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'), + '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])*$') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.ApiErrorException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def stop( - self, resource_group_name, account_name, streaming_endpoint_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, 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 + + def begin_stop( + self, + resource_group_name, # type: str + account_name, # type: str + streaming_endpoint_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Stop StreamingEndpoint. - Stops an existing StreamingEndpoint. + Stops an existing streaming endpoint. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 StreamingEndpoint. + :param streaming_endpoint_name: The name of the streaming endpoint, maximum length is 24. :type streaming_endpoint_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :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: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`ApiErrorException` + :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: """ - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - account_name=account_name, - streaming_endpoint_name=streaming_endpoint_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, 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._stop_initial( + resource_group_name=resource_group_name, + account_name=account_name, + streaming_endpoint_name=streaming_endpoint_name, + 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, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + 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])*$'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/stop'} - + 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_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/stop'} # type: ignore def _scale_initial( - self, resource_group_name, account_name, streaming_endpoint_name, scale_unit=None, custom_headers=None, raw=False, **operation_config): - parameters = models.StreamingEntityScaleUnit(scale_unit=scale_unit) + self, + resource_group_name, # type: str + account_name, # type: str + streaming_endpoint_name, # type: str + parameters, # type: "_models.StreamingEntityScaleUnit" + **kwargs # type: Any + ): + # type: (...) -> 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 = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.scale.metadata['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'), + '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])*$') + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'StreamingEntityScaleUnit') + 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') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ApiErrorException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def scale( - self, resource_group_name, account_name, streaming_endpoint_name, scale_unit=None, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, 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 + + 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] """Scale StreamingEndpoint. - Scales an existing StreamingEndpoint. + Scales an existing streaming endpoint. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 StreamingEndpoint. + :param streaming_endpoint_name: The name of the streaming endpoint, maximum length is 24. :type streaming_endpoint_name: str - :param scale_unit: The scale unit number of the StreamingEndpoint. - :type scale_unit: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param parameters: Streaming endpoint scale parameters. + :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: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`ApiErrorException` + :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: """ - raw_result = self._scale_initial( - resource_group_name=resource_group_name, - account_name=account_name, - streaming_endpoint_name=streaming_endpoint_name, - scale_unit=scale_unit, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, 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._scale_initial( + resource_group_name=resource_group_name, + account_name=account_name, + streaming_endpoint_name=streaming_endpoint_name, + parameters=parameters, + 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, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + 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])*$'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - scale.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/scale'} + 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_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 8d43fac2b18a..2ebb93a94f9a 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 @@ -1,88 +1,106 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +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.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class StreamingLocatorsOperations(object): """StreamingLocatorsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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. - :ivar api_version: The Version of the API to be used with the client request. Constant value: "2018-07-01". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-07-01" - - self.config = config + self._config = config def list( - self, resource_group_name, account_name, filter=None, top=None, orderby=None, custom_headers=None, raw=False, **operation_config): + 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"] """List Streaming Locators. Lists the Streaming Locators in the account. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 filter: Restricts the set of items returned. :type filter: str - :param top: Specifies a non-negative integer n that limits the number - of items returned from a collection. The service returns the number of - available items up to but not greater than the specified value n. + :param top: Specifies a non-negative integer n that limits the number of items returned from a + collection. The service returns the number of available items up to but not greater than the + specified value n. :type top: int - :param orderby: Specifies the key by which the result collection - should be ordered. + :param orderby: Specifies the key by which the result collection should be ordered. :type orderby: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of StreamingLocator - :rtype: - ~azure.mgmt.media.models.StreamingLocatorPaged[~azure.mgmt.media.models.StreamingLocator] - :raises: - :class:`ApiErrorException` + :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.paging.ItemPaged[~azure.mgmt.media.models.StreamingLocatorCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingLocatorCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'accountName': self._serialize.url("account_name", account_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: @@ -90,367 +108,371 @@ def prepare_request(next_link=None): if orderby is not None: query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('StreamingLocatorCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.odata_next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.ApiErrorException(self._deserialize, response) + error = self._deserialize(_models.ApiError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.StreamingLocatorPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators'} # type: ignore def get( - self, resource_group_name, account_name, streaming_locator_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + streaming_locator_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.StreamingLocator"] """Get a Streaming Locator. Get the details of a Streaming Locator in the Media Services account. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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_locator_name: The Streaming Locator name. :type streaming_locator_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StreamingLocator or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.StreamingLocator or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StreamingLocator, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.StreamingLocator or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StreamingLocator"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'streamingLocatorName': self._serialize.url("streaming_locator_name", streaming_locator_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('StreamingLocator', response) + deserialized = self._deserialize('StreamingLocator', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}'} # type: ignore def create( - self, resource_group_name, account_name, streaming_locator_name, parameters, custom_headers=None, raw=False, **operation_config): + 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" """Create a Streaming Locator. Create a Streaming Locator in the Media Services account. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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_locator_name: The Streaming Locator name. :type streaming_locator_name: str - :param parameters: The request parameters + :param parameters: The request parameters. :type parameters: ~azure.mgmt.media.models.StreamingLocator - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StreamingLocator or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.StreamingLocator or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StreamingLocator, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.StreamingLocator + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingLocator"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.create.metadata['url'] + url = self.create.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'streamingLocatorName': self._serialize.url("streaming_locator_name", streaming_locator_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'StreamingLocator') + 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') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize('StreamingLocator', response) + deserialized = self._deserialize('StreamingLocator', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}'} + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}'} # type: ignore def delete( - self, resource_group_name, account_name, streaming_locator_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + streaming_locator_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a Streaming Locator. Deletes a Streaming Locator in the Media Services account. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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_locator_name: The Streaming Locator name. :type streaming_locator_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'streamingLocatorName': self._serialize.url("streaming_locator_name", streaming_locator_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}'} + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}'} # type: ignore def list_content_keys( - self, resource_group_name, account_name, streaming_locator_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + streaming_locator_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ListContentKeysResponse" """List Content Keys. List Content Keys used by this Streaming Locator. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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_locator_name: The Streaming Locator name. :type streaming_locator_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ListContentKeysResponse or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.ListContentKeysResponse or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ListContentKeysResponse, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.ListContentKeysResponse + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListContentKeysResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.list_content_keys.metadata['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'), + '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') + 'streamingLocatorName': self._serialize.url("streaming_locator_name", streaming_locator_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ListContentKeysResponse', response) + deserialized = self._deserialize('ListContentKeysResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_content_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}/listContentKeys'} + list_content_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}/listContentKeys'} # type: ignore def list_paths( - self, resource_group_name, account_name, streaming_locator_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + streaming_locator_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ListPathsResponse" """List Paths. List Paths supported by this Streaming Locator. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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_locator_name: The Streaming Locator name. :type streaming_locator_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ListPathsResponse or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.ListPathsResponse or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ListPathsResponse, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.ListPathsResponse + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListPathsResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.list_paths.metadata['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'), + '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') + 'streamingLocatorName': self._serialize.url("streaming_locator_name", streaming_locator_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ListPathsResponse', response) + deserialized = self._deserialize('ListPathsResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_paths.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}/listPaths'} + 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 74bbde4f4944..a15787a9b1c7 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 @@ -1,88 +1,106 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +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.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class StreamingPoliciesOperations(object): """StreamingPoliciesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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. - :ivar api_version: The Version of the API to be used with the client request. Constant value: "2018-07-01". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-07-01" - - self.config = config + self._config = config def list( - self, resource_group_name, account_name, filter=None, top=None, orderby=None, custom_headers=None, raw=False, **operation_config): + 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"] """List Streaming Policies. Lists the Streaming Policies in the account. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 filter: Restricts the set of items returned. :type filter: str - :param top: Specifies a non-negative integer n that limits the number - of items returned from a collection. The service returns the number of - available items up to but not greater than the specified value n. + :param top: Specifies a non-negative integer n that limits the number of items returned from a + collection. The service returns the number of available items up to but not greater than the + specified value n. :type top: int - :param orderby: Specifies the key by which the result collection - should be ordered. + :param orderby: Specifies the key by which the result collection should be ordered. :type orderby: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of StreamingPolicy - :rtype: - ~azure.mgmt.media.models.StreamingPolicyPaged[~azure.mgmt.media.models.StreamingPolicy] - :raises: - :class:`ApiErrorException` + :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.paging.ItemPaged[~azure.mgmt.media.models.StreamingPolicyCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingPolicyCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'accountName': self._serialize.url("account_name", account_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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: @@ -90,235 +108,239 @@ def prepare_request(next_link=None): if orderby is not None: query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('StreamingPolicyCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.odata_next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.ApiErrorException(self._deserialize, response) - - return response + error = self._deserialize(_models.ApiError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.StreamingPolicyPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies'} # type: ignore def get( - self, resource_group_name, account_name, streaming_policy_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + streaming_policy_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.StreamingPolicy"] """Get a Streaming Policy. Get the details of a Streaming Policy in the Media Services account. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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_policy_name: The Streaming Policy name. :type streaming_policy_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StreamingPolicy or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.StreamingPolicy or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StreamingPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.StreamingPolicy or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StreamingPolicy"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'streamingPolicyName': self._serialize.url("streaming_policy_name", streaming_policy_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('StreamingPolicy', response) + deserialized = self._deserialize('StreamingPolicy', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName}'} # type: ignore def create( - self, resource_group_name, account_name, streaming_policy_name, parameters, custom_headers=None, raw=False, **operation_config): + 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" """Create a Streaming Policy. Create a Streaming Policy in the Media Services account. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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_policy_name: The Streaming Policy name. :type streaming_policy_name: str - :param parameters: The request parameters + :param parameters: The request parameters. :type parameters: ~azure.mgmt.media.models.StreamingPolicy - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: StreamingPolicy or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.StreamingPolicy or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StreamingPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.StreamingPolicy + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StreamingPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.create.metadata['url'] + url = self.create.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'streamingPolicyName': self._serialize.url("streaming_policy_name", streaming_policy_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'StreamingPolicy') + 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') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize('StreamingPolicy', response) + deserialized = self._deserialize('StreamingPolicy', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName}'} + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName}'} # type: ignore def delete( - self, resource_group_name, account_name, streaming_policy_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + streaming_policy_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete a Streaming Policy. Deletes a Streaming Policy in the Media Services account. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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_policy_name: The Streaming Policy name. :type streaming_policy_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'streamingPolicyName': self._serialize.url("streaming_policy_name", streaming_policy_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName}'} + 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/_transforms_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_transforms_operations.py index c9912fa2a59b..b3cf7cf1a7f9 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 @@ -1,402 +1,417 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +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.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class TransformsOperations(object): """TransformsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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. - :ivar api_version: The Version of the API to be used with the client request. Constant value: "2018-07-01". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-07-01" - - self.config = config + self._config = config def list( - self, resource_group_name, account_name, filter=None, orderby=None, custom_headers=None, raw=False, **operation_config): + 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"] """List Transforms. Lists the Transforms in the account. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 filter: Restricts the set of items returned. :type filter: str - :param orderby: Specifies the key by which the result collection - should be ordered. + :param orderby: Specifies the key by which the result collection should be ordered. :type orderby: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Transform - :rtype: - ~azure.mgmt.media.models.TransformPaged[~azure.mgmt.media.models.Transform] - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TransformCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.media.models.TransformCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TransformCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-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'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'accountName': self._serialize.url("account_name", account_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + 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) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('TransformCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.odata_next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.ApiErrorException(self._deserialize, response) + error = self._deserialize(_models.ApiError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.TransformPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms'} # type: ignore def get( - self, resource_group_name, account_name, transform_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + transform_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.Transform"] """Get Transform. Gets a Transform. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 transform_name: The Transform name. :type transform_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Transform or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.Transform or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Transform, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.Transform or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Transform"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'transformName': self._serialize.url("transform_name", transform_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Transform', response) + deserialized = self._deserialize('Transform', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}'} # type: ignore def create_or_update( - self, resource_group_name, account_name, transform_name, outputs, description=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + transform_name, # type: str + parameters, # type: "_models.Transform" + **kwargs # type: Any + ): + # type: (...) -> "_models.Transform" """Create or Update Transform. Creates or updates a new Transform. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 transform_name: The Transform name. :type transform_name: str - :param outputs: An array of one or more TransformOutputs that the - Transform should generate. - :type outputs: list[~azure.mgmt.media.models.TransformOutput] - :param description: An optional verbose description of the Transform. - :type description: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Transform or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.Transform or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :param parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.Transform + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Transform, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.Transform + :raises: ~azure.core.exceptions.HttpResponseError """ - parameters = models.Transform(description=description, outputs=outputs) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Transform"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create_or_update.metadata['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'), + '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') + 'transformName': self._serialize.url("transform_name", transform_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'Transform') + 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') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Transform', response) + deserialized = self._deserialize('Transform', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('Transform', response) + deserialized = self._deserialize('Transform', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}'} + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}'} # type: ignore def delete( - self, resource_group_name, account_name, transform_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + transform_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete Transform. Deletes a Transform. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 transform_name: The Transform name. :type transform_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'transformName': self._serialize.url("transform_name", transform_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}'} + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}'} # type: ignore def update( - self, resource_group_name, account_name, transform_name, outputs, description=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + account_name, # type: str + transform_name, # type: str + parameters, # type: "_models.Transform" + **kwargs # type: Any + ): + # type: (...) -> "_models.Transform" """Update Transform. Updates a Transform. - :param resource_group_name: The name of the resource group within the - Azure subscription. + :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 transform_name: The Transform name. :type transform_name: str - :param outputs: An array of one or more TransformOutputs that the - Transform should generate. - :type outputs: list[~azure.mgmt.media.models.TransformOutput] - :param description: An optional verbose description of the Transform. - :type description: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Transform or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.media.models.Transform or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ApiErrorException` + :param parameters: The request parameters. + :type parameters: ~azure.mgmt.media.models.Transform + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Transform, or the result of cls(response) + :rtype: ~azure.mgmt.media.models.Transform + :raises: ~azure.core.exceptions.HttpResponseError """ - parameters = models.Transform(description=description, outputs=outputs) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Transform"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-05-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'transformName': self._serialize.url("transform_name", transform_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'Transform') + 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') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ApiErrorException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ApiError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Transform', response) + deserialized = self._deserialize('Transform', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}'} + 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/py.typed b/sdk/media/azure-mgmt-media/azure/mgmt/media/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/media/azure-mgmt-media/setup.py b/sdk/media/azure-mgmt-media/setup.py index cca02a524eb6..d32fc916bc3d 100644 --- a/sdk/media/azure-mgmt-media/setup.py +++ b/sdk/media/azure-mgmt-media/setup.py @@ -81,8 +81,8 @@ ]), install_requires=[ 'msrest>=0.5.0', - 'msrestazure>=0.4.32,<2.0.0', 'azure-common~=1.1', + 'msrestazure>=0.4.32,<2.0.0', ], extras_require={ ":python_version<'3.0'": ['azure-mgmt-nspkg'], From 80df0c255801e322366f9d170c450dc7cabde80a Mon Sep 17 00:00:00 2001 From: 00Kai0 Date: Tue, 8 Dec 2020 17:25:11 +0800 Subject: [PATCH 2/2] fix setup --- sdk/media/azure-mgmt-media/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/media/azure-mgmt-media/setup.py b/sdk/media/azure-mgmt-media/setup.py index d32fc916bc3d..f232fb06b332 100644 --- a/sdk/media/azure-mgmt-media/setup.py +++ b/sdk/media/azure-mgmt-media/setup.py @@ -82,7 +82,7 @@ install_requires=[ 'msrest>=0.5.0', 'azure-common~=1.1', - 'msrestazure>=0.4.32,<2.0.0', + 'azure-mgmt-core>=1.2.0,<2.0.0', ], extras_require={ ":python_version<'3.0'": ['azure-mgmt-nspkg'],