diff --git a/sdk/media/azure-mgmt-media/_meta.json b/sdk/media/azure-mgmt-media/_meta.json index b15d32753f020..45a51c701cd3f 100644 --- a/sdk/media/azure-mgmt-media/_meta.json +++ b/sdk/media/azure-mgmt-media/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.8.4", + "commit": "cbabe4b07d2e7831e55cd5ac327f4d69318cf87e", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest": "3.9.2", "use": [ - "@autorest/python@6.1.5", - "@autorest/modelerfour@4.23.5" + "@autorest/python@6.2.7", + "@autorest/modelerfour@4.24.3" ], - "commit": "bc6b52f26f09cfc7085a8d5df109b54ba00843cc", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/mediaservices/resource-manager/readme.md --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.1.5 --use=@autorest/modelerfour@4.23.5 --version=3.8.4 --version-tolerant=False", + "autorest_command": "autorest specification/mediaservices/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/mediaservices/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/__init__.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/__init__.py index 85e106868ea37..dee5e77b7dd1e 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/__init__.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["AzureMediaServices"] +__all__ = [ + "AzureMediaServices", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/_azure_media_services.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/_azure_media_services.py index 7805d58c1fa31..7196242f33e9f 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 @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from ._configuration import AzureMediaServicesConfiguration from ._serialization import Deserializer, Serializer from .operations import ( @@ -112,7 +112,7 @@ def __init__( self._config = AzureMediaServicesConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -180,15 +180,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> AzureMediaServices + def __enter__(self) -> "AzureMediaServices": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> 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 c6371fecbf0c4..d0e6f4c42f468 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/_configuration.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/_configuration.py @@ -44,10 +44,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-media/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + 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) diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/_serialization.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/_serialization.py index 7c1dedb5133d3..2c170e28dbca2 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/_serialization.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/_serialization.py @@ -25,6 +25,7 @@ # -------------------------------------------------------------------------- # pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode import calendar @@ -37,24 +38,22 @@ import re import sys import codecs +from typing import Optional, Union, AnyStr, IO, Mapping try: from urllib import quote # type: ignore except ImportError: - from urllib.parse import quote # type: ignore + from urllib.parse import quote import xml.etree.ElementTree as ET -import isodate +import isodate # type: ignore -from typing import Dict, Any, cast, TYPE_CHECKING +from typing import Dict, Any, cast from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -if TYPE_CHECKING: - from typing import Optional, Union, AnyStr, IO, Mapping - class RawDeserializer: @@ -65,8 +64,7 @@ class RawDeserializer: CONTEXT_NAME = "deserialized_data" @classmethod - def deserialize_from_text(cls, data, content_type=None): - # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: """Decode data according to content-type. Accept a stream of data as well, but will be load at once in memory for now. @@ -132,8 +130,7 @@ def _json_attemp(data): raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod - def deserialize_from_http_generics(cls, body_bytes, headers): - # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: """Deserialize from HTTP response. Use bytes and headers to NOT use any requests/aiohttp or whatever @@ -160,8 +157,8 @@ def deserialize_from_http_generics(cls, body_bytes, headers): basestring # type: ignore unicode_str = unicode # type: ignore except NameError: - basestring = str # type: ignore - unicode_str = str # type: ignore + basestring = str + unicode_str = str _LOGGER = logging.getLogger(__name__) @@ -188,7 +185,7 @@ def dst(self, dt): try: - from datetime import timezone as _FixedOffset + from datetime import timezone as _FixedOffset # type: ignore except ImportError: # Python 2.7 class _FixedOffset(datetime.tzinfo): # type: ignore @@ -219,7 +216,7 @@ def __getinitargs__(self): try: from datetime import timezone - TZ_UTC = timezone.utc # type: ignore + TZ_UTC = timezone.utc except ImportError: TZ_UTC = UTC() # type: ignore @@ -276,9 +273,9 @@ class Model(object): serialization and deserialization. """ - _subtype_map = {} # type: Dict[str, Dict[str, Any]] - _attribute_map = {} # type: Dict[str, Dict[str, Any]] - _validation = {} # type: Dict[str, Dict[str, Any]] + _subtype_map: Dict[str, Dict[str, Any]] = {} + _attribute_map: Dict[str, Dict[str, Any]] = {} + _validation: Dict[str, Dict[str, Any]] = {} def __init__(self, **kwargs): self.additional_properties = {} @@ -310,7 +307,7 @@ def enable_additional_properties_sending(cls): @classmethod def is_xml_model(cls): try: - cls._xml_map + cls._xml_map # type: ignore except AttributeError: return False return True @@ -319,7 +316,7 @@ def is_xml_model(cls): def _create_xml_node(cls): """Create XML node.""" try: - xml_map = cls._xml_map + xml_map = cls._xml_map # type: ignore except AttributeError: xml_map = {} @@ -453,7 +450,7 @@ def _classify(cls, response, objects): return cls flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) try: - return objects[flatten_mapping_type[subtype_value]] + return objects[flatten_mapping_type[subtype_value]] # type: ignore except KeyError: _LOGGER.warning( "Subtype value %s has no mapping, use base class %s.", @@ -606,13 +603,13 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) xml_name = "{}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) + serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): - serialized.text = new_attr + serialized.text = new_attr # type: ignore continue if isinstance(new_attr, list): - serialized.extend(new_attr) + serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): @@ -621,23 +618,23 @@ def _serialize(self, target_obj, data_type=None, **kwargs): new_attr.tag = "}".join([splitted_tag[0], xml_name]) else: new_attr.tag = xml_name - serialized.append(new_attr) + serialized.append(new_attr) # type: ignore else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) local_node.text = unicode_str(new_attr) - serialized.append(local_node) + serialized.append(local_node) # type: ignore else: # JSON - for k in reversed(keys): + for k in reversed(keys): # type: ignore unflattened = {k: new_attr} new_attr = unflattened _new_attr = new_attr _serialized = serialized - for k in keys: + for k in keys: # type: ignore if k not in _serialized: - _serialized.update(_new_attr) - _new_attr = _new_attr[k] + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] except ValueError: continue @@ -675,7 +672,7 @@ def body(self, data, data_type, **kwargs): # We're not able to deal with additional properties for now. deserializer.additional_properties_detection = False if is_xml_model_serialization: - deserializer.key_extractors = [ + deserializer.key_extractors = [ # type: ignore attribute_key_case_insensitive_extractor, ] else: @@ -843,7 +840,7 @@ def serialize_unicode(cls, data): pass try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore # Don't change it, JSON and XML ElementTree are totally able # to serialize correctly u'' strings return data @@ -1001,10 +998,10 @@ def serialize_enum(attr, enum_obj=None): except AttributeError: result = attr try: - enum_obj(result) + enum_obj(result) # type: ignore return result except ValueError: - for enum_value in enum_obj: + for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" @@ -1416,7 +1413,7 @@ def _deserialize(self, target_obj, data): if data is None: return data try: - attributes = response._attribute_map + attributes = response._attribute_map # type: ignore d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1444,7 +1441,7 @@ def _deserialize(self, target_obj, data): value = self.deserialize_data(raw_value, attr_desc["type"]) d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name + msg = "Unable to deserialize to object: " + class_name # type: ignore raise_with_traceback(DeserializationError, msg, err) else: additional_properties = self._build_additional_properties(attributes, data) @@ -1543,7 +1540,7 @@ def _unpack_content(raw_data, content_type=None): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): @@ -1565,7 +1562,7 @@ def _instantiate_model(self, response, attrs, additional_properties=None): response_obj.additional_properties = additional_properties return response_obj except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore raise DeserializationError(msg + str(err)) else: try: @@ -1747,7 +1744,7 @@ def deserialize_unicode(data): # Consider this is real string try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore return data except NameError: return str(data) @@ -1798,7 +1795,7 @@ def deserialize_bytearray(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return bytearray(b64decode(attr)) + return bytearray(b64decode(attr)) # type: ignore @staticmethod def deserialize_base64(attr): @@ -1810,8 +1807,8 @@ def deserialize_base64(attr): """ if isinstance(attr, ET.Element): attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) - attr = attr + padding + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore encoded = attr.replace("-", "+").replace("_", "/") return b64decode(encoded) @@ -1826,7 +1823,7 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) + return decimal.Decimal(attr) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) raise_with_traceback(DeserializationError, msg, err) @@ -1841,7 +1838,7 @@ def deserialize_long(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return _long_type(attr) + return _long_type(attr) # type: ignore @staticmethod def deserialize_duration(attr): @@ -1871,7 +1868,7 @@ def deserialize_date(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. return isodate.parse_date(attr, defaultmonth=None, defaultday=None) @@ -1886,7 +1883,7 @@ def deserialize_time(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) return isodate.parse_time(attr) @@ -1901,7 +1898,7 @@ def deserialize_rfc(attr): if isinstance(attr, ET.Element): attr = attr.text try: - parsed_date = email.utils.parsedate_tz(attr) + parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) @@ -1924,7 +1921,7 @@ def deserialize_iso(attr): if isinstance(attr, ET.Element): attr = attr.text try: - attr = attr.upper() + attr = attr.upper() # type: ignore match = Deserializer.valid_date.match(attr) if not match: raise ValueError("Invalid datetime string: " + attr) @@ -1960,7 +1957,7 @@ def deserialize_unix(attr): :raises: DeserializationError if format invalid """ if isinstance(attr, ET.Element): - attr = int(attr.text) + attr = int(attr.text) # type: ignore try: date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/_version.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/_version.py index c1257f7f4e111..e5754a47ce68f 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/_version.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "10.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/__init__.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/__init__.py index a2812ba274616..aad9f6b939ecd 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/__init__.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["AzureMediaServices"] +__all__ = [ + "AzureMediaServices", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/_azure_media_services.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/_azure_media_services.py index 7b8c31f28cd71..31b0478e6821b 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/_azure_media_services.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/_azure_media_services.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import AzureMediaServicesConfiguration from .operations import ( @@ -112,7 +112,7 @@ def __init__( self._config = AzureMediaServicesConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/__init__.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/__init__.py index bf9127707638a..7c0aa16e6df39 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/__init__.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/__init__.py @@ -29,7 +29,7 @@ from ._streaming_endpoints_operations import StreamingEndpointsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_account_filters_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_account_filters_operations.py index 531b730f22b67..8d7a982f30de5 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_account_filters_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_account_filters_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -35,6 +36,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,8 +84,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccountFilterCollection] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.AccountFilterCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -103,12 +108,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -116,13 +121,13 @@ 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) + list_of_elem = cls(list_of_elem) # type: ignore 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( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -136,7 +141,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters" + } @distributed_trace_async async def get( @@ -169,8 +176,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccountFilter] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.AccountFilter] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -183,9 +190,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -203,7 +210,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}" + } @overload async def create_or_update( @@ -312,9 +321,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccountFilter] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccountFilter] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -338,9 +347,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -358,11 +367,13 @@ async def create_or_update( deserialized = self._deserialize("AccountFilter", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -395,8 +406,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -409,9 +420,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -425,7 +436,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}" + } @overload async def update( @@ -534,9 +547,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccountFilter] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccountFilter] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -560,9 +573,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -580,4 +593,6 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}" + } diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_asset_filters_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_asset_filters_operations.py index 94385524e45a1..3dd41bf27e33a 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_asset_filters_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_asset_filters_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -35,6 +36,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,8 +86,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AssetFilterCollection] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.AssetFilterCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -106,12 +111,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -119,13 +124,13 @@ 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) + list_of_elem = cls(list_of_elem) # type: ignore 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( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -139,7 +144,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters" + } @distributed_trace_async async def get( @@ -174,8 +181,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AssetFilter] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.AssetFilter] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -189,9 +196,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -209,7 +216,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}" + } @overload async def create_or_update( @@ -327,9 +336,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AssetFilter] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AssetFilter] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -354,9 +363,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -374,11 +383,13 @@ async def create_or_update( deserialized = self._deserialize("AssetFilter", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -413,8 +424,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -428,9 +439,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -444,7 +455,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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 + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}" + } @overload async def update( @@ -562,9 +575,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AssetFilter] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AssetFilter] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -589,9 +602,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -609,4 +622,6 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}" + } diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_assets_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_assets_operations.py index 2ff6391f63b47..07c026b5166ff 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_assets_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_assets_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -38,6 +39,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -97,8 +102,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AssetCollection] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.AssetCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -124,12 +129,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -137,13 +142,13 @@ 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) + list_of_elem = cls(list_of_elem) # type: ignore 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( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -157,7 +162,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets" + } @distributed_trace_async async def get(self, resource_group_name: str, account_name: str, asset_name: str, **kwargs: Any) -> _models.Asset: @@ -188,8 +195,8 @@ async def get(self, resource_group_name: str, account_name: str, asset_name: str _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Asset] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.Asset] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -202,9 +209,9 @@ async def get(self, resource_group_name: str, account_name: str, asset_name: str params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -222,7 +229,9 @@ async def get(self, resource_group_name: str, account_name: str, asset_name: str return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}" + } @overload async def create_or_update( @@ -331,9 +340,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Asset] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Asset] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -357,9 +366,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -377,11 +386,13 @@ async def create_or_update( deserialized = self._deserialize("Asset", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -414,8 +425,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -428,9 +439,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -444,7 +455,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}" + } @overload async def update( @@ -553,9 +566,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Asset] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Asset] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -579,9 +592,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -599,7 +612,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}" + } @overload async def list_container_sas( @@ -711,9 +726,9 @@ async def list_container_sas( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AssetContainerSas] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AssetContainerSas] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -737,9 +752,9 @@ async def list_container_sas( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -757,7 +772,9 @@ async def list_container_sas( return deserialized - list_container_sas.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/listContainerSas"} # type: ignore + list_container_sas.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/listContainerSas" + } @distributed_trace_async async def get_encryption_key( @@ -791,8 +808,8 @@ async def get_encryption_key( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageEncryptedAssetDecryptionData] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.StorageEncryptedAssetDecryptionData] = kwargs.pop("cls", None) request = build_get_encryption_key_request( resource_group_name=resource_group_name, @@ -805,9 +822,9 @@ async def get_encryption_key( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -825,7 +842,9 @@ async def get_encryption_key( return deserialized - get_encryption_key.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/getEncryptionKey"} # type: ignore + get_encryption_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/getEncryptionKey" + } @distributed_trace_async async def list_streaming_locators( @@ -858,8 +877,8 @@ async def list_streaming_locators( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListStreamingLocatorsResponse] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.ListStreamingLocatorsResponse] = kwargs.pop("cls", None) request = build_list_streaming_locators_request( resource_group_name=resource_group_name, @@ -872,9 +891,9 @@ async def list_streaming_locators( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -892,4 +911,6 @@ async def list_streaming_locators( return deserialized - list_streaming_locators.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/listStreamingLocators"} # type: ignore + list_streaming_locators.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/listStreamingLocators" + } diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_content_key_policies_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_content_key_policies_operations.py index 80eee92d52cf1..88e20b5164d6e 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_content_key_policies_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_content_key_policies_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -36,6 +37,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -95,8 +100,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ContentKeyPolicyCollection] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.ContentKeyPolicyCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -122,12 +127,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -135,13 +140,13 @@ 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) + list_of_elem = cls(list_of_elem) # type: ignore 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( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -155,7 +160,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies" + } @distributed_trace_async async def get( @@ -188,8 +195,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ContentKeyPolicy] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.ContentKeyPolicy] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -202,9 +209,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -222,7 +229,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}" + } @overload async def create_or_update( @@ -331,9 +340,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ContentKeyPolicy] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ContentKeyPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -357,9 +366,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -377,11 +386,13 @@ async def create_or_update( deserialized = self._deserialize("ContentKeyPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -414,8 +425,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -428,9 +439,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -444,7 +455,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}" + } @overload async def update( @@ -553,9 +566,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ContentKeyPolicy] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ContentKeyPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -579,9 +592,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -599,7 +612,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}" + } @distributed_trace_async async def get_policy_properties_with_secrets( @@ -632,8 +647,8 @@ async def get_policy_properties_with_secrets( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ContentKeyPolicyProperties] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.ContentKeyPolicyProperties] = kwargs.pop("cls", None) request = build_get_policy_properties_with_secrets_request( resource_group_name=resource_group_name, @@ -646,9 +661,9 @@ async def get_policy_properties_with_secrets( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -666,4 +681,6 @@ async def get_policy_properties_with_secrets( return deserialized - get_policy_properties_with_secrets.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}/getPolicyPropertiesWithSecrets"} # type: ignore + get_policy_properties_with_secrets.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}/getPolicyPropertiesWithSecrets" + } diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_jobs_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_jobs_operations.py index 4cd9a5adb0d39..42d8243d799d6 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_jobs_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -36,6 +37,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -93,8 +98,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobCollection] + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) + cls: ClsType[_models.JobCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -120,12 +125,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -133,13 +138,13 @@ 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) + list_of_elem = cls(list_of_elem) # type: ignore 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( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -153,7 +158,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs" + } @distributed_trace_async async def get( @@ -188,8 +195,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Job] + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) + cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -203,9 +210,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -223,7 +230,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}" + } @overload async def create( @@ -341,9 +350,9 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Job] + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Job] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -368,9 +377,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -388,7 +397,9 @@ async def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -423,8 +434,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -438,9 +449,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -454,7 +465,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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 + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}" + } @overload async def update( @@ -578,9 +591,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Job] + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Job] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -605,9 +618,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -625,7 +638,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}" + } @distributed_trace_async async def cancel_job( # pylint: disable=inconsistent-return-statements @@ -660,8 +675,8 @@ async def cancel_job( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_cancel_job_request( resource_group_name=resource_group_name, @@ -675,9 +690,9 @@ async def cancel_job( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -691,4 +706,6 @@ async def cancel_job( # pylint: disable=inconsistent-return-statements 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 + cancel_job.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}/cancelJob" + } diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_live_events_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_live_events_operations.py index 4385269da8f13..cc9c7d8a5fa3a 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_live_events_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_live_events_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -43,6 +44,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,8 +90,8 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> As _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.LiveEventListResult] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.LiveEventListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -109,12 +114,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -122,13 +127,13 @@ 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) + list_of_elem = cls(list_of_elem) # type: ignore 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( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -142,7 +147,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents" + } @distributed_trace_async async def get( @@ -175,8 +182,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.LiveEvent] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.LiveEvent] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -189,9 +196,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -209,7 +216,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}" + } async def _create_initial( self, @@ -231,9 +240,9 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LiveEvent] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LiveEvent] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -258,9 +267,9 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -278,11 +287,13 @@ async def _create_initial( deserialized = self._deserialize("LiveEvent", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}" + } @overload async def begin_create( @@ -420,14 +431,14 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LiveEvent] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LiveEvent] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, account_name=account_name, live_event_name=live_event_name, @@ -449,7 +460,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -461,9 +472,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}" + } async def _update_initial( self, @@ -484,9 +497,9 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LiveEvent] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LiveEvent] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -510,9 +523,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -530,11 +543,13 @@ async def _update_initial( deserialized = self._deserialize("LiveEvent", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}" + } @overload async def begin_update( @@ -654,14 +669,14 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LiveEvent] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LiveEvent] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, account_name=account_name, live_event_name=live_event_name, @@ -682,7 +697,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -694,9 +709,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, live_event_name: str, **kwargs: Any @@ -712,8 +729,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -726,9 +743,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -742,7 +759,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}" + } @distributed_trace_async async def begin_delete( @@ -774,11 +793,11 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -797,7 +816,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -809,9 +828,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}" + } async def _allocate_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, live_event_name: str, **kwargs: Any @@ -827,8 +848,8 @@ async def _allocate_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_allocate_request( resource_group_name=resource_group_name, @@ -841,9 +862,9 @@ async def _allocate_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -857,7 +878,9 @@ async def _allocate_initial( # pylint: disable=inconsistent-return-statements 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 + _allocate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/allocate" + } @distributed_trace_async async def begin_allocate( @@ -889,11 +912,11 @@ async def begin_allocate( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._allocate_initial( # type: ignore resource_group_name=resource_group_name, @@ -912,7 +935,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -924,9 +947,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_allocate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/allocate"} # type: ignore + begin_allocate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/allocate" + } async def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, live_event_name: str, **kwargs: Any @@ -942,8 +967,8 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_start_request( resource_group_name=resource_group_name, @@ -956,9 +981,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -972,7 +997,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements 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 + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/start" + } @distributed_trace_async async def begin_start( @@ -1005,11 +1032,11 @@ async def begin_start( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, @@ -1028,7 +1055,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1040,9 +1067,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/start"} # type: ignore + begin_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/start" + } async def _stop_initial( # pylint: disable=inconsistent-return-statements self, @@ -1063,9 +1092,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1089,9 +1118,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1105,7 +1134,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements 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 + _stop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/stop" + } @overload async def begin_stop( @@ -1227,12 +1258,12 @@ async def begin_stop( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._stop_initial( # type: ignore resource_group_name=resource_group_name, @@ -1253,7 +1284,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1265,9 +1296,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/stop"} # type: ignore + begin_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/stop" + } async def _reset_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, live_event_name: str, **kwargs: Any @@ -1283,8 +1316,8 @@ async def _reset_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_reset_request( resource_group_name=resource_group_name, @@ -1297,9 +1330,9 @@ async def _reset_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1313,7 +1346,9 @@ async def _reset_initial( # pylint: disable=inconsistent-return-statements 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 + _reset_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/reset" + } @distributed_trace_async async def begin_reset( @@ -1347,11 +1382,11 @@ async def begin_reset( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._reset_initial( # type: ignore resource_group_name=resource_group_name, @@ -1370,7 +1405,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1382,9 +1417,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_reset.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/reset"} # type: ignore + begin_reset.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/reset" + } @distributed_trace_async async def async_operation( @@ -1417,8 +1454,8 @@ async def async_operation( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AsyncOperationResult] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.AsyncOperationResult] = kwargs.pop("cls", None) request = build_async_operation_request( resource_group_name=resource_group_name, @@ -1431,9 +1468,9 @@ async def async_operation( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1451,7 +1488,9 @@ async def async_operation( return deserialized - async_operation.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEventOperations/{operationId}"} # type: ignore + async_operation.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEventOperations/{operationId}" + } @distributed_trace_async async def operation_location( @@ -1486,8 +1525,8 @@ async def operation_location( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.LiveEvent]] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[Optional[_models.LiveEvent]] = kwargs.pop("cls", None) request = build_operation_location_request( resource_group_name=resource_group_name, @@ -1501,9 +1540,9 @@ async def operation_location( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1523,4 +1562,6 @@ async def operation_location( return deserialized - operation_location.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/operationLocations/{operationId}"} # type: ignore + operation_location.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/operationLocations/{operationId}" + } diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_live_outputs_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_live_outputs_operations.py index 4775384197dcf..f3fac48022fb0 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_live_outputs_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_live_outputs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -38,6 +39,10 @@ build_operation_location_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,8 +89,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.LiveOutputListResult] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.LiveOutputListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -109,12 +114,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -122,13 +127,13 @@ 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) + list_of_elem = cls(list_of_elem) # type: ignore 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( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -142,7 +147,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs" + } @distributed_trace_async async def get( @@ -177,8 +184,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.LiveOutput] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.LiveOutput] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -192,9 +199,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -212,7 +219,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}" + } async def _create_initial( self, @@ -234,9 +243,9 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LiveOutput] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LiveOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -261,9 +270,9 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -281,11 +290,13 @@ async def _create_initial( deserialized = self._deserialize("LiveOutput", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}" + } @overload async def begin_create( @@ -420,14 +431,14 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LiveOutput] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LiveOutput] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, account_name=account_name, live_event_name=live_event_name, @@ -449,7 +460,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -461,9 +472,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, live_event_name: str, live_output_name: str, **kwargs: Any @@ -479,8 +492,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -494,9 +507,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -510,7 +523,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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 + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}" + } @distributed_trace_async async def begin_delete( @@ -545,11 +560,11 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -569,7 +584,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -581,9 +596,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}" + } @distributed_trace_async async def async_operation( @@ -616,8 +633,8 @@ async def async_operation( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AsyncOperationResult] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.AsyncOperationResult] = kwargs.pop("cls", None) request = build_async_operation_request( resource_group_name=resource_group_name, @@ -630,9 +647,9 @@ async def async_operation( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -650,7 +667,9 @@ async def async_operation( return deserialized - async_operation.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveOutputOperations/{operationId}"} # type: ignore + async_operation.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveOutputOperations/{operationId}" + } @distributed_trace_async async def operation_location( @@ -693,8 +712,8 @@ async def operation_location( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.LiveOutput]] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[Optional[_models.LiveOutput]] = kwargs.pop("cls", None) request = build_operation_location_request( resource_group_name=resource_group_name, @@ -709,9 +728,9 @@ async def operation_location( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -731,4 +750,6 @@ async def operation_location( return deserialized - operation_location.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}/operationLocations/{operationId}"} # type: ignore + operation_location.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}/operationLocations/{operationId}" + } diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_locations_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_locations_operations.py index e9e0c38cdd249..4532bf8b89579 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_locations_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_locations_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._locations_operations import build_check_name_availability_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -128,9 +133,9 @@ async def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EntityNameAvailabilityCheckOutput] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EntityNameAvailabilityCheckOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -152,9 +157,9 @@ async def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -172,4 +177,6 @@ async def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Media/locations/{locationName}/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Media/locations/{locationName}/checkNameAvailability" + } diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_media_services_operation_results_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_media_services_operation_results_operations.py index 1405d505fcfc7..6ac4aa18142bb 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_media_services_operation_results_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_media_services_operation_results_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._media_services_operation_results_operations import build_get_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,8 +81,8 @@ async def get(self, location_name: str, operation_id: str, **kwargs: Any) -> Opt _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.MediaService]] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[Optional[_models.MediaService]] = kwargs.pop("cls", None) request = build_get_request( location_name=location_name, @@ -89,9 +94,9 @@ async def get(self, location_name: str, operation_id: str, **kwargs: Any) -> Opt params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -119,4 +124,6 @@ async def get(self, location_name: str, operation_id: str, **kwargs: Any) -> Opt return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Media/locations/{locationName}/mediaServicesOperationResults/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Media/locations/{locationName}/mediaServicesOperationResults/{operationId}" + } diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_media_services_operation_statuses_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_media_services_operation_statuses_operations.py index 49a631a12ba05..2a463987210a5 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_media_services_operation_statuses_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_media_services_operation_statuses_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._media_services_operation_statuses_operations import build_get_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,8 +81,8 @@ async def get(self, location_name: str, operation_id: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.MediaServiceOperationStatus] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.MediaServiceOperationStatus] = kwargs.pop("cls", None) request = build_get_request( location_name=location_name, @@ -89,9 +94,9 @@ async def get(self, location_name: str, operation_id: str, **kwargs: Any) -> _mo params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -109,4 +114,6 @@ async def get(self, location_name: str, operation_id: str, **kwargs: Any) -> _mo return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Media/locations/{locationName}/mediaServicesOperationStatuses/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Media/locations/{locationName}/mediaServicesOperationStatuses/{operationId}" + } diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_mediaservices_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_mediaservices_operations.py index 985cc7b9e02e7..5b4d87f0d4c32 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_mediaservices_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_mediaservices_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -40,6 +41,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,8 +85,8 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.MediaServiceCollection] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.MediaServiceCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -103,12 +108,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -116,13 +121,13 @@ 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) + list_of_elem = cls(list_of_elem) # type: ignore 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( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -136,7 +141,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices" + } @distributed_trace_async async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.MediaService: @@ -165,8 +172,8 @@ async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.MediaService] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.MediaService] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -178,9 +185,9 @@ async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -198,7 +205,9 @@ async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}" + } async def _create_or_update_initial( self, resource_group_name: str, account_name: str, parameters: Union[_models.MediaService, IO], **kwargs: Any @@ -214,9 +223,9 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MediaService] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MediaService] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -239,9 +248,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -272,11 +281,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("MediaService", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}" + } @overload async def begin_create_or_update( @@ -388,14 +399,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MediaService] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MediaService] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, @@ -423,7 +434,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -435,9 +446,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -468,8 +481,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -481,9 +494,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -497,7 +510,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}" + } async def _update_initial( self, @@ -517,9 +532,9 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MediaService] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MediaService] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -542,9 +557,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -569,7 +584,9 @@ async def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}" + } @overload async def begin_update( @@ -685,14 +702,14 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MediaService] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MediaService] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, @@ -720,7 +737,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -732,9 +749,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}" + } @overload async def sync_storage_keys( # pylint: disable=inconsistent-return-statements @@ -837,9 +856,9 @@ async def sync_storage_keys( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -862,9 +881,9 @@ async def sync_storage_keys( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -878,7 +897,9 @@ async def sync_storage_keys( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - sync_storage_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/syncStorageKeys"} # type: ignore + sync_storage_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/syncStorageKeys" + } @overload async def list_edge_policies( @@ -978,9 +999,9 @@ async def list_edge_policies( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EdgePolicies] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EdgePolicies] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1003,9 +1024,9 @@ async def list_edge_policies( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1023,7 +1044,9 @@ async def list_edge_policies( return deserialized - list_edge_policies.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/listEdgePolicies"} # type: ignore + list_edge_policies.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/listEdgePolicies" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.MediaService"]: @@ -1039,8 +1062,8 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.MediaSer _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.MediaServiceCollection] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.MediaServiceCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1061,12 +1084,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1074,13 +1097,13 @@ 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) + list_of_elem = cls(list_of_elem) # type: ignore 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( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1094,4 +1117,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Media/mediaservices"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Media/mediaservices"} diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_operation_results_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_operation_results_operations.py index caf086aafc009..67f5a5fe18041 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_operation_results_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_operation_results_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._operation_results_operations import build_get_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -91,8 +96,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AssetTrack]] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[Optional[_models.AssetTrack]] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -107,9 +112,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -137,4 +142,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}/operationResults/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}/operationResults/{operationId}" + } diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_operation_statuses_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_operation_statuses_operations.py index 4d587908ee1ba..25a933b086e6e 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_operation_statuses_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_operation_statuses_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._operation_statuses_operations import build_get_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -91,8 +96,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AssetTrackOperationStatus] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.AssetTrackOperationStatus] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -107,9 +112,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -127,4 +132,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}/operationStatuses/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}/operationStatuses/{operationId}" + } diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_operations.py index 8edc7f42306f1..48c1688b9a4f6 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,8 +77,8 @@ async def list(self, **kwargs: Any) -> _models.OperationCollection: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationCollection] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.OperationCollection] = kwargs.pop("cls", None) request = build_list_request( api_version=api_version, @@ -82,9 +87,9 @@ async def list(self, **kwargs: Any) -> _models.OperationCollection: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -102,4 +107,4 @@ async def list(self, **kwargs: Any) -> _models.OperationCollection: return deserialized - list.metadata = {"url": "/providers/Microsoft.Media/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Media/operations"} diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_private_endpoint_connections_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_private_endpoint_connections_operations.py index bdb3f89fca45f..a1f1fde4ad3f0 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_private_endpoint_connections_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -32,6 +33,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,8 +89,8 @@ async def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -97,9 +102,9 @@ async def list( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -117,7 +122,9 @@ async def list( return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections" + } @distributed_trace_async async def get( @@ -150,8 +157,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -164,9 +171,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -184,7 +191,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections/{name}" + } @overload async def create_or_update( @@ -293,9 +302,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -319,9 +328,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -339,7 +348,9 @@ async def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections/{name}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections/{name}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -372,8 +383,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -386,9 +397,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -402,4 +413,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections/{name}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections/{name}" + } diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_private_link_resources_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_private_link_resources_operations.py index 72a5899546429..84f33738c69c4 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_private_link_resources_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_private_link_resources_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_get_request, build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,8 +84,8 @@ async def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourceListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -92,9 +97,9 @@ async def list( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -112,7 +117,9 @@ async def list( return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateLinkResources"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateLinkResources" + } @distributed_trace_async async def get( @@ -145,8 +152,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -159,9 +166,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -179,4 +186,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateLinkResources/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateLinkResources/{name}" + } diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_streaming_endpoints_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_streaming_endpoints_operations.py index 8872035052784..cab149ebc9666 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_streaming_endpoints_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_streaming_endpoints_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -43,6 +44,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -87,8 +92,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.StreamingEndpointListResult] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.StreamingEndpointListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -111,12 +116,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -124,13 +129,13 @@ 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) + list_of_elem = cls(list_of_elem) # type: ignore 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( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -144,7 +149,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints" + } @distributed_trace_async async def get( @@ -178,8 +185,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.StreamingEndpoint] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.StreamingEndpoint] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -192,9 +199,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -212,7 +219,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}" + } async def _create_initial( self, @@ -234,9 +243,9 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.StreamingEndpoint] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StreamingEndpoint] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -261,9 +270,9 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -281,11 +290,13 @@ async def _create_initial( deserialized = self._deserialize("StreamingEndpoint", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}" + } @overload async def begin_create( @@ -426,14 +437,14 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.StreamingEndpoint] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StreamingEndpoint] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, account_name=account_name, streaming_endpoint_name=streaming_endpoint_name, @@ -455,7 +466,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -467,9 +478,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}" + } async def _update_initial( self, @@ -490,9 +503,9 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.StreamingEndpoint] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StreamingEndpoint] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -516,9 +529,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -536,11 +549,13 @@ async def _update_initial( deserialized = self._deserialize("StreamingEndpoint", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}" + } @overload async def begin_update( @@ -669,14 +684,14 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.StreamingEndpoint] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StreamingEndpoint] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, account_name=account_name, streaming_endpoint_name=streaming_endpoint_name, @@ -697,7 +712,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -709,9 +724,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, streaming_endpoint_name: str, **kwargs: Any @@ -727,8 +744,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -741,9 +758,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -757,7 +774,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}" + } @distributed_trace_async async def begin_delete( @@ -790,11 +809,11 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -813,7 +832,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -825,9 +844,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}" + } @distributed_trace_async async def skus( @@ -861,8 +882,8 @@ async def skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.StreamingEndpointSkuInfoListResult] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.StreamingEndpointSkuInfoListResult] = kwargs.pop("cls", None) request = build_skus_request( resource_group_name=resource_group_name, @@ -875,9 +896,9 @@ async def skus( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -895,7 +916,9 @@ async def skus( return deserialized - skus.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/skus"} # type: ignore + skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/skus" + } async def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, streaming_endpoint_name: str, **kwargs: Any @@ -911,8 +934,8 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_start_request( resource_group_name=resource_group_name, @@ -925,9 +948,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -941,7 +964,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements 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 + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/start" + } @distributed_trace_async async def begin_start( @@ -974,11 +999,11 @@ async def begin_start( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, @@ -997,7 +1022,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1009,9 +1034,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/start"} # type: ignore + begin_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/start" + } async def _stop_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, streaming_endpoint_name: str, **kwargs: Any @@ -1027,8 +1054,8 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( resource_group_name=resource_group_name, @@ -1041,9 +1068,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1057,7 +1084,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements 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 + _stop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/stop" + } @distributed_trace_async async def begin_stop( @@ -1090,11 +1119,11 @@ async def begin_stop( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._stop_initial( # type: ignore resource_group_name=resource_group_name, @@ -1113,7 +1142,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1125,9 +1154,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/stop"} # type: ignore + begin_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/stop" + } async def _scale_initial( # pylint: disable=inconsistent-return-statements self, @@ -1148,9 +1179,9 @@ async def _scale_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1174,9 +1205,9 @@ async def _scale_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1190,7 +1221,9 @@ async def _scale_initial( # pylint: disable=inconsistent-return-statements 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 + _scale_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/scale" + } @overload async def begin_scale( @@ -1316,12 +1349,12 @@ async def begin_scale( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._scale_initial( # type: ignore resource_group_name=resource_group_name, @@ -1342,7 +1375,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1354,9 +1387,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_scale.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/scale"} # type: ignore + begin_scale.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/scale" + } @distributed_trace_async async def async_operation( @@ -1389,8 +1424,8 @@ async def async_operation( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AsyncOperationResult] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.AsyncOperationResult] = kwargs.pop("cls", None) request = build_async_operation_request( resource_group_name=resource_group_name, @@ -1403,9 +1438,9 @@ async def async_operation( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1423,7 +1458,9 @@ async def async_operation( return deserialized - async_operation.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpointOperations/{operationId}"} # type: ignore + async_operation.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpointOperations/{operationId}" + } @distributed_trace_async async def operation_location( @@ -1464,8 +1501,8 @@ async def operation_location( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.StreamingEndpoint]] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[Optional[_models.StreamingEndpoint]] = kwargs.pop("cls", None) request = build_operation_location_request( resource_group_name=resource_group_name, @@ -1479,9 +1516,9 @@ async def operation_location( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1501,4 +1538,6 @@ async def operation_location( return deserialized - operation_location.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/operationLocations/{operationId}"} # type: ignore + operation_location.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/operationLocations/{operationId}" + } diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_streaming_locators_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_streaming_locators_operations.py index c2065a9ce27d9..c5e02c7ce955b 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_streaming_locators_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_streaming_locators_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -36,6 +37,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -95,8 +100,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.StreamingLocatorCollection] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.StreamingLocatorCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -122,12 +127,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -135,13 +140,13 @@ 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) + list_of_elem = cls(list_of_elem) # type: ignore 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( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -155,7 +160,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators" + } @distributed_trace_async async def get( @@ -188,8 +195,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.StreamingLocator] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.StreamingLocator] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -202,9 +209,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -222,7 +229,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}" + } @overload async def create( @@ -331,9 +340,9 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.StreamingLocator] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StreamingLocator] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -357,9 +366,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -377,7 +386,9 @@ async def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -410,8 +421,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -424,9 +435,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -440,7 +451,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}" + } @distributed_trace_async async def list_content_keys( @@ -473,8 +486,8 @@ async def list_content_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListContentKeysResponse] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.ListContentKeysResponse] = kwargs.pop("cls", None) request = build_list_content_keys_request( resource_group_name=resource_group_name, @@ -487,9 +500,9 @@ async def list_content_keys( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -507,7 +520,9 @@ async def list_content_keys( return deserialized - list_content_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}/listContentKeys"} # type: ignore + list_content_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}/listContentKeys" + } @distributed_trace_async async def list_paths( @@ -540,8 +555,8 @@ async def list_paths( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListPathsResponse] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.ListPathsResponse] = kwargs.pop("cls", None) request = build_list_paths_request( resource_group_name=resource_group_name, @@ -554,9 +569,9 @@ async def list_paths( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -574,4 +589,6 @@ async def list_paths( return deserialized - list_paths.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}/listPaths"} # type: ignore + list_paths.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}/listPaths" + } diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_streaming_policies_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_streaming_policies_operations.py index 0c364722fcc6f..06c876581166e 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_streaming_policies_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_streaming_policies_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -34,6 +35,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -93,8 +98,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.StreamingPolicyCollection] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.StreamingPolicyCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -120,12 +125,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -133,13 +138,13 @@ 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) + list_of_elem = cls(list_of_elem) # type: ignore 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( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -153,7 +158,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies" + } @distributed_trace_async async def get( @@ -186,8 +193,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.StreamingPolicy] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.StreamingPolicy] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -200,9 +207,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -220,7 +227,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName}" + } @overload async def create( @@ -329,9 +338,9 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.StreamingPolicy] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StreamingPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -355,9 +364,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -375,7 +384,9 @@ async def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -408,8 +419,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -422,9 +433,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -438,4 +449,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName}" + } diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_tracks_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_tracks_operations.py index c0ef825bdfe1e..5fb2035c2eb2f 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_tracks_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_tracks_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -38,6 +39,10 @@ build_update_track_data_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,8 +89,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AssetTrackCollection] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.AssetTrackCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -109,12 +114,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -122,13 +127,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AssetTrackCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -142,7 +147,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks" + } @distributed_trace_async async def get( @@ -177,8 +184,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AssetTrack] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.AssetTrack] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -192,9 +199,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -212,7 +219,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}" + } async def _create_or_update_initial( self, @@ -234,9 +243,9 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AssetTrack] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AssetTrack] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -261,9 +270,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -294,11 +303,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("AssetTrack", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}" + } @overload async def begin_create_or_update( @@ -432,14 +443,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AssetTrack] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AssetTrack] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, account_name=account_name, asset_name=asset_name, @@ -469,7 +480,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -481,9 +492,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, asset_name: str, track_name: str, **kwargs: Any @@ -499,8 +512,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -514,9 +527,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -538,7 +551,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}" + } @distributed_trace_async async def begin_delete( @@ -572,11 +587,11 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -596,7 +611,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -608,9 +623,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}" + } async def _update_initial( self, @@ -632,9 +649,9 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AssetTrack] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AssetTrack] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -659,9 +676,9 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -686,7 +703,9 @@ async def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}" + } @overload async def begin_update( @@ -820,14 +839,14 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AssetTrack] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AssetTrack] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, account_name=account_name, asset_name=asset_name, @@ -857,7 +876,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -869,9 +888,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}" + } async def _update_track_data_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, asset_name: str, track_name: str, **kwargs: Any @@ -887,8 +908,8 @@ async def _update_track_data_initial( # pylint: disable=inconsistent-return-sta _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_track_data_request( resource_group_name=resource_group_name, @@ -902,9 +923,9 @@ async def _update_track_data_initial( # pylint: disable=inconsistent-return-sta params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -925,7 +946,9 @@ async def _update_track_data_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, response_headers) - _update_track_data_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}/updateTrackData"} # type: ignore + _update_track_data_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}/updateTrackData" + } @distributed_trace_async async def begin_update_track_data( @@ -963,11 +986,11 @@ async def begin_update_track_data( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._update_track_data_initial( # type: ignore resource_group_name=resource_group_name, @@ -987,7 +1010,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -999,6 +1022,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update_track_data.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}/updateTrackData"} # type: ignore + begin_update_track_data.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}/updateTrackData" + } diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_transforms_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_transforms_operations.py index 8ccb9b812c147..8f0bf87ad7975 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_transforms_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/aio/operations/_transforms_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -35,6 +36,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -89,8 +94,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.TransformCollection] + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) + cls: ClsType[_models.TransformCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -115,12 +120,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -128,13 +133,13 @@ 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) + list_of_elem = cls(list_of_elem) # type: ignore 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( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -148,7 +153,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms" + } @distributed_trace_async async def get( @@ -181,8 +188,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Transform] + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) + cls: ClsType[_models.Transform] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -195,9 +202,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -215,7 +222,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}" + } @overload async def create_or_update( @@ -324,9 +333,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Transform] + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Transform] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -350,9 +359,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -370,11 +379,13 @@ async def create_or_update( deserialized = self._deserialize("Transform", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -407,8 +418,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -421,9 +432,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -437,7 +448,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}" + } @overload async def update( @@ -546,9 +559,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Transform] + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Transform] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -572,9 +585,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -592,4 +605,6 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}" + } 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 a9f6b5f4d4d44..a9b8554614123 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 @@ -72,6 +72,7 @@ from ._models_py3 import CopyAudio from ._models_py3 import CopyVideo from ._models_py3 import CrossSiteAccessPolicies +from ._models_py3 import DDAudio from ._models_py3 import DashSettings from ._models_py3 import DefaultKey from ._models_py3 import Deinterlace @@ -85,6 +86,7 @@ from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse from ._models_py3 import FaceDetectorPreset +from ._models_py3 import Fade from ._models_py3 import FilterTrackPropertyCondition from ._models_py3 import FilterTrackSelection from ._models_py3 import Filters @@ -285,7 +287,7 @@ from ._azure_media_services_enums import VideoSyncMode from ._azure_media_services_enums import Visibility from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -355,6 +357,7 @@ "CopyAudio", "CopyVideo", "CrossSiteAccessPolicies", + "DDAudio", "DashSettings", "DefaultKey", "Deinterlace", @@ -368,6 +371,7 @@ "ErrorDetail", "ErrorResponse", "FaceDetectorPreset", + "Fade", "FilterTrackPropertyCondition", "FilterTrackSelection", "Filters", 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 e59fafe8a3e24..316f4a4d2492b 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 @@ -286,8 +286,10 @@ class EncoderNamedPreset(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: will never exceed the input resolution. For example, if the input is 720p, output will remain #: 720p at best. ADAPTIVE_STREAMING = "AdaptiveStreaming" - #: Produces a single MP4 file containing only stereo audio encoded at 192 kbps. + #: Produces a single MP4 file containing only AAC stereo audio encoded at 192 kbps. AAC_GOOD_QUALITY_AUDIO = "AACGoodQualityAudio" + #: Produces a single MP4 file containing only DD(Digital Dolby) stereo audio encoded at 192 kbps. + DD_GOOD_QUALITY_AUDIO = "DDGoodQualityAudio" #: 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 @@ -520,6 +522,8 @@ class JobErrorCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): CONFIGURATION = "Configuration" #: The error is related to data in the input files. CONTENT = "Content" + #: The error is related to account information. + ACCOUNT = "Account" class JobErrorCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -551,6 +555,9 @@ class JobErrorCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: 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. CONTENT_UNSUPPORTED = "ContentUnsupported" + #: There was an error verifying to the account identity. Check and fix the identity configurations + #: and retry. If unsuccessful, please contact support. + IDENTITY_UNSUPPORTED = "IdentityUnsupported" class JobRetry(str, Enum, metaclass=CaseInsensitiveEnumMeta): 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 3ceebab425c39..ca3b79b8eacb8 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 @@ -56,7 +56,7 @@ def __init__(self, *, label: Optional[str] = None, **kwargs): :paramtype label: str """ super().__init__(**kwargs) - self.odata_type = None # type: Optional[str] + self.odata_type: Optional[str] = None self.label = label @@ -64,7 +64,7 @@ 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 + AacAudio, DDAudio All required parameters must be populated in order to send to Azure. @@ -92,7 +92,7 @@ class Audio(Codec): "bitrate": {"key": "bitrate", "type": "int"}, } - _subtype_map = {"odata_type": {"#Microsoft.Media.AacAudio": "AacAudio"}} + _subtype_map = {"odata_type": {"#Microsoft.Media.AacAudio": "AacAudio", "#Microsoft.Media.DDAudio": "DDAudio"}} def __init__( self, @@ -115,7 +115,7 @@ def __init__( :paramtype bitrate: int """ super().__init__(label=label, **kwargs) - self.odata_type = "#Microsoft.Media.Audio" # type: str + self.odata_type: str = "#Microsoft.Media.Audio" self.channels = channels self.sampling_rate = sampling_rate self.bitrate = bitrate @@ -179,7 +179,7 @@ def __init__( :paramtype profile: str or ~azure.mgmt.media.models.AacAudioProfile """ super().__init__(label=label, channels=channels, sampling_rate=sampling_rate, bitrate=bitrate, **kwargs) - self.odata_type = "#Microsoft.Media.AacAudio" # type: str + self.odata_type: str = "#Microsoft.Media.AacAudio" self.profile = profile @@ -213,7 +213,7 @@ class ClipTime(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.odata_type = None # type: Optional[str] + self.odata_type: Optional[str] = None class AbsoluteClipTime(ClipTime): @@ -245,7 +245,7 @@ def __init__(self, *, time: datetime.timedelta, **kwargs): :paramtype time: ~datetime.timedelta """ super().__init__(**kwargs) - self.odata_type = "#Microsoft.Media.AbsoluteClipTime" # type: str + self.odata_type: str = "#Microsoft.Media.AbsoluteClipTime" self.time = time @@ -1250,7 +1250,7 @@ class Preset(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.odata_type = None # type: Optional[str] + self.odata_type: Optional[str] = None class AudioAnalyzerPreset(Preset): @@ -1325,7 +1325,7 @@ def __init__( :paramtype experimental_options: dict[str, str] """ super().__init__(**kwargs) - self.odata_type = "#Microsoft.Media.AudioAnalyzerPreset" # type: str + self.odata_type: str = "#Microsoft.Media.AudioAnalyzerPreset" self.audio_language = audio_language self.mode = mode self.experimental_options = experimental_options @@ -1434,7 +1434,7 @@ def __init__( :paramtype audio_gain_level: float """ super().__init__(**kwargs) - self.odata_type = None # type: Optional[str] + self.odata_type: Optional[str] = None self.input_label = input_label self.start = start self.end = end @@ -1547,7 +1547,7 @@ def __init__( audio_gain_level=audio_gain_level, **kwargs ) - self.odata_type = "#Microsoft.Media.AudioOverlay" # type: str + self.odata_type: str = "#Microsoft.Media.AudioOverlay" class TrackBase(_serialization.Model): @@ -1581,7 +1581,7 @@ class TrackBase(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.odata_type = None # type: Optional[str] + self.odata_type: Optional[str] = None class AudioTrack(TrackBase): @@ -1655,7 +1655,7 @@ def __init__( :paramtype mpeg4_track_id: int """ super().__init__(**kwargs) - self.odata_type = "#Microsoft.Media.AudioTrack" # type: str + self.odata_type: str = "#Microsoft.Media.AudioTrack" self.file_name = file_name self.display_name = display_name self.language_code = language_code @@ -1695,7 +1695,7 @@ class TrackDescriptor(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.odata_type = None # type: Optional[str] + self.odata_type: Optional[str] = None class AudioTrackDescriptor(TrackDescriptor): @@ -1740,7 +1740,7 @@ def __init__(self, *, channel_mapping: Optional[Union[str, "_models.ChannelMappi :paramtype channel_mapping: str or ~azure.mgmt.media.models.ChannelMapping """ super().__init__(**kwargs) - self.odata_type = "#Microsoft.Media.AudioTrackDescriptor" # type: str + self.odata_type: str = "#Microsoft.Media.AudioTrackDescriptor" self.channel_mapping = channel_mapping @@ -1756,11 +1756,11 @@ class BuiltInStandardEncoderPreset(Preset): :vartype configurations: ~azure.mgmt.media.models.PresetConfigurations :ivar preset_name: The built-in preset to be used for encoding videos. Required. Known values are: "H264SingleBitrateSD", "H264SingleBitrate720p", "H264SingleBitrate1080p", - "AdaptiveStreaming", "AACGoodQualityAudio", "ContentAwareEncodingExperimental", - "ContentAwareEncoding", "CopyAllBitrateNonInterleaved", "H264MultipleBitrate1080p", - "H264MultipleBitrate720p", "H264MultipleBitrateSD", "H265ContentAwareEncoding", - "H265AdaptiveStreaming", "H265SingleBitrate720p", "H265SingleBitrate1080p", and - "H265SingleBitrate4K". + "AdaptiveStreaming", "AACGoodQualityAudio", "DDGoodQualityAudio", + "ContentAwareEncodingExperimental", "ContentAwareEncoding", "CopyAllBitrateNonInterleaved", + "H264MultipleBitrate1080p", "H264MultipleBitrate720p", "H264MultipleBitrateSD", + "H265ContentAwareEncoding", "H265AdaptiveStreaming", "H265SingleBitrate720p", + "H265SingleBitrate1080p", and "H265SingleBitrate4K". :vartype preset_name: str or ~azure.mgmt.media.models.EncoderNamedPreset """ @@ -1788,15 +1788,15 @@ def __init__( :paramtype configurations: ~azure.mgmt.media.models.PresetConfigurations :keyword preset_name: The built-in preset to be used for encoding videos. Required. Known values are: "H264SingleBitrateSD", "H264SingleBitrate720p", "H264SingleBitrate1080p", - "AdaptiveStreaming", "AACGoodQualityAudio", "ContentAwareEncodingExperimental", - "ContentAwareEncoding", "CopyAllBitrateNonInterleaved", "H264MultipleBitrate1080p", - "H264MultipleBitrate720p", "H264MultipleBitrateSD", "H265ContentAwareEncoding", - "H265AdaptiveStreaming", "H265SingleBitrate720p", "H265SingleBitrate1080p", and - "H265SingleBitrate4K". + "AdaptiveStreaming", "AACGoodQualityAudio", "DDGoodQualityAudio", + "ContentAwareEncodingExperimental", "ContentAwareEncoding", "CopyAllBitrateNonInterleaved", + "H264MultipleBitrate1080p", "H264MultipleBitrate720p", "H264MultipleBitrateSD", + "H265ContentAwareEncoding", "H265AdaptiveStreaming", "H265SingleBitrate720p", + "H265SingleBitrate1080p", and "H265SingleBitrate4K". :paramtype preset_name: str or ~azure.mgmt.media.models.EncoderNamedPreset """ super().__init__(**kwargs) - self.odata_type = "#Microsoft.Media.BuiltInStandardEncoderPreset" # type: str + self.odata_type: str = "#Microsoft.Media.BuiltInStandardEncoderPreset" self.configurations = configurations self.preset_name = preset_name @@ -2158,7 +2158,7 @@ class ContentKeyPolicyConfiguration(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.odata_type = None # type: Optional[str] + self.odata_type: Optional[str] = None class ContentKeyPolicyClearKeyConfiguration(ContentKeyPolicyConfiguration): @@ -2181,7 +2181,7 @@ class ContentKeyPolicyClearKeyConfiguration(ContentKeyPolicyConfiguration): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.odata_type = "#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration" # type: str + self.odata_type: str = "#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration" class ContentKeyPolicyCollection(_serialization.Model): @@ -2225,7 +2225,8 @@ class ContentKeyPolicyFairPlayConfiguration(ContentKeyPolicyConfiguration): :ivar odata_type: The discriminator for derived types. Required. :vartype odata_type: str - :ivar ask: The key that must be used as FairPlay Application Secret key. Required. + :ivar ask: The key that must be used as FairPlay Application Secret key. This needs to be + base64 encoded. Required. :vartype ask: bytes :ivar fair_play_pfx_password: The password encrypting FairPlay certificate in PKCS 12 (pfx) format. Required. @@ -2278,7 +2279,8 @@ def __init__( **kwargs ): """ - :keyword ask: The key that must be used as FairPlay Application Secret key. Required. + :keyword ask: The key that must be used as FairPlay Application Secret key. This needs to be + base64 encoded. Required. :paramtype ask: bytes :keyword fair_play_pfx_password: The password encrypting FairPlay certificate in PKCS 12 (pfx) format. Required. @@ -2297,7 +2299,7 @@ def __init__( ~azure.mgmt.media.models.ContentKeyPolicyFairPlayOfflineRentalConfiguration """ super().__init__(**kwargs) - self.odata_type = "#Microsoft.Media.ContentKeyPolicyFairPlayConfiguration" # type: str + self.odata_type: str = "#Microsoft.Media.ContentKeyPolicyFairPlayConfiguration" self.ask = ask self.fair_play_pfx_password = fair_play_pfx_password self.fair_play_pfx = fair_play_pfx @@ -2371,7 +2373,7 @@ class ContentKeyPolicyRestriction(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.odata_type = None # type: Optional[str] + self.odata_type: Optional[str] = None class ContentKeyPolicyOpenRestriction(ContentKeyPolicyRestriction): @@ -2394,7 +2396,7 @@ class ContentKeyPolicyOpenRestriction(ContentKeyPolicyRestriction): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.odata_type = "#Microsoft.Media.ContentKeyPolicyOpenRestriction" # type: str + self.odata_type: str = "#Microsoft.Media.ContentKeyPolicyOpenRestriction" class ContentKeyPolicyOption(_serialization.Model): @@ -2490,7 +2492,7 @@ def __init__( :paramtype response_custom_data: str """ super().__init__(**kwargs) - self.odata_type = "#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration" # type: str + self.odata_type: str = "#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration" self.licenses = licenses self.response_custom_data = response_custom_data @@ -2526,7 +2528,7 @@ class ContentKeyPolicyPlayReadyContentKeyLocation(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.odata_type = None # type: Optional[str] + self.odata_type: Optional[str] = None class ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader(ContentKeyPolicyPlayReadyContentKeyLocation): @@ -2549,7 +2551,7 @@ class ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader(ContentKeyPolicyPl def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.odata_type = "#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader" # type: str + self.odata_type: str = "#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader" class ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier(ContentKeyPolicyPlayReadyContentKeyLocation): @@ -2579,7 +2581,7 @@ def __init__(self, *, key_id: str, **kwargs): :paramtype key_id: str """ super().__init__(**kwargs) - self.odata_type = "#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier" # type: str + self.odata_type: str = "#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier" self.key_id = key_id @@ -2983,7 +2985,7 @@ class ContentKeyPolicyRestrictionTokenKey(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.odata_type = None # type: Optional[str] + self.odata_type: Optional[str] = None class ContentKeyPolicyRsaTokenKey(ContentKeyPolicyRestrictionTokenKey): @@ -3019,7 +3021,7 @@ def __init__(self, *, exponent: bytes, modulus: bytes, **kwargs): :paramtype modulus: bytes """ super().__init__(**kwargs) - self.odata_type = "#Microsoft.Media.ContentKeyPolicyRsaTokenKey" # type: str + self.odata_type: str = "#Microsoft.Media.ContentKeyPolicyRsaTokenKey" self.exponent = exponent self.modulus = modulus @@ -3051,7 +3053,7 @@ def __init__(self, *, key_value: bytes, **kwargs): :paramtype key_value: bytes """ super().__init__(**kwargs) - self.odata_type = "#Microsoft.Media.ContentKeyPolicySymmetricTokenKey" # type: str + self.odata_type: str = "#Microsoft.Media.ContentKeyPolicySymmetricTokenKey" self.key_value = key_value @@ -3162,7 +3164,7 @@ def __init__( :paramtype open_id_connect_discovery_document: str """ super().__init__(**kwargs) - self.odata_type = "#Microsoft.Media.ContentKeyPolicyTokenRestriction" # type: str + self.odata_type: str = "#Microsoft.Media.ContentKeyPolicyTokenRestriction" self.issuer = issuer self.audience = audience self.primary_verification_key = primary_verification_key @@ -3192,7 +3194,7 @@ class ContentKeyPolicyUnknownConfiguration(ContentKeyPolicyConfiguration): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.odata_type = "#Microsoft.Media.ContentKeyPolicyUnknownConfiguration" # type: str + self.odata_type: str = "#Microsoft.Media.ContentKeyPolicyUnknownConfiguration" class ContentKeyPolicyUnknownRestriction(ContentKeyPolicyRestriction): @@ -3215,7 +3217,7 @@ class ContentKeyPolicyUnknownRestriction(ContentKeyPolicyRestriction): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.odata_type = "#Microsoft.Media.ContentKeyPolicyUnknownRestriction" # type: str + self.odata_type: str = "#Microsoft.Media.ContentKeyPolicyUnknownRestriction" class ContentKeyPolicyWidevineConfiguration(ContentKeyPolicyConfiguration): @@ -3245,7 +3247,7 @@ def __init__(self, *, widevine_template: str, **kwargs): :paramtype widevine_template: str """ super().__init__(**kwargs) - self.odata_type = "#Microsoft.Media.ContentKeyPolicyWidevineConfiguration" # type: str + self.odata_type: str = "#Microsoft.Media.ContentKeyPolicyWidevineConfiguration" self.widevine_template = widevine_template @@ -3278,7 +3280,7 @@ def __init__(self, *, raw_body: bytes, **kwargs): :paramtype raw_body: bytes """ super().__init__(**kwargs) - self.odata_type = "#Microsoft.Media.ContentKeyPolicyX509CertificateTokenKey" # type: str + self.odata_type: str = "#Microsoft.Media.ContentKeyPolicyX509CertificateTokenKey" self.raw_body = raw_body @@ -3309,7 +3311,7 @@ def __init__(self, *, label: Optional[str] = None, **kwargs): :paramtype label: str """ super().__init__(label=label, **kwargs) - self.odata_type = "#Microsoft.Media.CopyAudio" # type: str + self.odata_type: str = "#Microsoft.Media.CopyAudio" class CopyVideo(Codec): @@ -3339,7 +3341,7 @@ def __init__(self, *, label: Optional[str] = None, **kwargs): :paramtype label: str """ super().__init__(label=label, **kwargs) - self.odata_type = "#Microsoft.Media.CopyVideo" # type: str + self.odata_type: str = "#Microsoft.Media.CopyVideo" class CrossSiteAccessPolicies(_serialization.Model): @@ -3390,6 +3392,59 @@ def __init__(self, *, role: Optional[str] = None, **kwargs): self.role = role +class DDAudio(Audio): + """Describes Dolby Digital Audio Codec (AC3) audio encoding settings. The current implementation for Dolby Digital Audio support are: Audio channel numbers at 1((mono), 2(stereo), 6(5.1side); Audio sampling frequency rates at: 32K/44.1K/48K Hz; Audio bitrate values as AC3 specification supports: 32000, 40000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 160000, 192000, 224000, 256000, 320000, 384000, 448000, 512000, 576000, 640000 bps. + + All required parameters must be populated in order to send to Azure. + + :ivar odata_type: The discriminator for derived types. Required. + :vartype odata_type: str + :ivar label: An optional label for the codec. The label can be used to control muxing behavior. + :vartype label: str + :ivar channels: The number of channels in the audio. + :vartype channels: int + :ivar sampling_rate: The sampling rate to use for encoding in hertz. + :vartype sampling_rate: int + :ivar bitrate: The bitrate, in bits per second, of the output encoded audio. + :vartype bitrate: int + """ + + _validation = { + "odata_type": {"required": True}, + } + + _attribute_map = { + "odata_type": {"key": "@odata\\.type", "type": "str"}, + "label": {"key": "label", "type": "str"}, + "channels": {"key": "channels", "type": "int"}, + "sampling_rate": {"key": "samplingRate", "type": "int"}, + "bitrate": {"key": "bitrate", "type": "int"}, + } + + def __init__( + self, + *, + label: Optional[str] = None, + channels: Optional[int] = None, + sampling_rate: Optional[int] = None, + bitrate: Optional[int] = None, + **kwargs + ): + """ + :keyword label: An optional label for the codec. The label can be used to control muxing + behavior. + :paramtype label: str + :keyword channels: The number of channels in the audio. + :paramtype channels: int + :keyword sampling_rate: The sampling rate to use for encoding in hertz. + :paramtype sampling_rate: int + :keyword bitrate: The bitrate, in bits per second, of the output encoded audio. + :paramtype bitrate: int + """ + super().__init__(label=label, channels=channels, sampling_rate=sampling_rate, bitrate=bitrate, **kwargs) + self.odata_type: str = "#Microsoft.Media.DDAudio" + + class DefaultKey(_serialization.Model): """Class to specify properties of default content key for each encryption scheme. @@ -3877,13 +3932,68 @@ def __init__( :paramtype experimental_options: dict[str, str] """ super().__init__(**kwargs) - self.odata_type = "#Microsoft.Media.FaceDetectorPreset" # type: str + self.odata_type: str = "#Microsoft.Media.FaceDetectorPreset" self.resolution = resolution self.mode = mode self.blur_type = blur_type self.experimental_options = experimental_options +class Fade(_serialization.Model): + """Describes the properties of a Fade effect applied to the input media. + + All required parameters must be populated in order to send to Azure. + + :ivar duration: The Duration of the fade effect in the video. The value can be in ISO 8601 + format (For example, PT05S to fade In/Out a color during 5 seconds), or a frame count (For + example, 10 to fade 10 frames from the start time), or a relative value to stream duration (For + example, 10% to fade 10% of stream duration). Required. + :vartype duration: str + :ivar fade_color: The Color for the fade In/Out. it can be on the CSS Level1 colors + https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/color_keywords or an RGB/hex + value: e.g: rgb(255,0,0), 0xFF0000 or #FF0000. Required. + :vartype fade_color: str + :ivar start: The position in the input video from where to start fade. 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). Default is 0. + :vartype start: str + """ + + _validation = { + "duration": {"required": True}, + "fade_color": {"required": True}, + } + + _attribute_map = { + "duration": {"key": "duration", "type": "str"}, + "fade_color": {"key": "fadeColor", "type": "str"}, + "start": {"key": "start", "type": "str"}, + } + + def __init__(self, *, duration: str, fade_color: str, start: Optional[str] = None, **kwargs): + """ + :keyword duration: The Duration of the fade effect in the video. The value can be in ISO 8601 + format (For example, PT05S to fade In/Out a color during 5 seconds), or a frame count (For + example, 10 to fade 10 frames from the start time), or a relative value to stream duration (For + example, 10% to fade 10% of stream duration). Required. + :paramtype duration: str + :keyword fade_color: The Color for the fade In/Out. it can be on the CSS Level1 colors + https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/color_keywords or an RGB/hex + value: e.g: rgb(255,0,0), 0xFF0000 or #FF0000. Required. + :paramtype fade_color: str + :keyword start: The position in the input video from where to start fade. 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). Default is 0. + :paramtype start: str + """ + super().__init__(**kwargs) + self.duration = duration + self.fade_color = fade_color + self.start = start + + class Filters(_serialization.Model): """Describes all the filtering operations, such as de-interlacing, rotation etc. that are to be applied to the input media before encoding. @@ -3895,6 +4005,10 @@ class Filters(_serialization.Model): :vartype rotation: str or ~azure.mgmt.media.models.Rotation :ivar crop: The parameters for the rectangular window with which to crop the input video. :vartype crop: ~azure.mgmt.media.models.Rectangle + :ivar fade_in: Describes the properties of a Fade effect applied to the input media. + :vartype fade_in: ~azure.mgmt.media.models.Fade + :ivar fade_out: Describes the properties of a Fade effect applied to the input media. + :vartype fade_out: ~azure.mgmt.media.models.Fade :ivar overlays: The properties of overlays to be applied to the input video. These could be audio, image or video overlays. :vartype overlays: list[~azure.mgmt.media.models.Overlay] @@ -3904,6 +4018,8 @@ class Filters(_serialization.Model): "deinterlace": {"key": "deinterlace", "type": "Deinterlace"}, "rotation": {"key": "rotation", "type": "str"}, "crop": {"key": "crop", "type": "Rectangle"}, + "fade_in": {"key": "fadeIn", "type": "Fade"}, + "fade_out": {"key": "fadeOut", "type": "Fade"}, "overlays": {"key": "overlays", "type": "[Overlay]"}, } @@ -3913,6 +4029,8 @@ def __init__( deinterlace: Optional["_models.Deinterlace"] = None, rotation: Optional[Union[str, "_models.Rotation"]] = None, crop: Optional["_models.Rectangle"] = None, + fade_in: Optional["_models.Fade"] = None, + fade_out: Optional["_models.Fade"] = None, overlays: Optional[List["_models.Overlay"]] = None, **kwargs ): @@ -3925,6 +4043,10 @@ def __init__( :paramtype rotation: str or ~azure.mgmt.media.models.Rotation :keyword crop: The parameters for the rectangular window with which to crop the input video. :paramtype crop: ~azure.mgmt.media.models.Rectangle + :keyword fade_in: Describes the properties of a Fade effect applied to the input media. + :paramtype fade_in: ~azure.mgmt.media.models.Fade + :keyword fade_out: Describes the properties of a Fade effect applied to the input media. + :paramtype fade_out: ~azure.mgmt.media.models.Fade :keyword overlays: The properties of overlays to be applied to the input video. These could be audio, image or video overlays. :paramtype overlays: list[~azure.mgmt.media.models.Overlay] @@ -3933,6 +4055,8 @@ def __init__( self.deinterlace = deinterlace self.rotation = rotation self.crop = crop + self.fade_in = fade_in + self.fade_out = fade_out self.overlays = overlays @@ -4049,16 +4173,17 @@ class Format(_serialization.Model): :ivar odata_type: The discriminator for derived types. Required. :vartype odata_type: str - :ivar filename_pattern: The pattern of the file names for the generated output files. The + :ivar filename_pattern: The file naming pattern used for the creation of output files. The following macros are supported in the file name: {Basename} - An expansion macro that will use the name of the input video file. If the base name(the file suffix is not included) of the input video file is less than 32 characters long, the base name of input video files will be used. If the length of base name of the input video file exceeds 32 characters, the base name is truncated to the first 32 characters in total length. {Extension} - The appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - A unique - index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video bitrate. Not - applicable to thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video - resolution. Any unsubstituted macros will be collapsed and removed from the filename. Required. + index for thumbnails. Only applicable to thumbnails. {AudioStream} - string "Audio" plus audio + stream number(start from 1). {Bitrate} - The audio/video bitrate in kbps. Not applicable to + thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video resolution. + Any unsubstituted macros will be collapsed and removed from the filename. Required. :vartype filename_pattern: str """ @@ -4081,20 +4206,21 @@ class Format(_serialization.Model): def __init__(self, *, filename_pattern: str, **kwargs): """ - :keyword filename_pattern: The pattern of the file names for the generated output files. The + :keyword filename_pattern: The file naming pattern used for the creation of output files. The following macros are supported in the file name: {Basename} - An expansion macro that will use the name of the input video file. If the base name(the file suffix is not included) of the input video file is less than 32 characters long, the base name of input video files will be used. If the length of base name of the input video file exceeds 32 characters, the base name is truncated to the first 32 characters in total length. {Extension} - The appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - A unique - index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video bitrate. Not - applicable to thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video - resolution. Any unsubstituted macros will be collapsed and removed from the filename. Required. + index for thumbnails. Only applicable to thumbnails. {AudioStream} - string "Audio" plus audio + stream number(start from 1). {Bitrate} - The audio/video bitrate in kbps. Not applicable to + thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video resolution. + Any unsubstituted macros will be collapsed and removed from the filename. Required. :paramtype filename_pattern: str """ super().__init__(**kwargs) - self.odata_type = None # type: Optional[str] + self.odata_type: Optional[str] = None self.filename_pattern = filename_pattern @@ -4137,7 +4263,7 @@ def __init__(self, *, included_tracks: Optional[List["_models.TrackDescriptor"]] :paramtype included_tracks: list[~azure.mgmt.media.models.TrackDescriptor] """ super().__init__(**kwargs) - self.odata_type = None # type: Optional[str] + self.odata_type: Optional[str] = None self.included_tracks = included_tracks @@ -4169,7 +4295,7 @@ def __init__(self, *, included_tracks: Optional[List["_models.TrackDescriptor"]] :paramtype included_tracks: list[~azure.mgmt.media.models.TrackDescriptor] """ super().__init__(included_tracks=included_tracks, **kwargs) - self.odata_type = "#Microsoft.Media.FromAllInputFile" # type: str + self.odata_type: str = "#Microsoft.Media.FromAllInputFile" class FromEachInputFile(InputDefinition): @@ -4200,7 +4326,7 @@ def __init__(self, *, included_tracks: Optional[List["_models.TrackDescriptor"]] :paramtype included_tracks: list[~azure.mgmt.media.models.TrackDescriptor] """ super().__init__(included_tracks=included_tracks, **kwargs) - self.odata_type = "#Microsoft.Media.FromEachInputFile" # type: str + self.odata_type: str = "#Microsoft.Media.FromEachInputFile" class Layer(_serialization.Model): @@ -4619,7 +4745,7 @@ def __init__( :paramtype sync_mode: str or ~azure.mgmt.media.models.VideoSyncMode """ super().__init__(label=label, **kwargs) - self.odata_type = "#Microsoft.Media.Video" # type: str + self.odata_type: str = "#Microsoft.Media.Video" self.key_frame_interval = key_frame_interval self.stretch_mode = stretch_mode self.sync_mode = sync_mode @@ -4720,7 +4846,7 @@ def __init__( super().__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.odata_type: str = "#Microsoft.Media.H264Video" self.complexity = complexity self.layers = layers self.rate_control_mode = rate_control_mode @@ -5111,7 +5237,7 @@ def __init__( super().__init__( label=label, key_frame_interval=key_frame_interval, stretch_mode=stretch_mode, sync_mode=sync_mode, **kwargs ) - self.odata_type = "#Microsoft.Media.H265Video" # type: str + self.odata_type: str = "#Microsoft.Media.H265Video" self.scene_change_detection = scene_change_detection self.complexity = complexity self.layers = layers @@ -5309,7 +5435,7 @@ def __init__( super().__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.odata_type: str = "#Microsoft.Media.Image" self.start = start self.step = step self.range = range @@ -5325,16 +5451,17 @@ class ImageFormat(Format): :ivar odata_type: The discriminator for derived types. Required. :vartype odata_type: str - :ivar filename_pattern: The pattern of the file names for the generated output files. The + :ivar filename_pattern: The file naming pattern used for the creation of output files. The following macros are supported in the file name: {Basename} - An expansion macro that will use the name of the input video file. If the base name(the file suffix is not included) of the input video file is less than 32 characters long, the base name of input video files will be used. If the length of base name of the input video file exceeds 32 characters, the base name is truncated to the first 32 characters in total length. {Extension} - The appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - A unique - index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video bitrate. Not - applicable to thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video - resolution. Any unsubstituted macros will be collapsed and removed from the filename. Required. + index for thumbnails. Only applicable to thumbnails. {AudioStream} - string "Audio" plus audio + stream number(start from 1). {Bitrate} - The audio/video bitrate in kbps. Not applicable to + thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video resolution. + Any unsubstituted macros will be collapsed and removed from the filename. Required. :vartype filename_pattern: str """ @@ -5354,20 +5481,21 @@ class ImageFormat(Format): def __init__(self, *, filename_pattern: str, **kwargs): """ - :keyword filename_pattern: The pattern of the file names for the generated output files. The + :keyword filename_pattern: The file naming pattern used for the creation of output files. The following macros are supported in the file name: {Basename} - An expansion macro that will use the name of the input video file. If the base name(the file suffix is not included) of the input video file is less than 32 characters long, the base name of input video files will be used. If the length of base name of the input video file exceeds 32 characters, the base name is truncated to the first 32 characters in total length. {Extension} - The appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - A unique - index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video bitrate. Not - applicable to thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video - resolution. Any unsubstituted macros will be collapsed and removed from the filename. Required. + index for thumbnails. Only applicable to thumbnails. {AudioStream} - string "Audio" plus audio + stream number(start from 1). {Bitrate} - The audio/video bitrate in kbps. Not applicable to + thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video resolution. + Any unsubstituted macros will be collapsed and removed from the filename. Required. :paramtype filename_pattern: str """ super().__init__(filename_pattern=filename_pattern, **kwargs) - self.odata_type = "#Microsoft.Media.ImageFormat" # type: str + self.odata_type: str = "#Microsoft.Media.ImageFormat" class InputFile(InputDefinition): @@ -5409,7 +5537,7 @@ def __init__( :paramtype filename: str """ super().__init__(included_tracks=included_tracks, **kwargs) - self.odata_type = "#Microsoft.Media.InputFile" # type: str + self.odata_type: str = "#Microsoft.Media.InputFile" self.filename = filename @@ -5619,12 +5747,12 @@ class JobError(_serialization.Model): :ivar code: Error code describing the error. Known values are: "ServiceError", "ServiceTransientError", "DownloadNotAccessible", "DownloadTransientError", "UploadNotAccessible", "UploadTransientError", "ConfigurationUnsupported", "ContentMalformed", - and "ContentUnsupported". + "ContentUnsupported", and "IdentityUnsupported". :vartype code: str or ~azure.mgmt.media.models.JobErrorCode :ivar message: A human-readable language-dependent representation of the error. :vartype message: str :ivar category: Helps with categorization of errors. Known values are: "Service", "Download", - "Upload", "Configuration", and "Content". + "Upload", "Configuration", "Content", and "Account". :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. Known values are: "DoNotRetry" and "MayRetry". @@ -5718,7 +5846,7 @@ class JobInput(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.odata_type = None # type: Optional[str] + self.odata_type: Optional[str] = None class JobInputClip(JobInput): @@ -5802,7 +5930,7 @@ def __init__( :paramtype input_definitions: list[~azure.mgmt.media.models.InputDefinition] """ super().__init__(**kwargs) - self.odata_type = "#Microsoft.Media.JobInputClip" # type: str + self.odata_type: str = "#Microsoft.Media.JobInputClip" self.files = files self.start = start self.end = end @@ -5888,7 +6016,7 @@ def __init__( :paramtype asset_name: str """ super().__init__(files=files, start=start, end=end, label=label, input_definitions=input_definitions, **kwargs) - self.odata_type = "#Microsoft.Media.JobInputAsset" # type: str + self.odata_type: str = "#Microsoft.Media.JobInputAsset" self.asset_name = asset_name @@ -5975,7 +6103,7 @@ def __init__( :paramtype base_uri: str """ super().__init__(files=files, start=start, end=end, label=label, input_definitions=input_definitions, **kwargs) - self.odata_type = "#Microsoft.Media.JobInputHttp" # type: str + self.odata_type: str = "#Microsoft.Media.JobInputHttp" self.base_uri = base_uri @@ -6005,7 +6133,7 @@ def __init__(self, *, inputs: Optional[List["_models.JobInput"]] = None, **kwarg :paramtype inputs: list[~azure.mgmt.media.models.JobInput] """ super().__init__(**kwargs) - self.odata_type = "#Microsoft.Media.JobInputs" # type: str + self.odata_type: str = "#Microsoft.Media.JobInputs" self.inputs = inputs @@ -6035,7 +6163,7 @@ def __init__(self, *, inputs: Optional[List["_models.JobInputClip"]] = None, **k :paramtype inputs: list[~azure.mgmt.media.models.JobInputClip] """ super().__init__(**kwargs) - self.odata_type = "#Microsoft.Media.JobInputSequence" # type: str + self.odata_type: str = "#Microsoft.Media.JobInputSequence" self.inputs = inputs @@ -6120,7 +6248,7 @@ def __init__(self, *, preset_override: Optional["_models.Preset"] = None, label: :paramtype label: str """ super().__init__(**kwargs) - self.odata_type = None # type: Optional[str] + self.odata_type: Optional[str] = None self.error = None self.preset_override = preset_override self.state = None @@ -6219,7 +6347,7 @@ def __init__( :paramtype asset_name: str """ super().__init__(preset_override=preset_override, label=label, **kwargs) - self.odata_type = "#Microsoft.Media.JobOutputAsset" # type: str + self.odata_type: str = "#Microsoft.Media.JobOutputAsset" self.asset_name = asset_name @@ -6230,16 +6358,17 @@ class JpgFormat(ImageFormat): :ivar odata_type: The discriminator for derived types. Required. :vartype odata_type: str - :ivar filename_pattern: The pattern of the file names for the generated output files. The + :ivar filename_pattern: The file naming pattern used for the creation of output files. The following macros are supported in the file name: {Basename} - An expansion macro that will use the name of the input video file. If the base name(the file suffix is not included) of the input video file is less than 32 characters long, the base name of input video files will be used. If the length of base name of the input video file exceeds 32 characters, the base name is truncated to the first 32 characters in total length. {Extension} - The appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - A unique - index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video bitrate. Not - applicable to thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video - resolution. Any unsubstituted macros will be collapsed and removed from the filename. Required. + index for thumbnails. Only applicable to thumbnails. {AudioStream} - string "Audio" plus audio + stream number(start from 1). {Bitrate} - The audio/video bitrate in kbps. Not applicable to + thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video resolution. + Any unsubstituted macros will be collapsed and removed from the filename. Required. :vartype filename_pattern: str """ @@ -6255,20 +6384,21 @@ class JpgFormat(ImageFormat): def __init__(self, *, filename_pattern: str, **kwargs): """ - :keyword filename_pattern: The pattern of the file names for the generated output files. The + :keyword filename_pattern: The file naming pattern used for the creation of output files. The following macros are supported in the file name: {Basename} - An expansion macro that will use the name of the input video file. If the base name(the file suffix is not included) of the input video file is less than 32 characters long, the base name of input video files will be used. If the length of base name of the input video file exceeds 32 characters, the base name is truncated to the first 32 characters in total length. {Extension} - The appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - A unique - index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video bitrate. Not - applicable to thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video - resolution. Any unsubstituted macros will be collapsed and removed from the filename. Required. + index for thumbnails. Only applicable to thumbnails. {AudioStream} - string "Audio" plus audio + stream number(start from 1). {Bitrate} - The audio/video bitrate in kbps. Not applicable to + thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video resolution. + Any unsubstituted macros will be collapsed and removed from the filename. Required. :paramtype filename_pattern: str """ super().__init__(filename_pattern=filename_pattern, **kwargs) - self.odata_type = "#Microsoft.Media.JpgFormat" # type: str + self.odata_type: str = "#Microsoft.Media.JpgFormat" class JpgImage(Image): @@ -6422,7 +6552,7 @@ def __init__( range=range, **kwargs ) - self.odata_type = "#Microsoft.Media.JpgImage" # type: str + self.odata_type: str = "#Microsoft.Media.JpgImage" self.layers = layers self.sprite_column = sprite_column @@ -8043,16 +8173,17 @@ class MultiBitrateFormat(Format): :ivar odata_type: The discriminator for derived types. Required. :vartype odata_type: str - :ivar filename_pattern: The pattern of the file names for the generated output files. The + :ivar filename_pattern: The file naming pattern used for the creation of output files. The following macros are supported in the file name: {Basename} - An expansion macro that will use the name of the input video file. If the base name(the file suffix is not included) of the input video file is less than 32 characters long, the base name of input video files will be used. If the length of base name of the input video file exceeds 32 characters, the base name is truncated to the first 32 characters in total length. {Extension} - The appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - A unique - index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video bitrate. Not - applicable to thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video - resolution. Any unsubstituted macros will be collapsed and removed from the filename. Required. + index for thumbnails. Only applicable to thumbnails. {AudioStream} - string "Audio" plus audio + stream number(start from 1). {Bitrate} - The audio/video bitrate in kbps. Not applicable to + thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video resolution. + Any unsubstituted macros will be collapsed and removed from the filename. Required. :vartype filename_pattern: str :ivar output_files: The list of output files to produce. Each entry in the list is a set of audio and video layer labels to be muxed together . @@ -8079,23 +8210,24 @@ class MultiBitrateFormat(Format): def __init__(self, *, filename_pattern: str, output_files: Optional[List["_models.OutputFile"]] = None, **kwargs): """ - :keyword filename_pattern: The pattern of the file names for the generated output files. The + :keyword filename_pattern: The file naming pattern used for the creation of output files. The following macros are supported in the file name: {Basename} - An expansion macro that will use the name of the input video file. If the base name(the file suffix is not included) of the input video file is less than 32 characters long, the base name of input video files will be used. If the length of base name of the input video file exceeds 32 characters, the base name is truncated to the first 32 characters in total length. {Extension} - The appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - A unique - index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video bitrate. Not - applicable to thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video - resolution. Any unsubstituted macros will be collapsed and removed from the filename. Required. + index for thumbnails. Only applicable to thumbnails. {AudioStream} - string "Audio" plus audio + stream number(start from 1). {Bitrate} - The audio/video bitrate in kbps. Not applicable to + thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video resolution. + Any unsubstituted macros will be collapsed and removed from the filename. Required. :paramtype filename_pattern: str :keyword output_files: The list of output files to produce. Each entry in the list is a set of audio and video layer labels to be muxed together . :paramtype output_files: list[~azure.mgmt.media.models.OutputFile] """ super().__init__(filename_pattern=filename_pattern, **kwargs) - self.odata_type = "#Microsoft.Media.MultiBitrateFormat" # type: str + self.odata_type: str = "#Microsoft.Media.MultiBitrateFormat" self.output_files = output_files @@ -8106,16 +8238,17 @@ class Mp4Format(MultiBitrateFormat): :ivar odata_type: The discriminator for derived types. Required. :vartype odata_type: str - :ivar filename_pattern: The pattern of the file names for the generated output files. The + :ivar filename_pattern: The file naming pattern used for the creation of output files. The following macros are supported in the file name: {Basename} - An expansion macro that will use the name of the input video file. If the base name(the file suffix is not included) of the input video file is less than 32 characters long, the base name of input video files will be used. If the length of base name of the input video file exceeds 32 characters, the base name is truncated to the first 32 characters in total length. {Extension} - The appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - A unique - index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video bitrate. Not - applicable to thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video - resolution. Any unsubstituted macros will be collapsed and removed from the filename. Required. + index for thumbnails. Only applicable to thumbnails. {AudioStream} - string "Audio" plus audio + stream number(start from 1). {Bitrate} - The audio/video bitrate in kbps. Not applicable to + thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video resolution. + Any unsubstituted macros will be collapsed and removed from the filename. Required. :vartype filename_pattern: str :ivar output_files: The list of output files to produce. Each entry in the list is a set of audio and video layer labels to be muxed together . @@ -8135,23 +8268,24 @@ class Mp4Format(MultiBitrateFormat): def __init__(self, *, filename_pattern: str, output_files: Optional[List["_models.OutputFile"]] = None, **kwargs): """ - :keyword filename_pattern: The pattern of the file names for the generated output files. The + :keyword filename_pattern: The file naming pattern used for the creation of output files. The following macros are supported in the file name: {Basename} - An expansion macro that will use the name of the input video file. If the base name(the file suffix is not included) of the input video file is less than 32 characters long, the base name of input video files will be used. If the length of base name of the input video file exceeds 32 characters, the base name is truncated to the first 32 characters in total length. {Extension} - The appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - A unique - index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video bitrate. Not - applicable to thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video - resolution. Any unsubstituted macros will be collapsed and removed from the filename. Required. + index for thumbnails. Only applicable to thumbnails. {AudioStream} - string "Audio" plus audio + stream number(start from 1). {Bitrate} - The audio/video bitrate in kbps. Not applicable to + thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video resolution. + Any unsubstituted macros will be collapsed and removed from the filename. Required. :paramtype filename_pattern: str :keyword output_files: The list of output files to produce. Each entry in the list is a set of audio and video layer labels to be muxed together . :paramtype output_files: list[~azure.mgmt.media.models.OutputFile] """ super().__init__(filename_pattern=filename_pattern, output_files=output_files, **kwargs) - self.odata_type = "#Microsoft.Media.Mp4Format" # type: str + self.odata_type: str = "#Microsoft.Media.Mp4Format" class NoEncryption(_serialization.Model): @@ -8347,16 +8481,17 @@ class PngFormat(ImageFormat): :ivar odata_type: The discriminator for derived types. Required. :vartype odata_type: str - :ivar filename_pattern: The pattern of the file names for the generated output files. The + :ivar filename_pattern: The file naming pattern used for the creation of output files. The following macros are supported in the file name: {Basename} - An expansion macro that will use the name of the input video file. If the base name(the file suffix is not included) of the input video file is less than 32 characters long, the base name of input video files will be used. If the length of base name of the input video file exceeds 32 characters, the base name is truncated to the first 32 characters in total length. {Extension} - The appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - A unique - index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video bitrate. Not - applicable to thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video - resolution. Any unsubstituted macros will be collapsed and removed from the filename. Required. + index for thumbnails. Only applicable to thumbnails. {AudioStream} - string "Audio" plus audio + stream number(start from 1). {Bitrate} - The audio/video bitrate in kbps. Not applicable to + thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video resolution. + Any unsubstituted macros will be collapsed and removed from the filename. Required. :vartype filename_pattern: str """ @@ -8372,20 +8507,21 @@ class PngFormat(ImageFormat): def __init__(self, *, filename_pattern: str, **kwargs): """ - :keyword filename_pattern: The pattern of the file names for the generated output files. The + :keyword filename_pattern: The file naming pattern used for the creation of output files. The following macros are supported in the file name: {Basename} - An expansion macro that will use the name of the input video file. If the base name(the file suffix is not included) of the input video file is less than 32 characters long, the base name of input video files will be used. If the length of base name of the input video file exceeds 32 characters, the base name is truncated to the first 32 characters in total length. {Extension} - The appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - A unique - index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video bitrate. Not - applicable to thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video - resolution. Any unsubstituted macros will be collapsed and removed from the filename. Required. + index for thumbnails. Only applicable to thumbnails. {AudioStream} - string "Audio" plus audio + stream number(start from 1). {Bitrate} - The audio/video bitrate in kbps. Not applicable to + thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video resolution. + Any unsubstituted macros will be collapsed and removed from the filename. Required. :paramtype filename_pattern: str """ super().__init__(filename_pattern=filename_pattern, **kwargs) - self.odata_type = "#Microsoft.Media.PngFormat" # type: str + self.odata_type: str = "#Microsoft.Media.PngFormat" class PngImage(Image): @@ -8525,7 +8661,7 @@ def __init__( range=range, **kwargs ) - self.odata_type = "#Microsoft.Media.PngImage" # type: str + self.odata_type: str = "#Microsoft.Media.PngImage" self.layers = layers @@ -9126,7 +9262,7 @@ def __init__( :paramtype filter_value: str """ super().__init__(channel_mapping=channel_mapping, **kwargs) - self.odata_type = "#Microsoft.Media.SelectAudioTrackByAttribute" # type: str + self.odata_type: str = "#Microsoft.Media.SelectAudioTrackByAttribute" self.attribute = attribute self.filter = filter self.filter_value = filter_value @@ -9172,7 +9308,7 @@ def __init__( :paramtype track_id: int """ super().__init__(channel_mapping=channel_mapping, **kwargs) - self.odata_type = "#Microsoft.Media.SelectAudioTrackById" # type: str + self.odata_type: str = "#Microsoft.Media.SelectAudioTrackById" self.track_id = track_id @@ -9206,7 +9342,7 @@ class VideoTrackDescriptor(TrackDescriptor): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.odata_type = "#Microsoft.Media.VideoTrackDescriptor" # type: str + self.odata_type: str = "#Microsoft.Media.VideoTrackDescriptor" class SelectVideoTrackByAttribute(VideoTrackDescriptor): @@ -9264,7 +9400,7 @@ def __init__( :paramtype filter_value: str """ super().__init__(**kwargs) - self.odata_type = "#Microsoft.Media.SelectVideoTrackByAttribute" # type: str + self.odata_type: str = "#Microsoft.Media.SelectVideoTrackByAttribute" self.attribute = attribute self.filter = filter self.filter_value = filter_value @@ -9297,7 +9433,7 @@ def __init__(self, *, track_id: int, **kwargs): :paramtype track_id: int """ super().__init__(**kwargs) - self.odata_type = "#Microsoft.Media.SelectVideoTrackById" # type: str + self.odata_type: str = "#Microsoft.Media.SelectVideoTrackById" self.track_id = track_id @@ -9336,6 +9472,9 @@ class StandardEncoderPreset(Preset): :ivar odata_type: The discriminator for derived types. Required. :vartype odata_type: str + :ivar experimental_options: Dictionary containing key value pairs for parameters not exposed in + the preset itself. + :vartype experimental_options: dict[str, str] :ivar filters: One or more filtering operations that are applied to the input media before encoding. :vartype filters: ~azure.mgmt.media.models.Filters @@ -9353,6 +9492,7 @@ class StandardEncoderPreset(Preset): _attribute_map = { "odata_type": {"key": "@odata\\.type", "type": "str"}, + "experimental_options": {"key": "experimentalOptions", "type": "{str}"}, "filters": {"key": "filters", "type": "Filters"}, "codecs": {"key": "codecs", "type": "[Codec]"}, "formats": {"key": "formats", "type": "[Format]"}, @@ -9363,10 +9503,14 @@ def __init__( *, codecs: List["_models.Codec"], formats: List["_models.Format"], + experimental_options: Optional[Dict[str, str]] = None, filters: Optional["_models.Filters"] = None, **kwargs ): """ + :keyword experimental_options: Dictionary containing key value pairs for parameters not exposed + in the preset itself. + :paramtype experimental_options: dict[str, str] :keyword filters: One or more filtering operations that are applied to the input media before encoding. :paramtype filters: ~azure.mgmt.media.models.Filters @@ -9376,7 +9520,8 @@ def __init__( :paramtype formats: list[~azure.mgmt.media.models.Format] """ super().__init__(**kwargs) - self.odata_type = "#Microsoft.Media.StandardEncoderPreset" # type: str + self.odata_type: str = "#Microsoft.Media.StandardEncoderPreset" + self.experimental_options = experimental_options self.filters = filters self.codecs = codecs self.formats = formats @@ -10485,7 +10630,7 @@ def __init__( :paramtype hls_settings: ~azure.mgmt.media.models.HlsSettings """ super().__init__(**kwargs) - self.odata_type = "#Microsoft.Media.TextTrack" # type: str + self.odata_type: str = "#Microsoft.Media.TextTrack" self.file_name = file_name self.display_name = display_name self.language_code = None @@ -10723,16 +10868,17 @@ class TransportStreamFormat(MultiBitrateFormat): :ivar odata_type: The discriminator for derived types. Required. :vartype odata_type: str - :ivar filename_pattern: The pattern of the file names for the generated output files. The + :ivar filename_pattern: The file naming pattern used for the creation of output files. The following macros are supported in the file name: {Basename} - An expansion macro that will use the name of the input video file. If the base name(the file suffix is not included) of the input video file is less than 32 characters long, the base name of input video files will be used. If the length of base name of the input video file exceeds 32 characters, the base name is truncated to the first 32 characters in total length. {Extension} - The appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - A unique - index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video bitrate. Not - applicable to thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video - resolution. Any unsubstituted macros will be collapsed and removed from the filename. Required. + index for thumbnails. Only applicable to thumbnails. {AudioStream} - string "Audio" plus audio + stream number(start from 1). {Bitrate} - The audio/video bitrate in kbps. Not applicable to + thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video resolution. + Any unsubstituted macros will be collapsed and removed from the filename. Required. :vartype filename_pattern: str :ivar output_files: The list of output files to produce. Each entry in the list is a set of audio and video layer labels to be muxed together . @@ -10752,23 +10898,24 @@ class TransportStreamFormat(MultiBitrateFormat): def __init__(self, *, filename_pattern: str, output_files: Optional[List["_models.OutputFile"]] = None, **kwargs): """ - :keyword filename_pattern: The pattern of the file names for the generated output files. The + :keyword filename_pattern: The file naming pattern used for the creation of output files. The following macros are supported in the file name: {Basename} - An expansion macro that will use the name of the input video file. If the base name(the file suffix is not included) of the input video file is less than 32 characters long, the base name of input video files will be used. If the length of base name of the input video file exceeds 32 characters, the base name is truncated to the first 32 characters in total length. {Extension} - The appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - A unique - index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video bitrate. Not - applicable to thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video - resolution. Any unsubstituted macros will be collapsed and removed from the filename. Required. + index for thumbnails. Only applicable to thumbnails. {AudioStream} - string "Audio" plus audio + stream number(start from 1). {Bitrate} - The audio/video bitrate in kbps. Not applicable to + thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video resolution. + Any unsubstituted macros will be collapsed and removed from the filename. Required. :paramtype filename_pattern: str :keyword output_files: The list of output files to produce. Each entry in the list is a set of audio and video layer labels to be muxed together . :paramtype output_files: list[~azure.mgmt.media.models.OutputFile] """ super().__init__(filename_pattern=filename_pattern, output_files=output_files, **kwargs) - self.odata_type = "#Microsoft.Media.TransportStreamFormat" # type: str + self.odata_type: str = "#Microsoft.Media.TransportStreamFormat" class UserAssignedManagedIdentity(_serialization.Model): @@ -10827,7 +10974,7 @@ def __init__(self, *, time: datetime.datetime, **kwargs): :paramtype time: ~datetime.datetime """ super().__init__(**kwargs) - self.odata_type = "#Microsoft.Media.UtcClipTime" # type: str + self.odata_type: str = "#Microsoft.Media.UtcClipTime" self.time = time @@ -10918,7 +11065,7 @@ def __init__( :paramtype insights_to_extract: str or ~azure.mgmt.media.models.InsightsType """ super().__init__(audio_language=audio_language, mode=mode, experimental_options=experimental_options, **kwargs) - self.odata_type = "#Microsoft.Media.VideoAnalyzerPreset" # type: str + self.odata_type: str = "#Microsoft.Media.VideoAnalyzerPreset" self.insights_to_extract = insights_to_extract @@ -11047,7 +11194,7 @@ def __init__( audio_gain_level=audio_gain_level, **kwargs ) - self.odata_type = "#Microsoft.Media.VideoOverlay" # type: str + self.odata_type: str = "#Microsoft.Media.VideoOverlay" self.position = position self.opacity = opacity self.crop_rectangle = crop_rectangle @@ -11073,4 +11220,4 @@ class VideoTrack(TrackBase): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.odata_type = "#Microsoft.Media.VideoTrack" # type: str + self.odata_type: str = "#Microsoft.Media.VideoTrack" 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 bf9127707638a..7c0aa16e6df39 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 @@ -29,7 +29,7 @@ from ._streaming_endpoints_operations import StreamingEndpointsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ 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 da236580d8a48..19affc4f7a1da 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,6 +29,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +44,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +58,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription "accountName": _SERIALIZER.url("account_name", account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -70,7 +75,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +90,7 @@ def build_get_request( "filterName": _SERIALIZER.url("filter_name", filter_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -102,8 +107,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -118,7 +123,7 @@ def build_create_or_update_request( "filterName": _SERIALIZER.url("filter_name", filter_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -137,7 +142,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -152,7 +157,7 @@ def build_delete_request( "filterName": _SERIALIZER.url("filter_name", filter_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -169,8 +174,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -185,7 +190,7 @@ def build_update_request( "filterName": _SERIALIZER.url("filter_name", filter_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -236,8 +241,8 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccountFilterCollection] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.AccountFilterCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -260,12 +265,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -273,13 +278,13 @@ 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) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.odata_next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -293,7 +298,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters" + } @distributed_trace def get( @@ -326,8 +333,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccountFilter] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.AccountFilter] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -340,9 +347,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -360,7 +367,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}" + } @overload def create_or_update( @@ -469,9 +478,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccountFilter] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccountFilter] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -495,9 +504,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -515,11 +524,13 @@ def create_or_update( deserialized = self._deserialize("AccountFilter", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -552,8 +563,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -566,9 +577,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -582,7 +593,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}" + } @overload def update( @@ -691,9 +704,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AccountFilter] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AccountFilter] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -717,9 +730,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -737,4 +750,6 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}" + } 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 ebf082cdbb6ef..379bfbc859421 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,6 +29,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +46,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +61,7 @@ def build_list_request( "assetName": _SERIALIZER.url("asset_name", asset_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,7 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +94,7 @@ def build_get_request( "filterName": _SERIALIZER.url("filter_name", filter_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -106,8 +111,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +128,7 @@ def build_create_or_update_request( "filterName": _SERIALIZER.url("filter_name", filter_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,7 +147,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +163,7 @@ def build_delete_request( "filterName": _SERIALIZER.url("filter_name", filter_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -175,8 +180,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -192,7 +197,7 @@ def build_update_request( "filterName": _SERIALIZER.url("filter_name", filter_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -247,8 +252,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AssetFilterCollection] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.AssetFilterCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -272,12 +277,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -285,13 +290,13 @@ 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) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.odata_next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -305,7 +310,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters" + } @distributed_trace def get( @@ -340,8 +347,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AssetFilter] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.AssetFilter] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -355,9 +362,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -375,7 +382,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}" + } @overload def create_or_update( @@ -493,9 +502,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AssetFilter] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AssetFilter] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -520,9 +529,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -540,11 +549,13 @@ def create_or_update( deserialized = self._deserialize("AssetFilter", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -579,8 +590,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -594,9 +605,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -610,7 +621,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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 + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}" + } @overload def update( @@ -728,9 +741,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AssetFilter] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AssetFilter] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -755,9 +768,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -775,4 +788,6 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}" + } 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 f7bfb661db00b..aa9df731ac142 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,6 +29,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +53,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +67,7 @@ def build_list_request( "accountName": _SERIALIZER.url("account_name", account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -85,7 +90,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -100,7 +105,7 @@ def build_get_request( "assetName": _SERIALIZER.url("asset_name", asset_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -117,8 +122,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -133,7 +138,7 @@ def build_create_or_update_request( "assetName": _SERIALIZER.url("asset_name", asset_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -152,7 +157,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -167,7 +172,7 @@ def build_delete_request( "assetName": _SERIALIZER.url("asset_name", asset_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -184,8 +189,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -200,7 +205,7 @@ def build_update_request( "assetName": _SERIALIZER.url("asset_name", asset_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -219,8 +224,8 @@ def build_list_container_sas_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -235,7 +240,7 @@ def build_list_container_sas_request( "assetName": _SERIALIZER.url("asset_name", asset_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -254,7 +259,7 @@ def build_get_encryption_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -269,7 +274,7 @@ def build_get_encryption_key_request( "assetName": _SERIALIZER.url("asset_name", asset_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -286,7 +291,7 @@ def build_list_streaming_locators_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -301,7 +306,7 @@ def build_list_streaming_locators_request( "assetName": _SERIALIZER.url("asset_name", asset_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -367,8 +372,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AssetCollection] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.AssetCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -394,12 +399,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -407,13 +412,13 @@ 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) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.odata_next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -427,7 +432,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets" + } @distributed_trace def get(self, resource_group_name: str, account_name: str, asset_name: str, **kwargs: Any) -> _models.Asset: @@ -458,8 +465,8 @@ def get(self, resource_group_name: str, account_name: str, asset_name: str, **kw _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Asset] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.Asset] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -472,9 +479,9 @@ def get(self, resource_group_name: str, account_name: str, asset_name: str, **kw params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -492,7 +499,9 @@ def get(self, resource_group_name: str, account_name: str, asset_name: str, **kw return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}" + } @overload def create_or_update( @@ -601,9 +610,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Asset] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Asset] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -627,9 +636,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -647,11 +656,13 @@ def create_or_update( deserialized = self._deserialize("Asset", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -684,8 +695,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -698,9 +709,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -714,7 +725,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}" + } @overload def update( @@ -823,9 +836,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Asset] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Asset] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -849,9 +862,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -869,7 +882,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}" + } @overload def list_container_sas( @@ -981,9 +996,9 @@ def list_container_sas( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AssetContainerSas] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AssetContainerSas] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1007,9 +1022,9 @@ def list_container_sas( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1027,7 +1042,9 @@ def list_container_sas( return deserialized - list_container_sas.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/listContainerSas"} # type: ignore + list_container_sas.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/listContainerSas" + } @distributed_trace def get_encryption_key( @@ -1061,8 +1078,8 @@ def get_encryption_key( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageEncryptedAssetDecryptionData] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.StorageEncryptedAssetDecryptionData] = kwargs.pop("cls", None) request = build_get_encryption_key_request( resource_group_name=resource_group_name, @@ -1075,9 +1092,9 @@ def get_encryption_key( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1095,7 +1112,9 @@ def get_encryption_key( return deserialized - get_encryption_key.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/getEncryptionKey"} # type: ignore + get_encryption_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/getEncryptionKey" + } @distributed_trace def list_streaming_locators( @@ -1128,8 +1147,8 @@ def list_streaming_locators( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListStreamingLocatorsResponse] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.ListStreamingLocatorsResponse] = kwargs.pop("cls", None) request = build_list_streaming_locators_request( resource_group_name=resource_group_name, @@ -1142,9 +1161,9 @@ def list_streaming_locators( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1162,4 +1181,6 @@ def list_streaming_locators( return deserialized - list_streaming_locators.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/listStreamingLocators"} # type: ignore + list_streaming_locators.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/listStreamingLocators" + } 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 c0d85bd853b19..45469f4e22d98 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,6 +29,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +53,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +67,7 @@ def build_list_request( "accountName": _SERIALIZER.url("account_name", account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -85,7 +90,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -100,7 +105,7 @@ def build_get_request( "contentKeyPolicyName": _SERIALIZER.url("content_key_policy_name", content_key_policy_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -117,8 +122,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -133,7 +138,7 @@ def build_create_or_update_request( "contentKeyPolicyName": _SERIALIZER.url("content_key_policy_name", content_key_policy_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -152,7 +157,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -167,7 +172,7 @@ def build_delete_request( "contentKeyPolicyName": _SERIALIZER.url("content_key_policy_name", content_key_policy_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -184,8 +189,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -200,7 +205,7 @@ def build_update_request( "contentKeyPolicyName": _SERIALIZER.url("content_key_policy_name", content_key_policy_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -219,7 +224,7 @@ def build_get_policy_properties_with_secrets_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -234,7 +239,7 @@ def build_get_policy_properties_with_secrets_request( "contentKeyPolicyName": _SERIALIZER.url("content_key_policy_name", content_key_policy_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -300,8 +305,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ContentKeyPolicyCollection] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.ContentKeyPolicyCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -327,12 +332,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -340,13 +345,13 @@ 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) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.odata_next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -360,7 +365,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies" + } @distributed_trace def get( @@ -393,8 +400,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ContentKeyPolicy] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.ContentKeyPolicy] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -407,9 +414,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -427,7 +434,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}" + } @overload def create_or_update( @@ -536,9 +545,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ContentKeyPolicy] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ContentKeyPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -562,9 +571,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -582,11 +591,13 @@ def create_or_update( deserialized = self._deserialize("ContentKeyPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -619,8 +630,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -633,9 +644,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -649,7 +660,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}" + } @overload def update( @@ -758,9 +771,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ContentKeyPolicy] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ContentKeyPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -784,9 +797,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -804,7 +817,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}" + } @distributed_trace def get_policy_properties_with_secrets( @@ -837,8 +852,8 @@ def get_policy_properties_with_secrets( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ContentKeyPolicyProperties] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.ContentKeyPolicyProperties] = kwargs.pop("cls", None) request = build_get_policy_properties_with_secrets_request( resource_group_name=resource_group_name, @@ -851,9 +866,9 @@ def get_policy_properties_with_secrets( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -871,4 +886,6 @@ def get_policy_properties_with_secrets( return deserialized - get_policy_properties_with_secrets.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}/getPolicyPropertiesWithSecrets"} # type: ignore + get_policy_properties_with_secrets.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}/getPolicyPropertiesWithSecrets" + } 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 6311da79b2536..6fc59ecec02d3 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,6 +29,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +53,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +68,7 @@ def build_list_request( "transformName": _SERIALIZER.url("transform_name", transform_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -84,7 +89,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -100,7 +105,7 @@ def build_get_request( "jobName": _SERIALIZER.url("job_name", job_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -117,8 +122,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -134,7 +139,7 @@ def build_create_request( "jobName": _SERIALIZER.url("job_name", job_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -153,7 +158,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -169,7 +174,7 @@ def build_delete_request( "jobName": _SERIALIZER.url("job_name", job_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -186,8 +191,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -203,7 +208,7 @@ def build_update_request( "jobName": _SERIALIZER.url("job_name", job_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -222,7 +227,7 @@ def build_cancel_job_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -238,7 +243,7 @@ def build_cancel_job_request( "jobName": _SERIALIZER.url("job_name", job_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -302,8 +307,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobCollection] + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) + cls: ClsType[_models.JobCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -329,12 +334,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -342,13 +347,13 @@ 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) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.odata_next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -362,7 +367,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs" + } @distributed_trace def get( @@ -397,8 +404,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Job] + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) + cls: ClsType[_models.Job] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -412,9 +419,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -432,7 +439,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}" + } @overload def create( @@ -550,9 +559,9 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Job] + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Job] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -577,9 +586,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -597,7 +606,9 @@ def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -632,8 +643,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -647,9 +658,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -663,7 +674,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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 + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}" + } @overload def update( @@ -787,9 +800,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Job] + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Job] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -814,9 +827,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -834,7 +847,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}" + } @distributed_trace def cancel_job( # pylint: disable=inconsistent-return-statements @@ -869,8 +884,8 @@ def cancel_job( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_cancel_job_request( resource_group_name=resource_group_name, @@ -884,9 +899,9 @@ def cancel_job( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -900,4 +915,6 @@ def cancel_job( # pylint: disable=inconsistent-return-statements 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 + cancel_job.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}/cancelJob" + } 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 098b62a65b04e..d486e2e7590b5 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +46,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +60,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription "accountName": _SERIALIZER.url("account_name", account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -72,7 +77,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94,7 +99,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -117,8 +122,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -140,7 +145,7 @@ def build_create_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -161,8 +166,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -184,7 +189,7 @@ def build_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -203,7 +208,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -225,7 +230,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -242,7 +247,7 @@ def build_allocate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -264,7 +269,7 @@ def build_allocate_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -281,7 +286,7 @@ def build_start_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -303,7 +308,7 @@ def build_start_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -320,8 +325,8 @@ def build_stop_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -343,7 +348,7 @@ def build_stop_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -362,7 +367,7 @@ def build_reset_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -384,7 +389,7 @@ def build_reset_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -401,7 +406,7 @@ def build_async_operation_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -416,7 +421,7 @@ def build_async_operation_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -438,7 +443,7 @@ def build_operation_location_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -461,7 +466,7 @@ def build_operation_location_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -510,8 +515,8 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.LiveEventListResult] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.LiveEventListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -534,12 +539,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -547,13 +552,13 @@ 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) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.odata_next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -567,7 +572,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents" + } @distributed_trace def get( @@ -600,8 +607,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.LiveEvent] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.LiveEvent] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -614,9 +621,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -634,7 +641,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}" + } def _create_initial( self, @@ -656,9 +665,9 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LiveEvent] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LiveEvent] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -683,9 +692,9 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -703,11 +712,13 @@ def _create_initial( deserialized = self._deserialize("LiveEvent", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}" + } @overload def begin_create( @@ -842,14 +853,14 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LiveEvent] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LiveEvent] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, account_name=account_name, live_event_name=live_event_name, @@ -871,7 +882,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -883,9 +894,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}" + } def _update_initial( self, @@ -906,9 +919,9 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LiveEvent] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LiveEvent] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -932,9 +945,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -952,11 +965,13 @@ def _update_initial( deserialized = self._deserialize("LiveEvent", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}" + } @overload def begin_update( @@ -1073,14 +1088,14 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LiveEvent] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LiveEvent] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, account_name=account_name, live_event_name=live_event_name, @@ -1101,7 +1116,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1113,9 +1128,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, live_event_name: str, **kwargs: Any @@ -1131,8 +1148,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1145,9 +1162,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1161,7 +1178,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}" + } @distributed_trace def begin_delete( @@ -1193,11 +1212,11 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -1216,7 +1235,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1228,9 +1247,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}" + } def _allocate_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, live_event_name: str, **kwargs: Any @@ -1246,8 +1267,8 @@ def _allocate_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_allocate_request( resource_group_name=resource_group_name, @@ -1260,9 +1281,9 @@ def _allocate_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1276,7 +1297,9 @@ def _allocate_initial( # pylint: disable=inconsistent-return-statements 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 + _allocate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/allocate" + } @distributed_trace def begin_allocate( @@ -1308,11 +1331,11 @@ def begin_allocate( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._allocate_initial( # type: ignore resource_group_name=resource_group_name, @@ -1331,7 +1354,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1343,9 +1366,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_allocate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/allocate"} # type: ignore + begin_allocate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/allocate" + } def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, live_event_name: str, **kwargs: Any @@ -1361,8 +1386,8 @@ def _start_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_start_request( resource_group_name=resource_group_name, @@ -1375,9 +1400,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1391,7 +1416,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements 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 + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/start" + } @distributed_trace def begin_start( @@ -1424,11 +1451,11 @@ def begin_start( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, @@ -1447,7 +1474,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1459,9 +1486,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/start"} # type: ignore + begin_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/start" + } def _stop_initial( # pylint: disable=inconsistent-return-statements self, @@ -1482,9 +1511,9 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1508,9 +1537,9 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1524,7 +1553,9 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements 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 + _stop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/stop" + } @overload def begin_stop( @@ -1646,12 +1677,12 @@ def begin_stop( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._stop_initial( # type: ignore resource_group_name=resource_group_name, @@ -1672,7 +1703,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1684,9 +1715,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/stop"} # type: ignore + begin_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/stop" + } def _reset_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, live_event_name: str, **kwargs: Any @@ -1702,8 +1735,8 @@ def _reset_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_reset_request( resource_group_name=resource_group_name, @@ -1716,9 +1749,9 @@ def _reset_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1732,7 +1765,9 @@ def _reset_initial( # pylint: disable=inconsistent-return-statements 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 + _reset_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/reset" + } @distributed_trace def begin_reset( @@ -1766,11 +1801,11 @@ def begin_reset( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._reset_initial( # type: ignore resource_group_name=resource_group_name, @@ -1789,7 +1824,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1801,9 +1836,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_reset.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/reset"} # type: ignore + begin_reset.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/reset" + } @distributed_trace def async_operation( @@ -1836,8 +1873,8 @@ def async_operation( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AsyncOperationResult] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.AsyncOperationResult] = kwargs.pop("cls", None) request = build_async_operation_request( resource_group_name=resource_group_name, @@ -1850,9 +1887,9 @@ def async_operation( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1870,7 +1907,9 @@ def async_operation( return deserialized - async_operation.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEventOperations/{operationId}"} # type: ignore + async_operation.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEventOperations/{operationId}" + } @distributed_trace def operation_location( @@ -1905,8 +1944,8 @@ def operation_location( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.LiveEvent]] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[Optional[_models.LiveEvent]] = kwargs.pop("cls", None) request = build_operation_location_request( resource_group_name=resource_group_name, @@ -1920,9 +1959,9 @@ def operation_location( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1942,4 +1981,6 @@ def operation_location( return deserialized - operation_location.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/operationLocations/{operationId}"} # type: ignore + operation_location.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/operationLocations/{operationId}" + } 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 8ced5383701a0..876dc30c966b6 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +48,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +70,7 @@ def build_list_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -87,7 +92,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -117,7 +122,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -139,8 +144,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -170,7 +175,7 @@ def build_create_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -194,7 +199,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -224,7 +229,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -241,7 +246,7 @@ def build_async_operation_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -256,7 +261,7 @@ def build_async_operation_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -279,7 +284,7 @@ def build_operation_location_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -310,7 +315,7 @@ def build_operation_location_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -363,8 +368,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.LiveOutputListResult] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.LiveOutputListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -388,12 +393,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -401,13 +406,13 @@ 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) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.odata_next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -421,7 +426,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs" + } @distributed_trace def get( @@ -456,8 +463,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.LiveOutput] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.LiveOutput] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -471,9 +478,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -491,7 +498,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}" + } def _create_initial( self, @@ -513,9 +522,9 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LiveOutput] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LiveOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -540,9 +549,9 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -560,11 +569,13 @@ def _create_initial( deserialized = self._deserialize("LiveOutput", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}" + } @overload def begin_create( @@ -696,14 +707,14 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.LiveOutput] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LiveOutput] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, account_name=account_name, live_event_name=live_event_name, @@ -725,7 +736,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -737,9 +748,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, live_event_name: str, live_output_name: str, **kwargs: Any @@ -755,8 +768,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -770,9 +783,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -786,7 +799,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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 + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}" + } @distributed_trace def begin_delete( @@ -821,11 +836,11 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -845,7 +860,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -857,9 +872,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}" + } @distributed_trace def async_operation( @@ -892,8 +909,8 @@ def async_operation( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AsyncOperationResult] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.AsyncOperationResult] = kwargs.pop("cls", None) request = build_async_operation_request( resource_group_name=resource_group_name, @@ -906,9 +923,9 @@ def async_operation( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -926,7 +943,9 @@ def async_operation( return deserialized - async_operation.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveOutputOperations/{operationId}"} # type: ignore + async_operation.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveOutputOperations/{operationId}" + } @distributed_trace def operation_location( @@ -969,8 +988,8 @@ def operation_location( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.LiveOutput]] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[Optional[_models.LiveOutput]] = kwargs.pop("cls", None) request = build_operation_location_request( resource_group_name=resource_group_name, @@ -985,9 +1004,9 @@ def operation_location( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1007,4 +1026,6 @@ def operation_location( return deserialized - operation_location.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}/operationLocations/{operationId}"} # type: ignore + operation_location.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}/operationLocations/{operationId}" + } 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 3ec547dece332..3089de8720bce 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,8 +43,8 @@ def build_check_name_availability_request(location_name: str, subscription_id: s _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +57,7 @@ def build_check_name_availability_request(location_name: str, subscription_id: s "locationName": _SERIALIZER.url("location_name", location_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -162,9 +167,9 @@ def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EntityNameAvailabilityCheckOutput] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EntityNameAvailabilityCheckOutput] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -186,9 +191,9 @@ def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -206,4 +211,6 @@ def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Media/locations/{locationName}/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Media/locations/{locationName}/checkNameAvailability" + } diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_media_services_operation_results_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_media_services_operation_results_operations.py index c5f39319df140..ca2a298df647f 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_media_services_operation_results_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_media_services_operation_results_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,7 @@ def build_get_request(location_name: str, operation_id: str, subscription_id: st _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +57,7 @@ def build_get_request(location_name: str, operation_id: str, subscription_id: st "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -108,8 +113,8 @@ def get(self, location_name: str, operation_id: str, **kwargs: Any) -> Optional[ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.MediaService]] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[Optional[_models.MediaService]] = kwargs.pop("cls", None) request = build_get_request( location_name=location_name, @@ -121,9 +126,9 @@ def get(self, location_name: str, operation_id: str, **kwargs: Any) -> Optional[ params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -151,4 +156,6 @@ def get(self, location_name: str, operation_id: str, **kwargs: Any) -> Optional[ return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Media/locations/{locationName}/mediaServicesOperationResults/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Media/locations/{locationName}/mediaServicesOperationResults/{operationId}" + } diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_media_services_operation_statuses_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_media_services_operation_statuses_operations.py index a9aaaa629c7b7..61c84d2c786f0 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_media_services_operation_statuses_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_media_services_operation_statuses_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,7 @@ def build_get_request(location_name: str, operation_id: str, subscription_id: st _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +57,7 @@ def build_get_request(location_name: str, operation_id: str, subscription_id: st "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -108,8 +113,8 @@ def get(self, location_name: str, operation_id: str, **kwargs: Any) -> _models.M _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.MediaServiceOperationStatus] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.MediaServiceOperationStatus] = kwargs.pop("cls", None) request = build_get_request( location_name=location_name, @@ -121,9 +126,9 @@ def get(self, location_name: str, operation_id: str, **kwargs: Any) -> _models.M params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -141,4 +146,6 @@ def get(self, location_name: str, operation_id: str, **kwargs: Any) -> _models.M return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Media/locations/{locationName}/mediaServicesOperationStatuses/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Media/locations/{locationName}/mediaServicesOperationStatuses/{operationId}" + } 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 77c1cd09ff0db..18ee53938f395 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +46,7 @@ def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +59,7 @@ def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -69,7 +74,7 @@ def build_get_request(resource_group_name: str, account_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +88,7 @@ def build_get_request(resource_group_name: str, account_name: str, subscription_ "accountName": _SERIALIZER.url("account_name", account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -100,8 +105,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +120,7 @@ def build_create_or_update_request( "accountName": _SERIALIZER.url("account_name", account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -134,7 +139,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -148,7 +153,7 @@ def build_delete_request( "accountName": _SERIALIZER.url("account_name", account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -165,8 +170,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -180,7 +185,7 @@ def build_update_request( "accountName": _SERIALIZER.url("account_name", account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -199,8 +204,8 @@ def build_sync_storage_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -214,7 +219,7 @@ def build_sync_storage_keys_request( "accountName": _SERIALIZER.url("account_name", account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -233,8 +238,8 @@ def build_list_edge_policies_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -248,7 +253,7 @@ def build_list_edge_policies_request( "accountName": _SERIALIZER.url("account_name", account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -265,7 +270,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -274,7 +279,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -321,8 +326,8 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Med _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.MediaServiceCollection] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.MediaServiceCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -344,12 +349,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -357,13 +362,13 @@ 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) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.odata_next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -377,7 +382,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices" + } @distributed_trace def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.MediaService: @@ -406,8 +413,8 @@ def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.MediaService] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.MediaService] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -419,9 +426,9 @@ def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _mo params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -439,7 +446,9 @@ def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _mo return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}" + } def _create_or_update_initial( self, resource_group_name: str, account_name: str, parameters: Union[_models.MediaService, IO], **kwargs: Any @@ -455,9 +464,9 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MediaService] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MediaService] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -480,9 +489,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -513,11 +522,13 @@ def _create_or_update_initial( deserialized = self._deserialize("MediaService", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}" + } @overload def begin_create_or_update( @@ -629,14 +640,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MediaService] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MediaService] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, @@ -664,7 +675,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -676,9 +687,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -709,8 +722,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -722,9 +735,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -738,7 +751,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}" + } def _update_initial( self, @@ -758,9 +773,9 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MediaService] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MediaService] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -783,9 +798,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -810,7 +825,9 @@ def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}" + } @overload def begin_update( @@ -926,14 +943,14 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.MediaService] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MediaService] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, @@ -961,7 +978,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -973,9 +990,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}" + } @overload def sync_storage_keys( # pylint: disable=inconsistent-return-statements @@ -1078,9 +1097,9 @@ def sync_storage_keys( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1103,9 +1122,9 @@ def sync_storage_keys( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1119,7 +1138,9 @@ def sync_storage_keys( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - sync_storage_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/syncStorageKeys"} # type: ignore + sync_storage_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/syncStorageKeys" + } @overload def list_edge_policies( @@ -1219,9 +1240,9 @@ def list_edge_policies( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EdgePolicies] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EdgePolicies] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1244,9 +1265,9 @@ def list_edge_policies( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1264,7 +1285,9 @@ def list_edge_policies( return deserialized - list_edge_policies.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/listEdgePolicies"} # type: ignore + list_edge_policies.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/listEdgePolicies" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.MediaService"]: @@ -1280,8 +1303,8 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.MediaService" _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.MediaServiceCollection] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.MediaServiceCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1302,12 +1325,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1315,13 +1338,13 @@ 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) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.odata_next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1335,4 +1358,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Media/mediaservices"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Media/mediaservices"} diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_operation_results_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_operation_results_operations.py index 0af65b43055de..faa8a96708b9e 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_operation_results_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_operation_results_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +51,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +68,7 @@ def build_get_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -134,8 +139,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.AssetTrack]] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[Optional[_models.AssetTrack]] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -150,9 +155,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -180,4 +185,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}/operationResults/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}/operationResults/{operationId}" + } diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_operation_statuses_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_operation_statuses_operations.py index 7f149b3ebffd3..166bf78556445 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_operation_statuses_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_operation_statuses_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +51,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +68,7 @@ def build_get_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -134,8 +139,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AssetTrackOperationStatus] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.AssetTrackOperationStatus] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -150,9 +155,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -170,4 +175,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}/operationStatuses/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}/operationStatuses/{operationId}" + } 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 f6857b291a84e..1fc8f21dc8f50 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94,8 +99,8 @@ def list(self, **kwargs: Any) -> _models.OperationCollection: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationCollection] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.OperationCollection] = kwargs.pop("cls", None) request = build_list_request( api_version=api_version, @@ -104,9 +109,9 @@ def list(self, **kwargs: Any) -> _models.OperationCollection: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -124,4 +129,4 @@ def list(self, **kwargs: Any) -> _models.OperationCollection: return deserialized - list.metadata = {"url": "/providers/Microsoft.Media/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Media/operations"} diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_private_endpoint_connections_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_private_endpoint_connections_operations.py index 59cb59f22e358..c5ef11869790d 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_private_endpoint_connections_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_private_endpoint_connections_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +57,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription "accountName": _SERIALIZER.url("account_name", account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -69,7 +74,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -84,7 +89,7 @@ def build_get_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -101,8 +106,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -117,7 +122,7 @@ def build_create_or_update_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -136,7 +141,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -151,7 +156,7 @@ def build_delete_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -210,8 +215,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -223,9 +228,9 @@ def list( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -243,7 +248,9 @@ def list( return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections" + } @distributed_trace def get( @@ -276,8 +283,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -290,9 +297,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -310,7 +317,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections/{name}" + } @overload def create_or_update( @@ -419,9 +428,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -445,9 +454,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -465,7 +474,9 @@ def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections/{name}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections/{name}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -498,8 +509,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -512,9 +523,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -528,4 +539,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections/{name}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections/{name}" + } diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_private_link_resources_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_private_link_resources_operations.py index 65d510d70a354..3ece6dfe7c4fa 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_private_link_resources_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_private_link_resources_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +57,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription "accountName": _SERIALIZER.url("account_name", account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -69,7 +74,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -84,7 +89,7 @@ def build_get_request( "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -141,8 +146,8 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourceListResult] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) request = build_list_request( resource_group_name=resource_group_name, @@ -154,9 +159,9 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -174,7 +179,9 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateLinkResources"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateLinkResources" + } @distributed_trace def get(self, resource_group_name: str, account_name: str, name: str, **kwargs: Any) -> _models.PrivateLinkResource: @@ -205,8 +212,8 @@ def get(self, resource_group_name: str, account_name: str, name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResource] + api_version: Literal["2021-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) + cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -219,9 +226,9 @@ def get(self, resource_group_name: str, account_name: str, name: str, **kwargs: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -239,4 +246,6 @@ def get(self, resource_group_name: str, account_name: str, name: str, **kwargs: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateLinkResources/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateLinkResources/{name}" + } 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 10c828b9301bb..e7a42e39e8143 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +46,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +60,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription "accountName": _SERIALIZER.url("account_name", account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -72,7 +77,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94,7 +99,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -117,8 +122,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -140,7 +145,7 @@ def build_create_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -161,8 +166,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -184,7 +189,7 @@ def build_update_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -203,7 +208,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -225,7 +230,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -242,7 +247,7 @@ def build_skus_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -264,7 +269,7 @@ def build_skus_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -281,7 +286,7 @@ def build_start_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -303,7 +308,7 @@ def build_start_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -320,7 +325,7 @@ def build_stop_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -342,7 +347,7 @@ def build_stop_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -359,8 +364,8 @@ def build_scale_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -382,7 +387,7 @@ def build_scale_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -401,7 +406,7 @@ def build_async_operation_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -416,7 +421,7 @@ def build_async_operation_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -438,7 +443,7 @@ def build_operation_location_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -461,7 +466,7 @@ def build_operation_location_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str", min_length=1), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -510,8 +515,8 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.StreamingEndpointListResult] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.StreamingEndpointListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -534,12 +539,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -547,13 +552,13 @@ 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) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.odata_next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -567,7 +572,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints" + } @distributed_trace def get( @@ -601,8 +608,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.StreamingEndpoint] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.StreamingEndpoint] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -615,9 +622,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -635,7 +642,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}" + } def _create_initial( self, @@ -657,9 +666,9 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.StreamingEndpoint] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StreamingEndpoint] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -684,9 +693,9 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -704,11 +713,13 @@ def _create_initial( deserialized = self._deserialize("StreamingEndpoint", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}" + } @overload def begin_create( @@ -849,14 +860,14 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.StreamingEndpoint] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StreamingEndpoint] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, account_name=account_name, streaming_endpoint_name=streaming_endpoint_name, @@ -878,7 +889,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -890,9 +901,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}" + } def _update_initial( self, @@ -913,9 +926,9 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.StreamingEndpoint] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StreamingEndpoint] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -939,9 +952,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -959,11 +972,13 @@ def _update_initial( deserialized = self._deserialize("StreamingEndpoint", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}" + } @overload def begin_update( @@ -1092,14 +1107,14 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.StreamingEndpoint] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StreamingEndpoint] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, account_name=account_name, streaming_endpoint_name=streaming_endpoint_name, @@ -1120,7 +1135,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1132,9 +1147,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, streaming_endpoint_name: str, **kwargs: Any @@ -1150,8 +1167,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1164,9 +1181,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1180,7 +1197,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}" + } @distributed_trace def begin_delete( @@ -1213,11 +1232,11 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -1236,7 +1255,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1248,9 +1267,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}" + } @distributed_trace def skus( @@ -1284,8 +1305,8 @@ def skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.StreamingEndpointSkuInfoListResult] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.StreamingEndpointSkuInfoListResult] = kwargs.pop("cls", None) request = build_skus_request( resource_group_name=resource_group_name, @@ -1298,9 +1319,9 @@ def skus( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1318,7 +1339,9 @@ def skus( return deserialized - skus.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/skus"} # type: ignore + skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/skus" + } def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, streaming_endpoint_name: str, **kwargs: Any @@ -1334,8 +1357,8 @@ def _start_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_start_request( resource_group_name=resource_group_name, @@ -1348,9 +1371,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1364,7 +1387,9 @@ def _start_initial( # pylint: disable=inconsistent-return-statements 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 + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/start" + } @distributed_trace def begin_start( @@ -1397,11 +1422,11 @@ def begin_start( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, @@ -1420,7 +1445,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1432,9 +1457,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_start.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/start"} # type: ignore + begin_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/start" + } def _stop_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, streaming_endpoint_name: str, **kwargs: Any @@ -1450,8 +1477,8 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_request( resource_group_name=resource_group_name, @@ -1464,9 +1491,9 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1480,7 +1507,9 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements 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 + _stop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/stop" + } @distributed_trace def begin_stop( @@ -1513,11 +1542,11 @@ def begin_stop( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._stop_initial( # type: ignore resource_group_name=resource_group_name, @@ -1536,7 +1565,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1548,9 +1577,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_stop.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/stop"} # type: ignore + begin_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/stop" + } def _scale_initial( # pylint: disable=inconsistent-return-statements self, @@ -1571,9 +1602,9 @@ def _scale_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1597,9 +1628,9 @@ def _scale_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1613,7 +1644,9 @@ def _scale_initial( # pylint: disable=inconsistent-return-statements 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 + _scale_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/scale" + } @overload def begin_scale( @@ -1739,12 +1772,12 @@ def begin_scale( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._scale_initial( # type: ignore resource_group_name=resource_group_name, @@ -1765,7 +1798,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1777,9 +1810,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_scale.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/scale"} # type: ignore + begin_scale.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/scale" + } @distributed_trace def async_operation( @@ -1812,8 +1847,8 @@ def async_operation( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AsyncOperationResult] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.AsyncOperationResult] = kwargs.pop("cls", None) request = build_async_operation_request( resource_group_name=resource_group_name, @@ -1826,9 +1861,9 @@ def async_operation( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1846,7 +1881,9 @@ def async_operation( return deserialized - async_operation.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpointOperations/{operationId}"} # type: ignore + async_operation.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpointOperations/{operationId}" + } @distributed_trace def operation_location( @@ -1887,8 +1924,8 @@ def operation_location( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.StreamingEndpoint]] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[Optional[_models.StreamingEndpoint]] = kwargs.pop("cls", None) request = build_operation_location_request( resource_group_name=resource_group_name, @@ -1902,9 +1939,9 @@ def operation_location( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1924,4 +1961,6 @@ def operation_location( return deserialized - operation_location.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/operationLocations/{operationId}"} # type: ignore + operation_location.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/operationLocations/{operationId}" + } 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 f0abfd0258d64..d370e3483ffad 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,6 +29,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +53,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +67,7 @@ def build_list_request( "accountName": _SERIALIZER.url("account_name", account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -85,7 +90,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -100,7 +105,7 @@ def build_get_request( "streamingLocatorName": _SERIALIZER.url("streaming_locator_name", streaming_locator_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -117,8 +122,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -133,7 +138,7 @@ def build_create_request( "streamingLocatorName": _SERIALIZER.url("streaming_locator_name", streaming_locator_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -152,7 +157,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -167,7 +172,7 @@ def build_delete_request( "streamingLocatorName": _SERIALIZER.url("streaming_locator_name", streaming_locator_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -184,7 +189,7 @@ def build_list_content_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -199,7 +204,7 @@ def build_list_content_keys_request( "streamingLocatorName": _SERIALIZER.url("streaming_locator_name", streaming_locator_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -216,7 +221,7 @@ def build_list_paths_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -231,7 +236,7 @@ def build_list_paths_request( "streamingLocatorName": _SERIALIZER.url("streaming_locator_name", streaming_locator_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -297,8 +302,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.StreamingLocatorCollection] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.StreamingLocatorCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -324,12 +329,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -337,13 +342,13 @@ 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) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.odata_next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -357,7 +362,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators" + } @distributed_trace def get( @@ -390,8 +397,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.StreamingLocator] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.StreamingLocator] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -404,9 +411,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -424,7 +431,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}" + } @overload def create( @@ -533,9 +542,9 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.StreamingLocator] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StreamingLocator] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -559,9 +568,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -579,7 +588,9 @@ def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -612,8 +623,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -626,9 +637,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -642,7 +653,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}" + } @distributed_trace def list_content_keys( @@ -675,8 +688,8 @@ def list_content_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListContentKeysResponse] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.ListContentKeysResponse] = kwargs.pop("cls", None) request = build_list_content_keys_request( resource_group_name=resource_group_name, @@ -689,9 +702,9 @@ def list_content_keys( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -709,7 +722,9 @@ def list_content_keys( return deserialized - list_content_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}/listContentKeys"} # type: ignore + list_content_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}/listContentKeys" + } @distributed_trace def list_paths( @@ -742,8 +757,8 @@ def list_paths( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListPathsResponse] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.ListPathsResponse] = kwargs.pop("cls", None) request = build_list_paths_request( resource_group_name=resource_group_name, @@ -756,9 +771,9 @@ def list_paths( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -776,4 +791,6 @@ def list_paths( return deserialized - list_paths.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}/listPaths"} # type: ignore + list_paths.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}/listPaths" + } 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 85df5b05153db..df6483f4b7d4e 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,6 +29,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +53,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +67,7 @@ def build_list_request( "accountName": _SERIALIZER.url("account_name", account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -85,7 +90,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -100,7 +105,7 @@ def build_get_request( "streamingPolicyName": _SERIALIZER.url("streaming_policy_name", streaming_policy_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -117,8 +122,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -133,7 +138,7 @@ def build_create_request( "streamingPolicyName": _SERIALIZER.url("streaming_policy_name", streaming_policy_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -152,7 +157,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -167,7 +172,7 @@ def build_delete_request( "streamingPolicyName": _SERIALIZER.url("streaming_policy_name", streaming_policy_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -233,8 +238,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.StreamingPolicyCollection] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.StreamingPolicyCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -260,12 +265,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -273,13 +278,13 @@ 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) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.odata_next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -293,7 +298,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies" + } @distributed_trace def get( @@ -326,8 +333,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.StreamingPolicy] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.StreamingPolicy] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -340,9 +347,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -360,7 +367,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName}" + } @overload def create( @@ -469,9 +478,9 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.StreamingPolicy] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StreamingPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -495,9 +504,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -515,7 +524,9 @@ def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -548,8 +559,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -562,9 +573,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -578,4 +589,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName}" + } diff --git a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_tracks_operations.py b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_tracks_operations.py index a37207b6b94db..e2de59fcbb57f 100644 --- a/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_tracks_operations.py +++ b/sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_tracks_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +48,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +63,7 @@ def build_list_request( "assetName": _SERIALIZER.url("asset_name", asset_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -75,7 +80,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,7 +96,7 @@ def build_get_request( "trackName": _SERIALIZER.url("track_name", track_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -108,8 +113,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -125,7 +130,7 @@ def build_create_or_update_request( "trackName": _SERIALIZER.url("track_name", track_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -144,7 +149,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -160,7 +165,7 @@ def build_delete_request( "trackName": _SERIALIZER.url("track_name", track_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -177,8 +182,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -194,7 +199,7 @@ def build_update_request( "trackName": _SERIALIZER.url("track_name", track_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -213,7 +218,7 @@ def build_update_track_data_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -229,7 +234,7 @@ def build_update_track_data_request( "trackName": _SERIALIZER.url("track_name", track_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -282,8 +287,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AssetTrackCollection] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.AssetTrackCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -307,12 +312,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -320,13 +325,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AssetTrackCollection", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -340,7 +345,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks" + } @distributed_trace def get( @@ -375,8 +382,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AssetTrack] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[_models.AssetTrack] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -390,9 +397,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -410,7 +417,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}" + } def _create_or_update_initial( self, @@ -432,9 +441,9 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AssetTrack] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AssetTrack] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -459,9 +468,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -492,11 +501,13 @@ def _create_or_update_initial( deserialized = self._deserialize("AssetTrack", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}" + } @overload def begin_create_or_update( @@ -627,14 +638,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AssetTrack] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AssetTrack] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, account_name=account_name, asset_name=asset_name, @@ -664,7 +675,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -676,9 +687,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, asset_name: str, track_name: str, **kwargs: Any @@ -694,8 +707,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -709,9 +722,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -733,7 +746,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}" + } @distributed_trace def begin_delete( @@ -767,11 +782,11 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -791,7 +806,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -803,9 +818,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}" + } def _update_initial( self, @@ -827,9 +844,9 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AssetTrack] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AssetTrack] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -854,9 +871,9 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -881,7 +898,9 @@ def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}" + } @overload def begin_update( @@ -1012,14 +1031,14 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AssetTrack] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AssetTrack] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, account_name=account_name, asset_name=asset_name, @@ -1049,7 +1068,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1061,9 +1080,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}" + } def _update_track_data_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, account_name: str, asset_name: str, track_name: str, **kwargs: Any @@ -1079,8 +1100,8 @@ def _update_track_data_initial( # pylint: disable=inconsistent-return-statement _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_track_data_request( resource_group_name=resource_group_name, @@ -1094,9 +1115,9 @@ def _update_track_data_initial( # pylint: disable=inconsistent-return-statement params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1117,7 +1138,9 @@ def _update_track_data_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, response_headers) - _update_track_data_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}/updateTrackData"} # type: ignore + _update_track_data_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}/updateTrackData" + } @distributed_trace def begin_update_track_data( @@ -1155,11 +1178,11 @@ def begin_update_track_data( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-08-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._update_track_data_initial( # type: ignore resource_group_name=resource_group_name, @@ -1179,7 +1202,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1191,6 +1214,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update_track_data.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}/updateTrackData"} # type: ignore + begin_update_track_data.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}/updateTrackData" + } 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 61ec7f1a04203..57d764d42b3e0 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,6 +29,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +52,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +66,7 @@ def build_list_request( "accountName": _SERIALIZER.url("account_name", account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -82,7 +87,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +102,7 @@ def build_get_request( "transformName": _SERIALIZER.url("transform_name", transform_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,8 +119,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -130,7 +135,7 @@ def build_create_or_update_request( "transformName": _SERIALIZER.url("transform_name", transform_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -149,7 +154,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,7 +169,7 @@ def build_delete_request( "transformName": _SERIALIZER.url("transform_name", transform_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -181,8 +186,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -197,7 +202,7 @@ def build_update_request( "transformName": _SERIALIZER.url("transform_name", transform_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -260,8 +265,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.TransformCollection] + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) + cls: ClsType[_models.TransformCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -286,12 +291,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -299,13 +304,13 @@ 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) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.odata_next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -319,7 +324,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms" + } @distributed_trace def get(self, resource_group_name: str, account_name: str, transform_name: str, **kwargs: Any) -> _models.Transform: @@ -350,8 +357,8 @@ def get(self, resource_group_name: str, account_name: str, transform_name: str, _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.Transform] + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) + cls: ClsType[_models.Transform] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -364,9 +371,9 @@ def get(self, resource_group_name: str, account_name: str, transform_name: str, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -384,7 +391,9 @@ def get(self, resource_group_name: str, account_name: str, transform_name: str, return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}" + } @overload def create_or_update( @@ -493,9 +502,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Transform] + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Transform] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -519,9 +528,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -539,11 +548,13 @@ def create_or_update( deserialized = self._deserialize("Transform", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -576,8 +587,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -590,9 +601,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -606,7 +617,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}" + } @overload def update( @@ -715,9 +728,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Transform] + api_version: Literal["2022-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Transform] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -741,9 +754,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -761,4 +774,6 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}" + } diff --git a/sdk/media/azure-mgmt-media/generated_samples/account_filterscreate.py b/sdk/media/azure-mgmt-media/generated_samples/account_filterscreate.py new file mode 100644 index 0000000000000..4963743b973ff --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/account_filterscreate.py @@ -0,0 +1,70 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python account_filterscreate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.account_filters.create_or_update( + resource_group_name="contoso", + account_name="contosomedia", + filter_name="newAccountFilter", + parameters={ + "properties": { + "firstQuality": {"bitrate": 128000}, + "presentationTimeRange": { + "endTimestamp": 170000000, + "forceEndTimestamp": False, + "liveBackoffDuration": 0, + "presentationWindowDuration": 9223372036854775000, + "startTimestamp": 0, + "timescale": 10000000, + }, + "tracks": [ + { + "trackSelections": [ + {"operation": "Equal", "property": "Type", "value": "Audio"}, + {"operation": "NotEqual", "property": "Language", "value": "en"}, + {"operation": "NotEqual", "property": "FourCC", "value": "EC-3"}, + ] + }, + { + "trackSelections": [ + {"operation": "Equal", "property": "Type", "value": "Video"}, + {"operation": "Equal", "property": "Bitrate", "value": "3000000-5000000"}, + ] + }, + ], + } + }, + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/accountFilters-create.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/account_filtersdelete.py b/sdk/media/azure-mgmt-media/generated_samples/account_filtersdelete.py new file mode 100644 index 0000000000000..b11f2f939ea9f --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/account_filtersdelete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python account_filtersdelete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.account_filters.delete( + resource_group_name="contoso", + account_name="contosomedia", + filter_name="accountFilterWithTimeWindowAndTrack", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/accountFilters-delete.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/account_filtersgetbyname.py b/sdk/media/azure-mgmt-media/generated_samples/account_filtersgetbyname.py new file mode 100644 index 0000000000000..19c368572bf70 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/account_filtersgetbyname.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python account_filtersgetbyname.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.account_filters.get( + resource_group_name="contoso", + account_name="contosomedia", + filter_name="accountFilterWithTrack", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/accountFilters-get-by-name.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/account_filterslistall.py b/sdk/media/azure-mgmt-media/generated_samples/account_filterslistall.py new file mode 100644 index 0000000000000..82a5b45f596e7 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/account_filterslistall.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python account_filterslistall.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.account_filters.list( + resource_group_name="contoso", + account_name="contosomedia", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/accountFilters-list-all.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/account_filtersupdate.py b/sdk/media/azure-mgmt-media/generated_samples/account_filtersupdate.py new file mode 100644 index 0000000000000..d247e28c11093 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/account_filtersupdate.py @@ -0,0 +1,55 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python account_filtersupdate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.account_filters.update( + resource_group_name="contoso", + account_name="contosomedia", + filter_name="accountFilterWithTimeWindowAndTrack", + parameters={ + "properties": { + "firstQuality": {"bitrate": 128000}, + "presentationTimeRange": { + "endTimestamp": 170000000, + "forceEndTimestamp": False, + "liveBackoffDuration": 0, + "presentationWindowDuration": 9223372036854775000, + "startTimestamp": 10, + "timescale": 10000000, + }, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/accountFilters-update.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/accountschecknameavailability.py b/sdk/media/azure-mgmt-media/generated_samples/accountschecknameavailability.py new file mode 100644 index 0000000000000..89b035f448c02 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/accountschecknameavailability.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python accountschecknameavailability.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.locations.check_name_availability( + location_name="japanwest", + parameters={"name": "contosotv", "type": "videoAnalyzers"}, + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Accounts/stable/2021-11-01/examples/accounts-check-name-availability.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/accountsdelete.py b/sdk/media/azure-mgmt-media/generated_samples/accountsdelete.py new file mode 100644 index 0000000000000..d6a05913d6766 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/accountsdelete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python accountsdelete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.mediaservices.delete( + resource_group_name="contoso", + account_name="contososports", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Accounts/stable/2021-11-01/examples/accounts-delete.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/accountsgetbyname.py b/sdk/media/azure-mgmt-media/generated_samples/accountsgetbyname.py new file mode 100644 index 0000000000000..c45f3449ff601 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/accountsgetbyname.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python accountsgetbyname.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.mediaservices.get( + resource_group_name="contoso", + account_name="contosotv", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Accounts/stable/2021-11-01/examples/accounts-get-by-name.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/accountslistallaccounts.py b/sdk/media/azure-mgmt-media/generated_samples/accountslistallaccounts.py new file mode 100644 index 0000000000000..5448255fa964e --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/accountslistallaccounts.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python accountslistallaccounts.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.mediaservices.list( + resource_group_name="contoso", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Accounts/stable/2021-11-01/examples/accounts-list-all-accounts.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/accountslistmediaedgepolicies.py b/sdk/media/azure-mgmt-media/generated_samples/accountslistmediaedgepolicies.py new file mode 100644 index 0000000000000..c203c2c87f189 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/accountslistmediaedgepolicies.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python accountslistmediaedgepolicies.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.mediaservices.list_edge_policies( + resource_group_name="contoso", + account_name="contososports", + parameters={"deviceId": "contosiothubhost_contosoiotdevice"}, + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Accounts/stable/2021-11-01/examples/accounts-list-media-edge-policies.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/accountssubscriptionlistallaccounts.py b/sdk/media/azure-mgmt-media/generated_samples/accountssubscriptionlistallaccounts.py new file mode 100644 index 0000000000000..47bfb67c4341e --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/accountssubscriptionlistallaccounts.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python accountssubscriptionlistallaccounts.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.mediaservices.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Accounts/stable/2021-11-01/examples/accounts-subscription-list-all-accounts.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/accountssyncstoragekeys.py b/sdk/media/azure-mgmt-media/generated_samples/accountssyncstoragekeys.py new file mode 100644 index 0000000000000..66b43e0ca898e --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/accountssyncstoragekeys.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python accountssyncstoragekeys.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.mediaservices.sync_storage_keys( + resource_group_name="contoso", + account_name="contososports", + parameters={"id": "contososportsstore"}, + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Accounts/stable/2021-11-01/examples/accounts-sync-storage-keys.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/asset_filterscreate.py b/sdk/media/azure-mgmt-media/generated_samples/asset_filterscreate.py new file mode 100644 index 0000000000000..2880a3e373da7 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/asset_filterscreate.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python asset_filterscreate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.asset_filters.create_or_update( + resource_group_name="contoso", + account_name="contosomedia", + asset_name="ClimbingMountRainer", + filter_name="newAssetFilter", + parameters={ + "properties": { + "firstQuality": {"bitrate": 128000}, + "presentationTimeRange": { + "endTimestamp": 170000000, + "forceEndTimestamp": False, + "liveBackoffDuration": 0, + "presentationWindowDuration": 9223372036854775000, + "startTimestamp": 0, + "timescale": 10000000, + }, + "tracks": [ + { + "trackSelections": [ + {"operation": "Equal", "property": "Type", "value": "Audio"}, + {"operation": "NotEqual", "property": "Language", "value": "en"}, + {"operation": "NotEqual", "property": "FourCC", "value": "EC-3"}, + ] + }, + { + "trackSelections": [ + {"operation": "Equal", "property": "Type", "value": "Video"}, + {"operation": "Equal", "property": "Bitrate", "value": "3000000-5000000"}, + ] + }, + ], + } + }, + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/assetFilters-create.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/asset_filtersdelete.py b/sdk/media/azure-mgmt-media/generated_samples/asset_filtersdelete.py new file mode 100644 index 0000000000000..5d1a710b5f80c --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/asset_filtersdelete.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 azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python asset_filtersdelete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.asset_filters.delete( + resource_group_name="contoso", + account_name="contosomedia", + asset_name="ClimbingMountRainer", + filter_name="assetFilterWithTimeWindowAndTrack", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/assetFilters-delete.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/asset_filtersgetbyname.py b/sdk/media/azure-mgmt-media/generated_samples/asset_filtersgetbyname.py new file mode 100644 index 0000000000000..18c6cf20573ee --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/asset_filtersgetbyname.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 azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python asset_filtersgetbyname.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.asset_filters.get( + resource_group_name="contoso", + account_name="contosomedia", + asset_name="ClimbingMountRainer", + filter_name="assetFilterWithTimeWindowAndTrack", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/assetFilters-get-by-name.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/asset_filterslistall.py b/sdk/media/azure-mgmt-media/generated_samples/asset_filterslistall.py new file mode 100644 index 0000000000000..97af3669f57da --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/asset_filterslistall.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 azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python asset_filterslistall.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.asset_filters.list( + resource_group_name="contoso", + account_name="contosomedia", + asset_name="ClimbingMountRainer", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/assetFilters-list-all.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/asset_filtersupdate.py b/sdk/media/azure-mgmt-media/generated_samples/asset_filtersupdate.py new file mode 100644 index 0000000000000..e1756aa36e9cb --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/asset_filtersupdate.py @@ -0,0 +1,56 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python asset_filtersupdate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.asset_filters.update( + resource_group_name="contoso", + account_name="contosomedia", + asset_name="ClimbingMountRainer", + filter_name="assetFilterWithTimeWindowAndTrack", + parameters={ + "properties": { + "firstQuality": {"bitrate": 128000}, + "presentationTimeRange": { + "endTimestamp": 170000000, + "forceEndTimestamp": False, + "liveBackoffDuration": 0, + "presentationWindowDuration": 9223372036854775000, + "startTimestamp": 10, + "timescale": 10000000, + }, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/assetFilters-update.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/assetscreate.py b/sdk/media/azure-mgmt-media/generated_samples/assetscreate.py new file mode 100644 index 0000000000000..fe4a7cc79b6ce --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/assetscreate.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python assetscreate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.assets.create_or_update( + resource_group_name="contoso", + account_name="contosomedia", + asset_name="ClimbingMountLogan", + parameters={ + "properties": { + "description": "A documentary showing the ascent of Mount Logan", + "storageAccountName": "storage0", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/assets-create.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/assetsdelete.py b/sdk/media/azure-mgmt-media/generated_samples/assetsdelete.py new file mode 100644 index 0000000000000..c94596e81d1cd --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/assetsdelete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python assetsdelete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.assets.delete( + resource_group_name="contoso", + account_name="contosomedia", + asset_name="ClimbingMountAdams", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/assets-delete.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/assetsgetbyname.py b/sdk/media/azure-mgmt-media/generated_samples/assetsgetbyname.py new file mode 100644 index 0000000000000..172bdf391c68c --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/assetsgetbyname.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python assetsgetbyname.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.assets.get( + resource_group_name="contoso", + account_name="contosomedia", + asset_name="ClimbingMountAdams", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/assets-get-by-name.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/assetsgetencryptionkeys.py b/sdk/media/azure-mgmt-media/generated_samples/assetsgetencryptionkeys.py new file mode 100644 index 0000000000000..72302c9445d25 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/assetsgetencryptionkeys.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python assetsgetencryptionkeys.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.assets.get_encryption_key( + resource_group_name="contoso", + account_name="contosomedia", + asset_name="ClimbingMountSaintHelens", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/assets-get-encryption-keys.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/assetslistall.py b/sdk/media/azure-mgmt-media/generated_samples/assetslistall.py new file mode 100644 index 0000000000000..6d5eb72cc8900 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/assetslistall.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python assetslistall.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.assets.list( + resource_group_name="contoso", + account_name="contosomedia", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/assets-list-all.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/assetslistbydate.py b/sdk/media/azure-mgmt-media/generated_samples/assetslistbydate.py new file mode 100644 index 0000000000000..a3cb40645d270 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/assetslistbydate.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python assetslistbydate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.assets.list( + resource_group_name="contoso", + account_name="contosomedia", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/assets-list-by-date.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/assetslistindaterange.py b/sdk/media/azure-mgmt-media/generated_samples/assetslistindaterange.py new file mode 100644 index 0000000000000..8e3f38c4ca780 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/assetslistindaterange.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python assetslistindaterange.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.assets.list( + resource_group_name="contoso", + account_name="contosomedia", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/assets-list-in-date-range.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/assetslistsasurls.py b/sdk/media/azure-mgmt-media/generated_samples/assetslistsasurls.py new file mode 100644 index 0000000000000..65e4f0f838610 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/assetslistsasurls.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 azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python assetslistsasurls.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.assets.list_container_sas( + resource_group_name="contoso", + account_name="contosomedia", + asset_name="ClimbingMountBaker", + parameters={"expiryTime": "2018-01-01T10:00:00.007Z", "permissions": "ReadWrite"}, + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/assets-list-sas-urls.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/assetsliststreaminglocators.py b/sdk/media/azure-mgmt-media/generated_samples/assetsliststreaminglocators.py new file mode 100644 index 0000000000000..0f4a3a65dc01e --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/assetsliststreaminglocators.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python assetsliststreaminglocators.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.assets.list_streaming_locators( + resource_group_name="contoso", + account_name="contosomedia", + asset_name="ClimbingMountSaintHelens", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/assets-list-streaming-locators.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/assetsupdate.py b/sdk/media/azure-mgmt-media/generated_samples/assetsupdate.py new file mode 100644 index 0000000000000..ef9e334dfae30 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/assetsupdate.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 azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python assetsupdate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.assets.update( + resource_group_name="contoso", + account_name="contosomedia", + asset_name="ClimbingMountBaker", + parameters={"properties": {"description": "A documentary showing the ascent of Mount Baker in HD"}}, + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/assets-update.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/assettrackscreate.py b/sdk/media/azure-mgmt-media/generated_samples/assettrackscreate.py new file mode 100644 index 0000000000000..56c367b2a4a08 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/assettrackscreate.py @@ -0,0 +1,53 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python assettrackscreate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.tracks.begin_create_or_update( + resource_group_name="contoso", + account_name="contosomedia", + asset_name="ClimbingMountRainer", + track_name="text3", + parameters={ + "properties": { + "track": { + "@odata.type": "#Microsoft.Media.TextTrack", + "displayName": "A new track", + "fileName": "text3.ttml", + "playerVisibility": "Visible", + } + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/asset-tracks-create.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/assettracksdelete.py b/sdk/media/azure-mgmt-media/generated_samples/assettracksdelete.py new file mode 100644 index 0000000000000..0ed05872431a0 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/assettracksdelete.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 azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python assettracksdelete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.tracks.begin_delete( + resource_group_name="contoso", + account_name="contosomedia", + asset_name="ClimbingMountRainer", + track_name="text2", + ).result() + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/asset-tracks-delete.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/assettracksgetbyname.py b/sdk/media/azure-mgmt-media/generated_samples/assettracksgetbyname.py new file mode 100644 index 0000000000000..bef62b5cfd5d2 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/assettracksgetbyname.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 azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python assettracksgetbyname.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.tracks.get( + resource_group_name="contoso", + account_name="contosomedia", + asset_name="ClimbingMountRainer", + track_name="text1", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/asset-tracks-get-by-name.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/assettrackslistall.py b/sdk/media/azure-mgmt-media/generated_samples/assettrackslistall.py new file mode 100644 index 0000000000000..296f6871b9410 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/assettrackslistall.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 azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python assettrackslistall.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.tracks.list( + resource_group_name="contoso", + account_name="contosomedia", + asset_name="ClimbingMountRainer", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/asset-tracks-list-all.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/assettracksoperationresultbyid.py b/sdk/media/azure-mgmt-media/generated_samples/assettracksoperationresultbyid.py new file mode 100644 index 0000000000000..cd11ad9f90b9b --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/assettracksoperationresultbyid.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python assettracksoperationresultbyid.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.operation_results.get( + resource_group_name="contoso", + account_name="contosomedia", + asset_name="ClimbingMountRainer", + track_name="text1", + operation_id="e78f8d40-7aaa-4f2f-8ae6-73987e7c5a08", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/asset-tracks-operation-result-by-id.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/assettracksoperationstatusbyidnonterminalstate.py b/sdk/media/azure-mgmt-media/generated_samples/assettracksoperationstatusbyidnonterminalstate.py new file mode 100644 index 0000000000000..f8e60f21a98ea --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/assettracksoperationstatusbyidnonterminalstate.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python assettracksoperationstatusbyidnonterminalstate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.operation_statuses.get( + resource_group_name="contoso", + account_name="contosomedia", + asset_name="ClimbingMountRainer", + track_name="text1", + operation_id="5827d9a1-1fb4-4e54-ac40-8eeed9b862c8", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/asset-tracks-operation-status-by-id-non-terminal-state.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/assettracksoperationstatusbyidterminalstate.py b/sdk/media/azure-mgmt-media/generated_samples/assettracksoperationstatusbyidterminalstate.py new file mode 100644 index 0000000000000..c310eb474d0cc --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/assettracksoperationstatusbyidterminalstate.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python assettracksoperationstatusbyidterminalstate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.operation_statuses.get( + resource_group_name="contoso", + account_name="contosomedia", + asset_name="ClimbingMountRainer", + track_name="text1", + operation_id="e78f8d40-7aaa-4f2f-8ae6-73987e7c5a08", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/asset-tracks-operation-status-by-id-terminal-state.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/assettracksoperationstatusbyidterminalstatefailed.py b/sdk/media/azure-mgmt-media/generated_samples/assettracksoperationstatusbyidterminalstatefailed.py new file mode 100644 index 0000000000000..ab5848d899144 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/assettracksoperationstatusbyidterminalstatefailed.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python assettracksoperationstatusbyidterminalstatefailed.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.operation_statuses.get( + resource_group_name="contoso", + account_name="contosomedia", + asset_name="ClimbingMountRainer", + track_name="text1", + operation_id="86835197-3b47-402e-b313-70b82eaba296", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/asset-tracks-operation-status-by-id-terminal-state-failed.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/assettracksupdate.py b/sdk/media/azure-mgmt-media/generated_samples/assettracksupdate.py new file mode 100644 index 0000000000000..723a1084fb9f8 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/assettracksupdate.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python assettracksupdate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.tracks.begin_update( + resource_group_name="contoso", + account_name="contosomedia", + asset_name="ClimbingMountRainer", + track_name="text1", + parameters={ + "properties": {"track": {"@odata.type": "#Microsoft.Media.TextTrack", "displayName": "A new name"}} + }, + ).result() + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/asset-tracks-update.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/assettracksupdatedata.py b/sdk/media/azure-mgmt-media/generated_samples/assettracksupdatedata.py new file mode 100644 index 0000000000000..4c59d56c43dfb --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/assettracksupdatedata.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 azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python assettracksupdatedata.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.tracks.begin_update_track_data( + resource_group_name="contoso", + account_name="contosomedia", + asset_name="ClimbingMountRainer", + track_name="text2", + ).result() + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/asset-tracks-update-data.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/asyncaccountscreate.py b/sdk/media/azure-mgmt-media/generated_samples/asyncaccountscreate.py new file mode 100644 index 0000000000000..6fec55e37882a --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/asyncaccountscreate.py @@ -0,0 +1,74 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python asyncaccountscreate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.mediaservices.begin_create_or_update( + resource_group_name="contoso", + account_name="contososports", + parameters={ + "identity": { + "type": "UserAssigned", + "userAssignedIdentities": { + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {}, + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id2": {}, + }, + }, + "location": "South Central US", + "properties": { + "encryption": { + "identity": { + "useSystemAssignedIdentity": False, + "userAssignedIdentity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1", + }, + "type": "CustomerKey", + }, + "keyDelivery": {"accessControl": {"defaultAction": "Allow"}}, + "publicNetworkAccess": "Enabled", + "storageAccounts": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso/providers/Microsoft.Storage/storageAccounts/contososportsstore", + "identity": { + "useSystemAssignedIdentity": False, + "userAssignedIdentity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1", + }, + "type": "Primary", + } + ], + "storageAuthentication": "ManagedIdentity", + }, + "tags": {"key1": "value1", "key2": "value2"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Accounts/stable/2021-11-01/examples/async-accounts-create.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/asyncaccountsupdate.py b/sdk/media/azure-mgmt-media/generated_samples/asyncaccountsupdate.py new file mode 100644 index 0000000000000..872640e9a1599 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/asyncaccountsupdate.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python asyncaccountsupdate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.mediaservices.begin_update( + resource_group_name="contoso", + account_name="contososports", + parameters={"tags": {"key1": "value3"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Accounts/stable/2021-11-01/examples/async-accounts-update.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/asyncoperationresult.py b/sdk/media/azure-mgmt-media/generated_samples/asyncoperationresult.py new file mode 100644 index 0000000000000..1f52d49c2cd37 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/asyncoperationresult.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python asyncoperationresult.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="0a6ec948-5a62-437d-b9df-934dc7c1b722", + ) + + response = client.live_events.async_operation( + resource_group_name="mediaresources", + account_name="slitestmedia10", + operation_id="62e4d893-d233-4005-988e-a428d9f77076", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Streaming/stable/2022-08-01/examples/async-operation-result.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/contentkeypoliciescreatemultipleoptions.py b/sdk/media/azure-mgmt-media/generated_samples/contentkeypoliciescreatemultipleoptions.py new file mode 100644 index 0000000000000..b88e49f15ee14 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/contentkeypoliciescreatemultipleoptions.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python contentkeypoliciescreatemultipleoptions.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.content_key_policies.create_or_update( + resource_group_name="contoso", + account_name="contosomedia", + content_key_policy_name="PolicyCreatedWithMultipleOptions", + parameters={ + "properties": { + "description": "ArmPolicyDescription", + "options": [ + { + "configuration": {"@odata.type": "#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration"}, + "name": "ClearKeyOption", + "restriction": { + "@odata.type": "#Microsoft.Media.ContentKeyPolicyTokenRestriction", + "audience": "urn:audience", + "issuer": "urn:issuer", + "primaryVerificationKey": { + "@odata.type": "#Microsoft.Media.ContentKeyPolicySymmetricTokenKey", + "keyValue": "AAAAAAAAAAAAAAAAAAAAAA==", + }, + "restrictionTokenType": "Swt", + }, + }, + { + "configuration": { + "@odata.type": "#Microsoft.Media.ContentKeyPolicyWidevineConfiguration", + "widevineTemplate": '{"allowed_track_types":"SD_HD","content_key_specs":[{"track_type":"SD","security_level":1,"required_output_protection":{"hdcp":"HDCP_V2"}}],"policy_overrides":{"can_play":true,"can_persist":true,"can_renew":false}}', + }, + "name": "widevineoption", + "restriction": {"@odata.type": "#Microsoft.Media.ContentKeyPolicyOpenRestriction"}, + }, + ], + } + }, + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-create-multiple-options.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/contentkeypoliciescreatenodrmtoken.py b/sdk/media/azure-mgmt-media/generated_samples/contentkeypoliciescreatenodrmtoken.py new file mode 100644 index 0000000000000..1a269a333a59d --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/contentkeypoliciescreatenodrmtoken.py @@ -0,0 +1,63 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python contentkeypoliciescreatenodrmtoken.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.content_key_policies.create_or_update( + resource_group_name="contoso", + account_name="contosomedia", + content_key_policy_name="PolicyWithClearKeyOptionAndSwtTokenRestriction", + parameters={ + "properties": { + "description": "ArmPolicyDescription", + "options": [ + { + "configuration": {"@odata.type": "#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration"}, + "name": "ClearKeyOption", + "restriction": { + "@odata.type": "#Microsoft.Media.ContentKeyPolicyTokenRestriction", + "audience": "urn:audience", + "issuer": "urn:issuer", + "primaryVerificationKey": { + "@odata.type": "#Microsoft.Media.ContentKeyPolicySymmetricTokenKey", + "keyValue": "AAAAAAAAAAAAAAAAAAAAAA==", + }, + "restrictionTokenType": "Swt", + }, + } + ], + } + }, + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-create-nodrm-token.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/contentkeypoliciescreateplayreadyopen.py b/sdk/media/azure-mgmt-media/generated_samples/contentkeypoliciescreateplayreadyopen.py new file mode 100644 index 0000000000000..630ecf6b7cc83 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/contentkeypoliciescreateplayreadyopen.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python contentkeypoliciescreateplayreadyopen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.content_key_policies.create_or_update( + resource_group_name="contoso", + account_name="contosomedia", + content_key_policy_name="PolicyWithPlayReadyOptionAndOpenRestriction", + parameters={ + "properties": { + "description": "ArmPolicyDescription", + "options": [ + { + "configuration": { + "@odata.type": "#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration", + "licenses": [ + { + "allowTestDevices": True, + "beginDate": "2017-10-16T18:22:53.46Z", + "contentKeyLocation": { + "@odata.type": "#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader" + }, + "contentType": "UltraVioletDownload", + "licenseType": "Persistent", + "playRight": { + "allowPassingVideoContentToUnknownOutput": "NotAllowed", + "digitalVideoOnlyContentRestriction": False, + "imageConstraintForAnalogComponentVideoRestriction": True, + "imageConstraintForAnalogComputerMonitorRestriction": False, + "scmsRestriction": 2, + }, + "securityLevel": "SL150", + } + ], + }, + "name": "ArmPolicyOptionName", + "restriction": {"@odata.type": "#Microsoft.Media.ContentKeyPolicyOpenRestriction"}, + } + ], + } + }, + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-create-playready-open.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/contentkeypoliciescreatewidevinetoken.py b/sdk/media/azure-mgmt-media/generated_samples/contentkeypoliciescreatewidevinetoken.py new file mode 100644 index 0000000000000..a2ea33886afe0 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/contentkeypoliciescreatewidevinetoken.py @@ -0,0 +1,73 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python contentkeypoliciescreatewidevinetoken.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.content_key_policies.create_or_update( + resource_group_name="contoso", + account_name="contosomedia", + content_key_policy_name="PolicyWithWidevineOptionAndJwtTokenRestriction", + parameters={ + "properties": { + "description": "ArmPolicyDescription", + "options": [ + { + "configuration": { + "@odata.type": "#Microsoft.Media.ContentKeyPolicyWidevineConfiguration", + "widevineTemplate": '{"allowed_track_types":"SD_HD","content_key_specs":[{"track_type":"SD","security_level":1,"required_output_protection":{"hdcp":"HDCP_V2"}}],"policy_overrides":{"can_play":true,"can_persist":true,"can_renew":false}}', + }, + "name": "widevineoption", + "restriction": { + "@odata.type": "#Microsoft.Media.ContentKeyPolicyTokenRestriction", + "alternateVerificationKeys": [ + { + "@odata.type": "#Microsoft.Media.ContentKeyPolicySymmetricTokenKey", + "keyValue": "AAAAAAAAAAAAAAAAAAAAAA==", + } + ], + "audience": "urn:audience", + "issuer": "urn:issuer", + "primaryVerificationKey": { + "@odata.type": "#Microsoft.Media.ContentKeyPolicyRsaTokenKey", + "exponent": "AQAB", + "modulus": "AQAD", + }, + "restrictionTokenType": "Jwt", + }, + } + ], + } + }, + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-create-widevine-token.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/contentkeypoliciesdelete.py b/sdk/media/azure-mgmt-media/generated_samples/contentkeypoliciesdelete.py new file mode 100644 index 0000000000000..8eb17fe3332b9 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/contentkeypoliciesdelete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python contentkeypoliciesdelete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.content_key_policies.delete( + resource_group_name="contoso", + account_name="contosomedia", + content_key_policy_name="PolicyWithPlayReadyOptionAndOpenRestriction", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-delete.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/contentkeypoliciesgetbyname.py b/sdk/media/azure-mgmt-media/generated_samples/contentkeypoliciesgetbyname.py new file mode 100644 index 0000000000000..095a03b8ebcc1 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/contentkeypoliciesgetbyname.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python contentkeypoliciesgetbyname.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.content_key_policies.get( + resource_group_name="contoso", + account_name="contosomedia", + content_key_policy_name="PolicyWithMultipleOptions", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-get-by-name.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/contentkeypoliciesgetwithsecrets.py b/sdk/media/azure-mgmt-media/generated_samples/contentkeypoliciesgetwithsecrets.py new file mode 100644 index 0000000000000..9d956de4da50f --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/contentkeypoliciesgetwithsecrets.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python contentkeypoliciesgetwithsecrets.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.content_key_policies.get_policy_properties_with_secrets( + resource_group_name="contoso", + account_name="contosomedia", + content_key_policy_name="PolicyWithMultipleOptions", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-get-with-secrets.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/contentkeypolicieslistall.py b/sdk/media/azure-mgmt-media/generated_samples/contentkeypolicieslistall.py new file mode 100644 index 0000000000000..d588e15245407 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/contentkeypolicieslistall.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python contentkeypolicieslistall.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.content_key_policies.list( + resource_group_name="contoso", + account_name="contosomedia", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-list-all.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/contentkeypolicieslistbylast_modified.py b/sdk/media/azure-mgmt-media/generated_samples/contentkeypolicieslistbylast_modified.py new file mode 100644 index 0000000000000..c90181a9add10 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/contentkeypolicieslistbylast_modified.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python contentkeypolicieslistbylast_modified.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.content_key_policies.list( + resource_group_name="contoso", + account_name="contosomedia", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-list-by-lastModified.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/contentkeypolicieslistindaterange.py b/sdk/media/azure-mgmt-media/generated_samples/contentkeypolicieslistindaterange.py new file mode 100644 index 0000000000000..1729906c0b481 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/contentkeypolicieslistindaterange.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python contentkeypolicieslistindaterange.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.content_key_policies.list( + resource_group_name="contoso", + account_name="contosomedia", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-list-in-date-range.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/contentkeypoliciesupdate.py b/sdk/media/azure-mgmt-media/generated_samples/contentkeypoliciesupdate.py new file mode 100644 index 0000000000000..282fd62eb70ae --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/contentkeypoliciesupdate.py @@ -0,0 +1,54 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python contentkeypoliciesupdate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.content_key_policies.update( + resource_group_name="contoso", + account_name="contosomedia", + content_key_policy_name="PolicyWithClearKeyOptionAndTokenRestriction", + parameters={ + "properties": { + "description": "Updated Policy", + "options": [ + { + "configuration": {"@odata.type": "#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration"}, + "name": "ClearKeyOption", + "restriction": {"@odata.type": "#Microsoft.Media.ContentKeyPolicyOpenRestriction"}, + } + ], + } + }, + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-update.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/jobscancel.py b/sdk/media/azure-mgmt-media/generated_samples/jobscancel.py new file mode 100644 index 0000000000000..29e990f3766c3 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/jobscancel.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 azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python jobscancel.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.jobs.cancel_job( + resource_group_name="contosoresources", + account_name="contosomedia", + transform_name="exampleTransform", + job_name="job1", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Encoding/stable/2022-07-01/examples/jobs-cancel.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/jobscreate.py b/sdk/media/azure-mgmt-media/generated_samples/jobscreate.py new file mode 100644 index 0000000000000..1ce1ec0a34359 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/jobscreate.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python jobscreate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.jobs.create( + resource_group_name="contosoresources", + account_name="contosomedia", + transform_name="exampleTransform", + job_name="job1", + parameters={ + "properties": { + "correlationData": {"Key 2": "Value 2", "key1": "value1"}, + "input": {"@odata.type": "#Microsoft.Media.JobInputAsset", "assetName": "job1-InputAsset"}, + "outputs": [{"@odata.type": "#Microsoft.Media.JobOutputAsset", "assetName": "job1-OutputAsset"}], + } + }, + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Encoding/stable/2022-07-01/examples/jobs-create.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/jobsdelete.py b/sdk/media/azure-mgmt-media/generated_samples/jobsdelete.py new file mode 100644 index 0000000000000..28a04abec1080 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/jobsdelete.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 azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python jobsdelete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.jobs.delete( + resource_group_name="contosoresources", + account_name="contosomedia", + transform_name="exampleTransform", + job_name="jobToDelete", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Encoding/stable/2022-07-01/examples/jobs-delete.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/jobsgetbyname.py b/sdk/media/azure-mgmt-media/generated_samples/jobsgetbyname.py new file mode 100644 index 0000000000000..15fc02ee5a4d4 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/jobsgetbyname.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 azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python jobsgetbyname.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.jobs.get( + resource_group_name="contosoresources", + account_name="contosomedia", + transform_name="exampleTransform", + job_name="job1", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Encoding/stable/2022-07-01/examples/jobs-get-by-name.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/jobslistall.py b/sdk/media/azure-mgmt-media/generated_samples/jobslistall.py new file mode 100644 index 0000000000000..4811d453a3795 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/jobslistall.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 azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python jobslistall.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.jobs.list( + resource_group_name="contosoresources", + account_name="contosomedia", + transform_name="exampleTransform", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Encoding/stable/2022-07-01/examples/jobs-list-all.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/jobslistallfilterbycreated.py b/sdk/media/azure-mgmt-media/generated_samples/jobslistallfilterbycreated.py new file mode 100644 index 0000000000000..80da32e9e872c --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/jobslistallfilterbycreated.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 azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python jobslistallfilterbycreated.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.jobs.list( + resource_group_name="contosoresources", + account_name="contosomedia", + transform_name="exampleTransform", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Encoding/stable/2022-07-01/examples/jobs-list-all-filter-by-created.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/jobslistallfilterbylastmodified.py b/sdk/media/azure-mgmt-media/generated_samples/jobslistallfilterbylastmodified.py new file mode 100644 index 0000000000000..c70eaeb359b6f --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/jobslistallfilterbylastmodified.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 azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python jobslistallfilterbylastmodified.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.jobs.list( + resource_group_name="contosoresources", + account_name="contosomedia", + transform_name="exampleTransform", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Encoding/stable/2022-07-01/examples/jobs-list-all-filter-by-lastmodified.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/jobslistallfilterbyname.py b/sdk/media/azure-mgmt-media/generated_samples/jobslistallfilterbyname.py new file mode 100644 index 0000000000000..c98c151e4d876 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/jobslistallfilterbyname.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 azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python jobslistallfilterbyname.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.jobs.list( + resource_group_name="contosoresources", + account_name="contosomedia", + transform_name="exampleTransform", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Encoding/stable/2022-07-01/examples/jobs-list-all-filter-by-name.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/jobslistallfilterbynameandstate.py b/sdk/media/azure-mgmt-media/generated_samples/jobslistallfilterbynameandstate.py new file mode 100644 index 0000000000000..4b46f855f92ad --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/jobslistallfilterbynameandstate.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 azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python jobslistallfilterbynameandstate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.jobs.list( + resource_group_name="contosoresources", + account_name="contosomedia", + transform_name="exampleTransform", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Encoding/stable/2022-07-01/examples/jobs-list-all-filter-by-name-and-state.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/jobslistallfilterbystateeq.py b/sdk/media/azure-mgmt-media/generated_samples/jobslistallfilterbystateeq.py new file mode 100644 index 0000000000000..4f6852af4d0c2 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/jobslistallfilterbystateeq.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 azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python jobslistallfilterbystateeq.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.jobs.list( + resource_group_name="contosoresources", + account_name="contosomedia", + transform_name="exampleTransform", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Encoding/stable/2022-07-01/examples/jobs-list-all-filter-by-state-eq.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/jobslistallfilterbystatene.py b/sdk/media/azure-mgmt-media/generated_samples/jobslistallfilterbystatene.py new file mode 100644 index 0000000000000..99ffa9f0e5254 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/jobslistallfilterbystatene.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 azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python jobslistallfilterbystatene.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.jobs.list( + resource_group_name="contosoresources", + account_name="contosomedia", + transform_name="exampleTransform", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Encoding/stable/2022-07-01/examples/jobs-list-all-filter-by-state-ne.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/jobsupdate.py b/sdk/media/azure-mgmt-media/generated_samples/jobsupdate.py new file mode 100644 index 0000000000000..4298408f06933 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/jobsupdate.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python jobsupdate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.jobs.update( + resource_group_name="contosoresources", + account_name="contosomedia", + transform_name="exampleTransform", + job_name="job1", + parameters={ + "properties": { + "description": "Example job to illustrate update.", + "input": {"@odata.type": "#Microsoft.Media.JobInputAsset", "assetName": "job1-InputAsset"}, + "outputs": [{"@odata.type": "#Microsoft.Media.JobOutputAsset", "assetName": "job1-OutputAsset"}], + "priority": "High", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Encoding/stable/2022-07-01/examples/jobs-update.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/liveeventallocate.py b/sdk/media/azure-mgmt-media/generated_samples/liveeventallocate.py new file mode 100644 index 0000000000000..e8668818bd562 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/liveeventallocate.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python liveeventallocate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="0a6ec948-5a62-437d-b9df-934dc7c1b722", + ) + + response = client.live_events.begin_allocate( + resource_group_name="mediaresources", + account_name="slitestmedia10", + live_event_name="myLiveEvent1", + ).result() + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Streaming/stable/2022-08-01/examples/liveevent-allocate.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/liveeventcreate.py b/sdk/media/azure-mgmt-media/generated_samples/liveeventcreate.py new file mode 100644 index 0000000000000..d429122ae6138 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/liveeventcreate.py @@ -0,0 +1,61 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python liveeventcreate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="0a6ec948-5a62-437d-b9df-934dc7c1b722", + ) + + response = client.live_events.begin_create( + resource_group_name="mediaresources", + account_name="slitestmedia10", + live_event_name="myLiveEvent1", + parameters={ + "location": "West US", + "properties": { + "description": "test event 1", + "input": { + "accessControl": { + "ip": {"allow": [{"address": "0.0.0.0", "name": "AllowAll", "subnetPrefixLength": 0}]} + }, + "keyFrameIntervalDuration": "PT6S", + "streamingProtocol": "RTMP", + }, + "preview": { + "accessControl": { + "ip": {"allow": [{"address": "0.0.0.0", "name": "AllowAll", "subnetPrefixLength": 0}]} + } + }, + }, + "tags": {"tag1": "value1", "tag2": "value2"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Streaming/stable/2022-08-01/examples/liveevent-create.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/liveeventdelete.py b/sdk/media/azure-mgmt-media/generated_samples/liveeventdelete.py new file mode 100644 index 0000000000000..20153875f105f --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/liveeventdelete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python liveeventdelete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="0a6ec948-5a62-437d-b9df-934dc7c1b722", + ) + + response = client.live_events.begin_delete( + resource_group_name="mediaresources", + account_name="slitestmedia10", + live_event_name="myLiveEvent1", + ).result() + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Streaming/stable/2022-08-01/examples/liveevent-delete.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/liveeventlistall.py b/sdk/media/azure-mgmt-media/generated_samples/liveeventlistall.py new file mode 100644 index 0000000000000..e56b08174e92e --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/liveeventlistall.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python liveeventlistall.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="0a6ec948-5a62-437d-b9df-934dc7c1b722", + ) + + response = client.live_events.list( + resource_group_name="mediaresources", + account_name="slitestmedia10", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Streaming/stable/2022-08-01/examples/liveevent-list-all.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/liveeventlistbyname.py b/sdk/media/azure-mgmt-media/generated_samples/liveeventlistbyname.py new file mode 100644 index 0000000000000..47f08f8eb38d0 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/liveeventlistbyname.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python liveeventlistbyname.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="0a6ec948-5a62-437d-b9df-934dc7c1b722", + ) + + response = client.live_events.get( + resource_group_name="mediaresources", + account_name="slitestmedia10", + live_event_name="myLiveEvent1", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Streaming/stable/2022-08-01/examples/liveevent-list-by-name.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/liveeventoperationlocation.py b/sdk/media/azure-mgmt-media/generated_samples/liveeventoperationlocation.py new file mode 100644 index 0000000000000..596e361615129 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/liveeventoperationlocation.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 azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python liveeventoperationlocation.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="0a6ec948-5a62-437d-b9df-934dc7c1b722", + ) + + response = client.live_events.operation_location( + resource_group_name="mediaresources", + account_name="slitestmedia10", + live_event_name="myLiveEvent1", + operation_id="62e4d893-d233-4005-988e-a428d9f77076", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Streaming/stable/2022-08-01/examples/liveevent-operation-location.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/liveeventreset.py b/sdk/media/azure-mgmt-media/generated_samples/liveeventreset.py new file mode 100644 index 0000000000000..f827979edf6dc --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/liveeventreset.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python liveeventreset.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="0a6ec948-5a62-437d-b9df-934dc7c1b722", + ) + + response = client.live_events.begin_reset( + resource_group_name="mediaresources", + account_name="slitestmedia10", + live_event_name="myLiveEvent1", + ).result() + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Streaming/stable/2022-08-01/examples/liveevent-reset.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/liveeventstart.py b/sdk/media/azure-mgmt-media/generated_samples/liveeventstart.py new file mode 100644 index 0000000000000..dc76246382a34 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/liveeventstart.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python liveeventstart.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="0a6ec948-5a62-437d-b9df-934dc7c1b722", + ) + + response = client.live_events.begin_start( + resource_group_name="mediaresources", + account_name="slitestmedia10", + live_event_name="myLiveEvent1", + ).result() + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Streaming/stable/2022-08-01/examples/liveevent-start.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/liveeventstop.py b/sdk/media/azure-mgmt-media/generated_samples/liveeventstop.py new file mode 100644 index 0000000000000..58b5446eb7997 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/liveeventstop.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 azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python liveeventstop.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="0a6ec948-5a62-437d-b9df-934dc7c1b722", + ) + + response = client.live_events.begin_stop( + resource_group_name="mediaresources", + account_name="slitestmedia10", + live_event_name="myLiveEvent1", + parameters={"removeOutputsOnStop": False}, + ).result() + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Streaming/stable/2022-08-01/examples/liveevent-stop.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/liveeventupdate.py b/sdk/media/azure-mgmt-media/generated_samples/liveeventupdate.py new file mode 100644 index 0000000000000..b1b7eba18a743 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/liveeventupdate.py @@ -0,0 +1,55 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python liveeventupdate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="0a6ec948-5a62-437d-b9df-934dc7c1b722", + ) + + response = client.live_events.begin_update( + resource_group_name="mediaresources", + account_name="slitestmedia10", + live_event_name="myLiveEvent1", + parameters={ + "location": "West US", + "properties": { + "description": "test event updated", + "input": { + "accessControl": {"ip": {"allow": [{"address": "192.1.1.0", "name": "AllowOne"}]}}, + "keyFrameIntervalDuration": "PT6S", + "streamingProtocol": "FragmentedMP4", + }, + "preview": {"accessControl": {"ip": {"allow": [{"address": "192.1.1.0", "name": "AllowOne"}]}}}, + }, + "tags": {"tag1": "value1", "tag2": "value2", "tag3": "value3"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Streaming/stable/2022-08-01/examples/liveevent-update.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/liveoutputcreate.py b/sdk/media/azure-mgmt-media/generated_samples/liveoutputcreate.py new file mode 100644 index 0000000000000..6c1dc54d4d98f --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/liveoutputcreate.py @@ -0,0 +1,53 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python liveoutputcreate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="0a6ec948-5a62-437d-b9df-934dc7c1b722", + ) + + response = client.live_outputs.begin_create( + resource_group_name="mediaresources", + account_name="slitestmedia10", + live_event_name="myLiveEvent1", + live_output_name="myLiveOutput1", + parameters={ + "properties": { + "archiveWindowLength": "PT5M", + "assetName": "6f3264f5-a189-48b4-a29a-a40f22575212", + "description": "test live output 1", + "hls": {"fragmentsPerTsSegment": 5}, + "manifestName": "testmanifest", + "rewindWindowLength": "PT4M", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Streaming/stable/2022-08-01/examples/liveoutput-create.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/liveoutputdelete.py b/sdk/media/azure-mgmt-media/generated_samples/liveoutputdelete.py new file mode 100644 index 0000000000000..50bc971243baa --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/liveoutputdelete.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 azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python liveoutputdelete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="0a6ec948-5a62-437d-b9df-934dc7c1b722", + ) + + response = client.live_outputs.begin_delete( + resource_group_name="mediaresources", + account_name="slitestmedia10", + live_event_name="myLiveEvent1", + live_output_name="myLiveOutput1", + ).result() + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Streaming/stable/2022-08-01/examples/liveoutput-delete.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/liveoutputlistall.py b/sdk/media/azure-mgmt-media/generated_samples/liveoutputlistall.py new file mode 100644 index 0000000000000..8a7dd347f931e --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/liveoutputlistall.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 azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python liveoutputlistall.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="0a6ec948-5a62-437d-b9df-934dc7c1b722", + ) + + response = client.live_outputs.list( + resource_group_name="mediaresources", + account_name="slitestmedia10", + live_event_name="myLiveEvent1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Streaming/stable/2022-08-01/examples/liveoutput-list-all.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/liveoutputlistbyname.py b/sdk/media/azure-mgmt-media/generated_samples/liveoutputlistbyname.py new file mode 100644 index 0000000000000..a413c8f177f39 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/liveoutputlistbyname.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 azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python liveoutputlistbyname.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="0a6ec948-5a62-437d-b9df-934dc7c1b722", + ) + + response = client.live_outputs.get( + resource_group_name="mediaresources", + account_name="slitestmedia10", + live_event_name="myLiveEvent1", + live_output_name="myLiveOutput1", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Streaming/stable/2022-08-01/examples/liveoutput-list-by-name.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/liveoutputoperationlocation.py b/sdk/media/azure-mgmt-media/generated_samples/liveoutputoperationlocation.py new file mode 100644 index 0000000000000..b8f83e51a72a5 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/liveoutputoperationlocation.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python liveoutputoperationlocation.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="0a6ec948-5a62-437d-b9df-934dc7c1b722", + ) + + response = client.live_outputs.operation_location( + resource_group_name="mediaresources", + account_name="slitestmedia10", + live_event_name="myLiveEvent1", + live_output_name="myLiveOutput1", + operation_id="62e4d893-d233-4005-988e-a428d9f77076", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Streaming/stable/2022-08-01/examples/liveoutput-operation-location.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/mediaserviceoperationresultbyid.py b/sdk/media/azure-mgmt-media/generated_samples/mediaserviceoperationresultbyid.py new file mode 100644 index 0000000000000..1edfc361c182f --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/mediaserviceoperationresultbyid.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python mediaserviceoperationresultbyid.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.media_services_operation_results.get( + location_name="westus", + operation_id="6FBA62C4-99B5-4FF8-9826-FC4744A8864F", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Accounts/stable/2021-11-01/examples/media-service-operation-result-by-id.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/mediaserviceoperationstatusbyidnonterminalstate.py b/sdk/media/azure-mgmt-media/generated_samples/mediaserviceoperationstatusbyidnonterminalstate.py new file mode 100644 index 0000000000000..c002241116e93 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/mediaserviceoperationstatusbyidnonterminalstate.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python mediaserviceoperationstatusbyidnonterminalstate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.media_services_operation_statuses.get( + location_name="westus", + operation_id="D612C429-2526-49D5-961B-885AE11406FD", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Accounts/stable/2021-11-01/examples/media-service-operation-status-by-id-non-terminal-state.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/mediaserviceoperationstatusbyidnonterminalstatefailed.py b/sdk/media/azure-mgmt-media/generated_samples/mediaserviceoperationstatusbyidnonterminalstatefailed.py new file mode 100644 index 0000000000000..10f83bf37ff2d --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/mediaserviceoperationstatusbyidnonterminalstatefailed.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python mediaserviceoperationstatusbyidnonterminalstatefailed.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.media_services_operation_statuses.get( + location_name="westus", + operation_id="D612C429-2526-49D5-961B-885AE11406FD", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Accounts/stable/2021-11-01/examples/media-service-operation-status-by-id-non-terminal-state-failed.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/mediaserviceoperationstatusbyidterminalstate.py b/sdk/media/azure-mgmt-media/generated_samples/mediaserviceoperationstatusbyidterminalstate.py new file mode 100644 index 0000000000000..9428e1bd6d817 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/mediaserviceoperationstatusbyidterminalstate.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python mediaserviceoperationstatusbyidterminalstate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.media_services_operation_statuses.get( + location_name="westus", + operation_id="D612C429-2526-49D5-961B-885AE11406FD", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Accounts/stable/2021-11-01/examples/media-service-operation-status-by-id-terminal-state.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/operationslistall.py b/sdk/media/azure-mgmt-media/generated_samples/operationslistall.py new file mode 100644 index 0000000000000..751e2f1301c00 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/operationslistall.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python operationslistall.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.operations.list() + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Accounts/stable/2021-11-01/examples/operations-list-all.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/privateendpointconnectiondelete.py b/sdk/media/azure-mgmt-media/generated_samples/privateendpointconnectiondelete.py new file mode 100644 index 0000000000000..7a8f9b1f5d727 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/privateendpointconnectiondelete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python privateendpointconnectiondelete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.private_endpoint_connections.delete( + resource_group_name="contoso", + account_name="contososports", + name="connectionName1", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Accounts/stable/2021-11-01/examples/private-endpoint-connection-delete.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/privateendpointconnectiongetbyname.py b/sdk/media/azure-mgmt-media/generated_samples/privateendpointconnectiongetbyname.py new file mode 100644 index 0000000000000..e874f223d6c58 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/privateendpointconnectiongetbyname.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python privateendpointconnectiongetbyname.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.private_endpoint_connections.get( + resource_group_name="contoso", + account_name="contososports", + name="connectionName1", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Accounts/stable/2021-11-01/examples/private-endpoint-connection-get-by-name.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/privateendpointconnectionlist.py b/sdk/media/azure-mgmt-media/generated_samples/privateendpointconnectionlist.py new file mode 100644 index 0000000000000..f5ae82624c6b4 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/privateendpointconnectionlist.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python privateendpointconnectionlist.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.private_endpoint_connections.list( + resource_group_name="contoso", + account_name="contososports", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Accounts/stable/2021-11-01/examples/private-endpoint-connection-list.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/privateendpointconnectionput.py b/sdk/media/azure-mgmt-media/generated_samples/privateendpointconnectionput.py new file mode 100644 index 0000000000000..027106714bd93 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/privateendpointconnectionput.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python privateendpointconnectionput.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.private_endpoint_connections.create_or_update( + resource_group_name="contoso", + account_name="contososports", + name="connectionName1", + parameters={ + "properties": { + "privateLinkServiceConnectionState": {"description": "Test description.", "status": "Approved"} + } + }, + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Accounts/stable/2021-11-01/examples/private-endpoint-connection-put.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/privatelinkresourcesgetbyname.py b/sdk/media/azure-mgmt-media/generated_samples/privatelinkresourcesgetbyname.py new file mode 100644 index 0000000000000..9a2e9db8d2c4d --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/privatelinkresourcesgetbyname.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python privatelinkresourcesgetbyname.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.private_link_resources.get( + resource_group_name="contoso", + account_name="contososports", + name="keydelivery", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Accounts/stable/2021-11-01/examples/private-link-resources-get-by-name.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/privatelinkresourceslist.py b/sdk/media/azure-mgmt-media/generated_samples/privatelinkresourceslist.py new file mode 100644 index 0000000000000..e31bbe53f6fe2 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/privatelinkresourceslist.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python privatelinkresourceslist.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.private_link_resources.list( + resource_group_name="contoso", + account_name="contososports", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Accounts/stable/2021-11-01/examples/private-link-resources-list.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/streamingendpointcreate.py b/sdk/media/azure-mgmt-media/generated_samples/streamingendpointcreate.py new file mode 100644 index 0000000000000..f48c1d95ac361 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/streamingendpointcreate.py @@ -0,0 +1,69 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python streamingendpointcreate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="0a6ec948-5a62-437d-b9df-934dc7c1b722", + ) + + response = client.streaming_endpoints.begin_create( + resource_group_name="mediaresources", + account_name="slitestmedia10", + streaming_endpoint_name="myStreamingEndpoint1", + parameters={ + "location": "West US", + "properties": { + "accessControl": { + "akamai": { + "akamaiSignatureHeaderAuthenticationKeyList": [ + { + "base64Key": "dGVzdGlkMQ==", + "expiration": "2029-12-31T16:00:00-08:00", + "identifier": "id1", + }, + { + "base64Key": "dGVzdGlkMQ==", + "expiration": "2030-12-31T16:00:00-08:00", + "identifier": "id2", + }, + ] + }, + "ip": {"allow": [{"address": "192.168.1.1", "name": "AllowedIp"}]}, + }, + "availabilitySetName": "availableset", + "cdnEnabled": False, + "description": "test event 1", + "scaleUnits": 1, + }, + "tags": {"tag1": "value1", "tag2": "value2"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Streaming/stable/2022-08-01/examples/streamingendpoint-create.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/streamingendpointdelete.py b/sdk/media/azure-mgmt-media/generated_samples/streamingendpointdelete.py new file mode 100644 index 0000000000000..38b7401b07047 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/streamingendpointdelete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python streamingendpointdelete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="0a6ec948-5a62-437d-b9df-934dc7c1b722", + ) + + response = client.streaming_endpoints.begin_delete( + resource_group_name="mediaresources", + account_name="slitestmedia10", + streaming_endpoint_name="myStreamingEndpoint1", + ).result() + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Streaming/stable/2022-08-01/examples/streamingendpoint-delete.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/streamingendpointlistall.py b/sdk/media/azure-mgmt-media/generated_samples/streamingendpointlistall.py new file mode 100644 index 0000000000000..4d32506013a5b --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/streamingendpointlistall.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python streamingendpointlistall.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="0a6ec948-5a62-437d-b9df-934dc7c1b722", + ) + + response = client.streaming_endpoints.list( + resource_group_name="mediaresources", + account_name="slitestmedia10", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Streaming/stable/2022-08-01/examples/streamingendpoint-list-all.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/streamingendpointlistbyname.py b/sdk/media/azure-mgmt-media/generated_samples/streamingendpointlistbyname.py new file mode 100644 index 0000000000000..a4bb9a6264d74 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/streamingendpointlistbyname.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python streamingendpointlistbyname.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="0a6ec948-5a62-437d-b9df-934dc7c1b722", + ) + + response = client.streaming_endpoints.get( + resource_group_name="mediaresources", + account_name="slitestmedia10", + streaming_endpoint_name="myStreamingEndpoint1", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Streaming/stable/2022-08-01/examples/streamingendpoint-list-by-name.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/streamingendpointlistskus.py b/sdk/media/azure-mgmt-media/generated_samples/streamingendpointlistskus.py new file mode 100644 index 0000000000000..cb23baefa9c85 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/streamingendpointlistskus.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python streamingendpointlistskus.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="0a6ec948-5a62-437d-b9df-934dc7c1b722", + ) + + response = client.streaming_endpoints.skus( + resource_group_name="mediaresources", + account_name="slitestmedia10", + streaming_endpoint_name="myStreamingEndpoint1", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Streaming/stable/2022-08-01/examples/streamingendpoint-list-skus.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/streamingendpointoperationlocation.py b/sdk/media/azure-mgmt-media/generated_samples/streamingendpointoperationlocation.py new file mode 100644 index 0000000000000..88a979fd5b8b9 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/streamingendpointoperationlocation.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 azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python streamingendpointoperationlocation.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="0a6ec948-5a62-437d-b9df-934dc7c1b722", + ) + + response = client.streaming_endpoints.operation_location( + resource_group_name="mediaresources", + account_name="slitestmedia10", + streaming_endpoint_name="myStreamingEndpoint1", + operation_id="62e4d893-d233-4005-988e-a428d9f77076", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Streaming/stable/2022-08-01/examples/streamingendpoint-operation-location.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/streamingendpointscale.py b/sdk/media/azure-mgmt-media/generated_samples/streamingendpointscale.py new file mode 100644 index 0000000000000..6ce791cd6fbe4 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/streamingendpointscale.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 azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python streamingendpointscale.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="0a6ec948-5a62-437d-b9df-934dc7c1b722", + ) + + response = client.streaming_endpoints.begin_scale( + resource_group_name="mediaresources", + account_name="slitestmedia10", + streaming_endpoint_name="myStreamingEndpoint1", + parameters={"scaleUnit": 5}, + ).result() + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Streaming/stable/2022-08-01/examples/streamingendpoint-scale.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/streamingendpointstart.py b/sdk/media/azure-mgmt-media/generated_samples/streamingendpointstart.py new file mode 100644 index 0000000000000..4f4e59aa8184c --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/streamingendpointstart.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python streamingendpointstart.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="0a6ec948-5a62-437d-b9df-934dc7c1b722", + ) + + response = client.streaming_endpoints.begin_start( + resource_group_name="mediaresources", + account_name="slitestmedia10", + streaming_endpoint_name="myStreamingEndpoint1", + ).result() + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Streaming/stable/2022-08-01/examples/streamingendpoint-start.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/streamingendpointstop.py b/sdk/media/azure-mgmt-media/generated_samples/streamingendpointstop.py new file mode 100644 index 0000000000000..ebdd70a597b75 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/streamingendpointstop.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python streamingendpointstop.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="0a6ec948-5a62-437d-b9df-934dc7c1b722", + ) + + response = client.streaming_endpoints.begin_stop( + resource_group_name="mediaresources", + account_name="slitestmedia10", + streaming_endpoint_name="myStreamingEndpoint1", + ).result() + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Streaming/stable/2022-08-01/examples/streamingendpoint-stop.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/streamingendpointupdate.py b/sdk/media/azure-mgmt-media/generated_samples/streamingendpointupdate.py new file mode 100644 index 0000000000000..448e3183d0e64 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/streamingendpointupdate.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python streamingendpointupdate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="0a6ec948-5a62-437d-b9df-934dc7c1b722", + ) + + response = client.streaming_endpoints.begin_update( + resource_group_name="mediaresources", + account_name="slitestmedia10", + streaming_endpoint_name="myStreamingEndpoint1", + parameters={ + "location": "West US", + "properties": {"availabilitySetName": "availableset", "description": "test event 2", "scaleUnits": 5}, + "tags": {"tag3": "value3", "tag5": "value5"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Streaming/stable/2022-08-01/examples/streamingendpoint-update.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/streaminglocatorscreateclear.py b/sdk/media/azure-mgmt-media/generated_samples/streaminglocatorscreateclear.py new file mode 100644 index 0000000000000..6734a7c19e1d5 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/streaminglocatorscreateclear.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 azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python streaminglocatorscreateclear.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.streaming_locators.create( + resource_group_name="contoso", + account_name="contosomedia", + streaming_locator_name="UserCreatedClearStreamingLocator", + parameters={"properties": {"assetName": "ClimbingMountRainier", "streamingPolicyName": "clearStreamingPolicy"}}, + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-locators-create-clear.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/streaminglocatorscreatesecure.py b/sdk/media/azure-mgmt-media/generated_samples/streaminglocatorscreatesecure.py new file mode 100644 index 0000000000000..20728c4f80d2b --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/streaminglocatorscreatesecure.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python streaminglocatorscreatesecure.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.streaming_locators.create( + resource_group_name="contoso", + account_name="contosomedia", + streaming_locator_name="UserCreatedSecureStreamingLocator", + parameters={ + "properties": { + "assetName": "ClimbingMountRainier", + "endTime": "2028-12-31T23:59:59.9999999Z", + "startTime": "2018-03-01T00:00:00Z", + "streamingPolicyName": "secureStreamingPolicy", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-locators-create-secure.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/streaminglocatorscreatesecureuser_defined_content_keys.py b/sdk/media/azure-mgmt-media/generated_samples/streaminglocatorscreatesecureuser_defined_content_keys.py new file mode 100644 index 0000000000000..82437b6dd1cda --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/streaminglocatorscreatesecureuser_defined_content_keys.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 azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python streaminglocatorscreatesecureuser_defined_content_keys.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.streaming_locators.create( + resource_group_name="contoso", + account_name="contosomedia", + streaming_locator_name="UserCreatedSecureStreamingLocatorWithUserDefinedContentKeys", + parameters={ + "properties": { + "assetName": "ClimbingMountRainier", + "contentKeys": [ + { + "id": "60000000-0000-0000-0000-000000000001", + "labelReferenceInStreamingPolicy": "aesDefaultKey", + "value": "1UqLohAfWsEGkULYxHjYZg==", + }, + { + "id": "60000000-0000-0000-0000-000000000004", + "labelReferenceInStreamingPolicy": "cencDefaultKey", + "value": "4UqLohAfWsEGkULYxHjYZg==", + }, + { + "id": "60000000-0000-0000-0000-000000000007", + "labelReferenceInStreamingPolicy": "cbcsDefaultKey", + "value": "7UqLohAfWsEGkULYxHjYZg==", + }, + ], + "streamingLocatorId": "90000000-0000-0000-0000-00000000000A", + "streamingPolicyName": "secureStreamingPolicy", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-locators-create-secure-userDefinedContentKeys.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/streaminglocatorsdelete.py b/sdk/media/azure-mgmt-media/generated_samples/streaminglocatorsdelete.py new file mode 100644 index 0000000000000..cfcee8370d288 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/streaminglocatorsdelete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python streaminglocatorsdelete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.streaming_locators.delete( + resource_group_name="contoso", + account_name="contosomedia", + streaming_locator_name="clearStreamingLocator", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-locators-delete.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/streaminglocatorsgetbyname.py b/sdk/media/azure-mgmt-media/generated_samples/streaminglocatorsgetbyname.py new file mode 100644 index 0000000000000..71d6b34df2a88 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/streaminglocatorsgetbyname.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python streaminglocatorsgetbyname.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.streaming_locators.get( + resource_group_name="contoso", + account_name="contosomedia", + streaming_locator_name="clearStreamingLocator", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-locators-get-by-name.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/streaminglocatorslist.py b/sdk/media/azure-mgmt-media/generated_samples/streaminglocatorslist.py new file mode 100644 index 0000000000000..80f7fc328f8d0 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/streaminglocatorslist.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python streaminglocatorslist.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.streaming_locators.list( + resource_group_name="contoso", + account_name="contosomedia", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-locators-list.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/streaminglocatorslistcontentkeys.py b/sdk/media/azure-mgmt-media/generated_samples/streaminglocatorslistcontentkeys.py new file mode 100644 index 0000000000000..c58d7801b21e9 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/streaminglocatorslistcontentkeys.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python streaminglocatorslistcontentkeys.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.streaming_locators.list_content_keys( + resource_group_name="contoso", + account_name="contosomedia", + streaming_locator_name="secureStreamingLocator", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-locators-list-content-keys.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/streaminglocatorslistpathsstreaminganddownload.py b/sdk/media/azure-mgmt-media/generated_samples/streaminglocatorslistpathsstreaminganddownload.py new file mode 100644 index 0000000000000..afd78320e38e9 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/streaminglocatorslistpathsstreaminganddownload.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python streaminglocatorslistpathsstreaminganddownload.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.streaming_locators.list_paths( + resource_group_name="contoso", + account_name="contosomedia", + streaming_locator_name="clearStreamingLocator", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-locators-list-paths-streaming-and-download.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/streaminglocatorslistpathsstreamingonly.py b/sdk/media/azure-mgmt-media/generated_samples/streaminglocatorslistpathsstreamingonly.py new file mode 100644 index 0000000000000..669e71c4613d4 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/streaminglocatorslistpathsstreamingonly.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python streaminglocatorslistpathsstreamingonly.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.streaming_locators.list_paths( + resource_group_name="contoso", + account_name="contosomedia", + streaming_locator_name="secureStreamingLocator", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-locators-list-paths-streaming-only.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/streamingpoliciescreateclear.py b/sdk/media/azure-mgmt-media/generated_samples/streamingpoliciescreateclear.py new file mode 100644 index 0000000000000..ba259b5e9f26c --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/streamingpoliciescreateclear.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python streamingpoliciescreateclear.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.streaming_policies.create( + resource_group_name="contoso", + account_name="contosomedia", + streaming_policy_name="UserCreatedClearStreamingPolicy", + parameters={ + "properties": { + "noEncryption": { + "enabledProtocols": {"dash": True, "download": True, "hls": True, "smoothStreaming": True} + } + } + }, + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-policies-create-clear.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/streamingpoliciescreatecommon_encryption_cbcsclear_key_encryption.py b/sdk/media/azure-mgmt-media/generated_samples/streamingpoliciescreatecommon_encryption_cbcsclear_key_encryption.py new file mode 100644 index 0000000000000..33249e6e61674 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/streamingpoliciescreatecommon_encryption_cbcsclear_key_encryption.py @@ -0,0 +1,54 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python streamingpoliciescreatecommon_encryption_cbcsclear_key_encryption.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.streaming_policies.create( + resource_group_name="contoso", + account_name="contosomedia", + streaming_policy_name="UserCreatedSecureStreamingPolicyWithCommonEncryptionCbcsOnly", + parameters={ + "properties": { + "commonEncryptionCbcs": { + "clearKeyEncryptionConfiguration": { + "customKeysAcquisitionUrlTemplate": "https://contoso.com/{AlternativeMediaId}/clearkey/" + }, + "contentKeys": {"defaultKey": {"label": "cbcsDefaultKey"}}, + "enabledProtocols": {"dash": False, "download": False, "hls": True, "smoothStreaming": False}, + }, + "defaultContentKeyPolicyName": "PolicyWithMultipleOptions", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-policies-create-commonEncryptionCbcs-clearKeyEncryption.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/streamingpoliciescreatecommon_encryption_cbcsonly.py b/sdk/media/azure-mgmt-media/generated_samples/streamingpoliciescreatecommon_encryption_cbcsonly.py new file mode 100644 index 0000000000000..e2949b9432172 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/streamingpoliciescreatecommon_encryption_cbcsonly.py @@ -0,0 +1,57 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python streamingpoliciescreatecommon_encryption_cbcsonly.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.streaming_policies.create( + resource_group_name="contoso", + account_name="contosomedia", + streaming_policy_name="UserCreatedSecureStreamingPolicyWithCommonEncryptionCbcsOnly", + parameters={ + "properties": { + "commonEncryptionCbcs": { + "contentKeys": {"defaultKey": {"label": "cbcsDefaultKey"}}, + "drm": { + "fairPlay": { + "allowPersistentLicense": True, + "customLicenseAcquisitionUrlTemplate": "https://contoso.com/{AssetAlternativeId}/fairplay/{ContentKeyId}", + } + }, + "enabledProtocols": {"dash": False, "download": False, "hls": True, "smoothStreaming": False}, + }, + "defaultContentKeyPolicyName": "PolicyWithMultipleOptions", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-policies-create-commonEncryptionCbcs-only.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/streamingpoliciescreatecommon_encryption_cencclear_key_encryption.py b/sdk/media/azure-mgmt-media/generated_samples/streamingpoliciescreatecommon_encryption_cencclear_key_encryption.py new file mode 100644 index 0000000000000..2f45c0d3aa77d --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/streamingpoliciescreatecommon_encryption_cencclear_key_encryption.py @@ -0,0 +1,57 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python streamingpoliciescreatecommon_encryption_cencclear_key_encryption.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.streaming_policies.create( + resource_group_name="contoso", + account_name="contosomedia", + streaming_policy_name="UserCreatedSecureStreamingPolicyWithCommonEncryptionCencOnly", + parameters={ + "properties": { + "commonEncryptionCenc": { + "clearKeyEncryptionConfiguration": { + "customKeysAcquisitionUrlTemplate": "https://contoso.com/{AlternativeMediaId}/clearkey/" + }, + "clearTracks": [ + {"trackSelections": [{"operation": "Equal", "property": "FourCC", "value": "hev1"}]} + ], + "contentKeys": {"defaultKey": {"label": "cencDefaultKey"}}, + "enabledProtocols": {"dash": True, "download": False, "hls": False, "smoothStreaming": True}, + }, + "defaultContentKeyPolicyName": "PolicyWithPlayReadyOptionAndOpenRestriction", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-policies-create-commonEncryptionCenc-clearKeyEncryption.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/streamingpoliciescreatecommon_encryption_cenconly.py b/sdk/media/azure-mgmt-media/generated_samples/streamingpoliciescreatecommon_encryption_cenconly.py new file mode 100644 index 0000000000000..5dc1602dd33ff --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/streamingpoliciescreatecommon_encryption_cenconly.py @@ -0,0 +1,63 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python streamingpoliciescreatecommon_encryption_cenconly.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.streaming_policies.create( + resource_group_name="contoso", + account_name="contosomedia", + streaming_policy_name="UserCreatedSecureStreamingPolicyWithCommonEncryptionCencOnly", + parameters={ + "properties": { + "commonEncryptionCenc": { + "clearTracks": [ + {"trackSelections": [{"operation": "Equal", "property": "FourCC", "value": "hev1"}]} + ], + "contentKeys": {"defaultKey": {"label": "cencDefaultKey"}}, + "drm": { + "playReady": { + "customLicenseAcquisitionUrlTemplate": "https://contoso.com/{AssetAlternativeId}/playready/{ContentKeyId}", + "playReadyCustomAttributes": "PlayReady CustomAttributes", + }, + "widevine": { + "customLicenseAcquisitionUrlTemplate": "https://contoso.com/{AssetAlternativeId}/widevine/{ContentKeyId" + }, + }, + "enabledProtocols": {"dash": True, "download": False, "hls": False, "smoothStreaming": True}, + }, + "defaultContentKeyPolicyName": "PolicyWithPlayReadyOptionAndOpenRestriction", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-policies-create-commonEncryptionCenc-only.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/streamingpoliciescreateenvelope_encryptiononly.py b/sdk/media/azure-mgmt-media/generated_samples/streamingpoliciescreateenvelope_encryptiononly.py new file mode 100644 index 0000000000000..928db2e048881 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/streamingpoliciescreateenvelope_encryptiononly.py @@ -0,0 +1,52 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python streamingpoliciescreateenvelope_encryptiononly.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.streaming_policies.create( + resource_group_name="contoso", + account_name="contosomedia", + streaming_policy_name="UserCreatedSecureStreamingPolicyWithEnvelopeEncryptionOnly", + parameters={ + "properties": { + "defaultContentKeyPolicyName": "PolicyWithClearKeyOptionAndTokenRestriction", + "envelopeEncryption": { + "contentKeys": {"defaultKey": {"label": "aesDefaultKey"}}, + "customKeyAcquisitionUrlTemplate": "https://contoso.com/{AssetAlternativeId}/envelope/{ContentKeyId}", + "enabledProtocols": {"dash": True, "download": False, "hls": True, "smoothStreaming": True}, + }, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-policies-create-envelopeEncryption-only.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/streamingpoliciescreatesecurestreaming.py b/sdk/media/azure-mgmt-media/generated_samples/streamingpoliciescreatesecurestreaming.py new file mode 100644 index 0000000000000..d903a8f6437b0 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/streamingpoliciescreatesecurestreaming.py @@ -0,0 +1,78 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python streamingpoliciescreatesecurestreaming.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.streaming_policies.create( + resource_group_name="contoso", + account_name="contosomedia", + streaming_policy_name="UserCreatedSecureStreamingPolicy", + parameters={ + "properties": { + "commonEncryptionCbcs": { + "contentKeys": {"defaultKey": {"label": "cbcsDefaultKey"}}, + "drm": { + "fairPlay": { + "allowPersistentLicense": True, + "customLicenseAcquisitionUrlTemplate": "https://contoso.com/{AssetAlternativeId}/fairplay/{ContentKeyId}", + } + }, + "enabledProtocols": {"dash": False, "download": False, "hls": True, "smoothStreaming": False}, + }, + "commonEncryptionCenc": { + "clearTracks": [ + {"trackSelections": [{"operation": "Equal", "property": "FourCC", "value": "hev1"}]} + ], + "contentKeys": {"defaultKey": {"label": "cencDefaultKey"}}, + "drm": { + "playReady": { + "customLicenseAcquisitionUrlTemplate": "https://contoso.com/{AssetAlternativeId}/playready/{ContentKeyId}", + "playReadyCustomAttributes": "PlayReady CustomAttributes", + }, + "widevine": { + "customLicenseAcquisitionUrlTemplate": "https://contoso.com/{AssetAlternativeId}/widevine/{ContentKeyId" + }, + }, + "enabledProtocols": {"dash": True, "download": False, "hls": False, "smoothStreaming": True}, + }, + "defaultContentKeyPolicyName": "PolicyWithMultipleOptions", + "envelopeEncryption": { + "contentKeys": {"defaultKey": {"label": "aesDefaultKey"}}, + "customKeyAcquisitionUrlTemplate": "https://contoso.com/{AssetAlternativeId}/envelope/{ContentKeyId}", + "enabledProtocols": {"dash": True, "download": False, "hls": True, "smoothStreaming": True}, + }, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-policies-create-secure-streaming.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/streamingpoliciesdelete.py b/sdk/media/azure-mgmt-media/generated_samples/streamingpoliciesdelete.py new file mode 100644 index 0000000000000..84fd3b72ec599 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/streamingpoliciesdelete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python streamingpoliciesdelete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.streaming_policies.delete( + resource_group_name="contoso", + account_name="contosomedia", + streaming_policy_name="secureStreamingPolicyWithCommonEncryptionCbcsOnly", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-policies-delete.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/streamingpolicieslist.py b/sdk/media/azure-mgmt-media/generated_samples/streamingpolicieslist.py new file mode 100644 index 0000000000000..245a734d1e6b6 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/streamingpolicieslist.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python streamingpolicieslist.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.streaming_policies.list( + resource_group_name="contoso", + account_name="contosomedia", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-policies-list.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/streamingpolicygetbyname.py b/sdk/media/azure-mgmt-media/generated_samples/streamingpolicygetbyname.py new file mode 100644 index 0000000000000..1fc2b9ad4db27 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/streamingpolicygetbyname.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python streamingpolicygetbyname.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.streaming_policies.get( + resource_group_name="contoso", + account_name="contosomedia", + streaming_policy_name="clearStreamingPolicy", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-policy-get-by-name.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/transformscreate.py b/sdk/media/azure-mgmt-media/generated_samples/transformscreate.py new file mode 100644 index 0000000000000..2cdf8262f5127 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/transformscreate.py @@ -0,0 +1,55 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python transformscreate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.transforms.create_or_update( + resource_group_name="contosoresources", + account_name="contosomedia", + transform_name="createdTransform", + parameters={ + "properties": { + "description": "Example Transform to illustrate create and update.", + "outputs": [ + { + "preset": { + "@odata.type": "#Microsoft.Media.BuiltInStandardEncoderPreset", + "presetName": "AdaptiveStreaming", + } + } + ], + } + }, + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Encoding/stable/2022-07-01/examples/transforms-create.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/transformsdelete.py b/sdk/media/azure-mgmt-media/generated_samples/transformsdelete.py new file mode 100644 index 0000000000000..abc9887ba40a2 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/transformsdelete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python transformsdelete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.transforms.delete( + resource_group_name="contosoresources", + account_name="contosomedia", + transform_name="sampleTransform", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Encoding/stable/2022-07-01/examples/transforms-delete.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/transformsgetbyname.py b/sdk/media/azure-mgmt-media/generated_samples/transformsgetbyname.py new file mode 100644 index 0000000000000..a4f5ea79a1c67 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/transformsgetbyname.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python transformsgetbyname.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.transforms.get( + resource_group_name="contosoresources", + account_name="contosomedia", + transform_name="sampleTransform", + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Encoding/stable/2022-07-01/examples/transforms-get-by-name.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/transformslistall.py b/sdk/media/azure-mgmt-media/generated_samples/transformslistall.py new file mode 100644 index 0000000000000..d32c593adae08 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/transformslistall.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python transformslistall.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.transforms.list( + resource_group_name="contosoresources", + account_name="contosomedia", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Encoding/stable/2022-07-01/examples/transforms-list-all.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/transformslistallfilterbycreated.py b/sdk/media/azure-mgmt-media/generated_samples/transformslistallfilterbycreated.py new file mode 100644 index 0000000000000..f11b598b3404e --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/transformslistallfilterbycreated.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python transformslistallfilterbycreated.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.transforms.list( + resource_group_name="contosoresources", + account_name="contosomedia", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Encoding/stable/2022-07-01/examples/transforms-list-all-filter-by-created.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/transformslistallfilterbylastmodified.py b/sdk/media/azure-mgmt-media/generated_samples/transformslistallfilterbylastmodified.py new file mode 100644 index 0000000000000..eecb8794f8294 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/transformslistallfilterbylastmodified.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python transformslistallfilterbylastmodified.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.transforms.list( + resource_group_name="contosoresources", + account_name="contosomedia", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Encoding/stable/2022-07-01/examples/transforms-list-all-filter-by-lastmodified.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/transformslistallfilterbyname.py b/sdk/media/azure-mgmt-media/generated_samples/transformslistallfilterbyname.py new file mode 100644 index 0000000000000..8d95f329f67d0 --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/transformslistallfilterbyname.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python transformslistallfilterbyname.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.transforms.list( + resource_group_name="contosoresources", + account_name="contosomedia", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Encoding/stable/2022-07-01/examples/transforms-list-all-filter-by-name.json +if __name__ == "__main__": + main() diff --git a/sdk/media/azure-mgmt-media/generated_samples/transformsupdate.py b/sdk/media/azure-mgmt-media/generated_samples/transformsupdate.py new file mode 100644 index 0000000000000..c93a6bcf5e10b --- /dev/null +++ b/sdk/media/azure-mgmt-media/generated_samples/transformsupdate.py @@ -0,0 +1,56 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.media import AzureMediaServices + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-media +# USAGE + python transformsupdate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureMediaServices( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.transforms.update( + resource_group_name="contosoresources", + account_name="contosomedia", + transform_name="transformToUpdate", + parameters={ + "properties": { + "description": "Example transform to illustrate update.", + "outputs": [ + { + "preset": { + "@odata.type": "#Microsoft.Media.BuiltInStandardEncoderPreset", + "presetName": "H264MultipleBitrate720p", + }, + "relativePriority": "High", + } + ], + } + }, + ) + print(response) + + +# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Encoding/stable/2022-07-01/examples/transforms-update.json +if __name__ == "__main__": + main()