diff --git a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/_meta.json b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/_meta.json index 95286a6ee1b0..9b346db94f51 100644 --- a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/_meta.json +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/_meta.json @@ -1,11 +1,11 @@ { - "commit": "e82a24def11ffc98cc263884f9f1742c99f2df5e", + "commit": "5f80797d744cde89c49b85aee1064072f6ff6a06", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.1", + "@autorest/python@6.2.7", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/marketplaceordering/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.1 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/marketplaceordering/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/marketplaceordering/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/__init__.py b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/__init__.py index 877b77e37866..b5e55c4b3a71 100644 --- a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/__init__.py +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/__init__.py @@ -13,7 +13,7 @@ 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 diff --git a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/_configuration.py b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/_configuration.py index 7ed3eaff1c36..bb05b2ceb583 100644 --- a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/_configuration.py +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/_configuration.py @@ -42,7 +42,7 @@ class MarketplaceOrderingAgreementsConfiguration(Configuration): # pylint: disa def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(MarketplaceOrderingAgreementsConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-01-01") # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", "2021-01-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-marketplaceordering/{}".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/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/_marketplace_ordering_agreements.py b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/_marketplace_ordering_agreements.py index c060d4e61b57..636120a464c0 100644 --- a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/_marketplace_ordering_agreements.py +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/_marketplace_ordering_agreements.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 MarketplaceOrderingAgreementsConfiguration from ._serialization import Deserializer, Serializer from .operations import MarketplaceAgreementsOperations, Operations @@ -53,7 +53,7 @@ def __init__( ) 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 @@ -84,15 +84,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: () -> MarketplaceOrderingAgreements + def __enter__(self) -> "MarketplaceOrderingAgreements": 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/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/_serialization.py b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/_serialization.py index 7c1dedb5133d..2c170e28dbca 100644 --- a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/_serialization.py +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/_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/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/_version.py b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/_version.py index 58920e6942de..e5754a47ce68 100644 --- a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/_version.py +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.2.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/__init__.py b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/__init__.py index e7391119d9d9..a4e2a79ca2e0 100644 --- a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/__init__.py +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/__init__.py @@ -10,7 +10,7 @@ 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 diff --git a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/_configuration.py b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/_configuration.py index 2c8e1541b9a7..c51b70b4f5c5 100644 --- a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/_configuration.py +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/_configuration.py @@ -42,7 +42,7 @@ class MarketplaceOrderingAgreementsConfiguration(Configuration): # pylint: disa def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(MarketplaceOrderingAgreementsConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-01-01") # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", "2021-01-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/_marketplace_ordering_agreements.py b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/_marketplace_ordering_agreements.py index 9045b92ef493..cd7a16b68987 100644 --- a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/_marketplace_ordering_agreements.py +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/_marketplace_ordering_agreements.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 MarketplaceOrderingAgreementsConfiguration from .operations import MarketplaceAgreementsOperations, Operations @@ -53,7 +53,7 @@ def __init__( ) 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/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/operations/__init__.py b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/operations/__init__.py index b36a228c2f8d..64839b431b29 100644 --- a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/operations/__init__.py +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/operations/__init__.py @@ -10,7 +10,7 @@ from ._operations import Operations 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/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/operations/_marketplace_agreements_operations.py b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/operations/_marketplace_agreements_operations.py index 6902564f30ab..7fa902289212 100644 --- a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/operations/_marketplace_agreements_operations.py +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/operations/_marketplace_agreements_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -93,10 +93,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AgreementTerms] + ) + cls: ClsType[_models.AgreementTerms] = kwargs.pop("cls", None) request = build_get_request( offer_type=offer_type, @@ -110,9 +110,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 ) @@ -130,7 +130,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.MarketplaceOrdering/offerTypes/{offerType}/publishers/{publisherId}/offers/{offerId}/plans/{planId}/agreements/current"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MarketplaceOrdering/offerTypes/{offerType}/publishers/{publisherId}/offers/{offerId}/plans/{planId}/agreements/current" + } @overload async def create( @@ -243,11 +245,11 @@ 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: Literal["2021-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AgreementTerms] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AgreementTerms] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -272,9 +274,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 ) @@ -292,10 +294,12 @@ async def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.MarketplaceOrdering/offerTypes/{offerType}/publishers/{publisherId}/offers/{offerId}/plans/{planId}/agreements/current"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MarketplaceOrdering/offerTypes/{offerType}/publishers/{publisherId}/offers/{offerId}/plans/{planId}/agreements/current" + } @distributed_trace_async - async def sign(self, publisher_id: str, offer_id: str, plan_id: str, **kwargs: Any) -> _models.AgreementTerms: + async def sign(self, publisher_id: str, offer_id: str, plan_id: str, **kwargs: Any) -> _models.OldAgreementTerms: """Sign marketplace terms. :param publisher_id: Publisher identifier string of image being deployed. Required. @@ -305,8 +309,8 @@ async def sign(self, publisher_id: str, offer_id: str, plan_id: str, **kwargs: A :param plan_id: Plan identifier string of image being deployed. Required. :type plan_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgreementTerms or the result of cls(response) - :rtype: ~azure.mgmt.marketplaceordering.models.AgreementTerms + :return: OldAgreementTerms or the result of cls(response) + :rtype: ~azure.mgmt.marketplaceordering.models.OldAgreementTerms :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -320,10 +324,10 @@ async def sign(self, publisher_id: str, offer_id: str, plan_id: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AgreementTerms] + ) + cls: ClsType[_models.OldAgreementTerms] = kwargs.pop("cls", None) request = build_sign_request( publisher_id=publisher_id, @@ -336,9 +340,9 @@ async def sign(self, publisher_id: str, offer_id: str, plan_id: str, **kwargs: A 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 ) @@ -349,17 +353,19 @@ async def sign(self, publisher_id: str, offer_id: str, plan_id: str, **kwargs: A error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AgreementTerms", pipeline_response) + deserialized = self._deserialize("OldAgreementTerms", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - sign.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.MarketplaceOrdering/agreements/{publisherId}/offers/{offerId}/plans/{planId}/sign"} # type: ignore + sign.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MarketplaceOrdering/agreements/{publisherId}/offers/{offerId}/plans/{planId}/sign" + } @distributed_trace_async - async def cancel(self, publisher_id: str, offer_id: str, plan_id: str, **kwargs: Any) -> _models.AgreementTerms: + async def cancel(self, publisher_id: str, offer_id: str, plan_id: str, **kwargs: Any) -> _models.OldAgreementTerms: """Cancel marketplace terms. :param publisher_id: Publisher identifier string of image being deployed. Required. @@ -369,8 +375,8 @@ async def cancel(self, publisher_id: str, offer_id: str, plan_id: str, **kwargs: :param plan_id: Plan identifier string of image being deployed. Required. :type plan_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgreementTerms or the result of cls(response) - :rtype: ~azure.mgmt.marketplaceordering.models.AgreementTerms + :return: OldAgreementTerms or the result of cls(response) + :rtype: ~azure.mgmt.marketplaceordering.models.OldAgreementTerms :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -384,10 +390,10 @@ async def cancel(self, publisher_id: str, offer_id: str, plan_id: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AgreementTerms] + ) + cls: ClsType[_models.OldAgreementTerms] = kwargs.pop("cls", None) request = build_cancel_request( publisher_id=publisher_id, @@ -400,9 +406,9 @@ async def cancel(self, publisher_id: str, offer_id: str, plan_id: 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 = 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 ) @@ -413,19 +419,21 @@ async def cancel(self, publisher_id: str, offer_id: str, plan_id: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AgreementTerms", pipeline_response) + deserialized = self._deserialize("OldAgreementTerms", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - cancel.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.MarketplaceOrdering/agreements/{publisherId}/offers/{offerId}/plans/{planId}/cancel"} # type: ignore + cancel.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MarketplaceOrdering/agreements/{publisherId}/offers/{offerId}/plans/{planId}/cancel" + } @distributed_trace_async async def get_agreement( self, publisher_id: str, offer_id: str, plan_id: str, **kwargs: Any - ) -> _models.AgreementTerms: + ) -> _models.OldAgreementTerms: """Get marketplace agreement. :param publisher_id: Publisher identifier string of image being deployed. Required. @@ -435,8 +443,8 @@ async def get_agreement( :param plan_id: Plan identifier string of image being deployed. Required. :type plan_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgreementTerms or the result of cls(response) - :rtype: ~azure.mgmt.marketplaceordering.models.AgreementTerms + :return: OldAgreementTerms or the result of cls(response) + :rtype: ~azure.mgmt.marketplaceordering.models.OldAgreementTerms :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -450,10 +458,10 @@ async def get_agreement( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AgreementTerms] + ) + cls: ClsType[_models.OldAgreementTerms] = kwargs.pop("cls", None) request = build_get_agreement_request( publisher_id=publisher_id, @@ -466,9 +474,9 @@ async def get_agreement( 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 ) @@ -479,22 +487,24 @@ async def get_agreement( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AgreementTerms", pipeline_response) + deserialized = self._deserialize("OldAgreementTerms", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_agreement.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.MarketplaceOrdering/agreements/{publisherId}/offers/{offerId}/plans/{planId}"} # type: ignore + get_agreement.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MarketplaceOrdering/agreements/{publisherId}/offers/{offerId}/plans/{planId}" + } @distributed_trace_async - async def list(self, **kwargs: Any) -> List[_models.AgreementTerms]: + async def list(self, **kwargs: Any) -> _models.OldAgreementTermsList: """List marketplace agreements in the subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of AgreementTerms or the result of cls(response) - :rtype: list[~azure.mgmt.marketplaceordering.models.AgreementTerms] + :return: OldAgreementTermsList or the result of cls(response) + :rtype: ~azure.mgmt.marketplaceordering.models.OldAgreementTermsList :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -508,10 +518,10 @@ async def list(self, **kwargs: Any) -> List[_models.AgreementTerms]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.AgreementTerms]] + ) + cls: ClsType[_models.OldAgreementTermsList] = kwargs.pop("cls", None) request = build_list_request( subscription_id=self._config.subscription_id, @@ -521,9 +531,9 @@ async def list(self, **kwargs: Any) -> List[_models.AgreementTerms]: 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 ) @@ -534,11 +544,11 @@ async def list(self, **kwargs: Any) -> List[_models.AgreementTerms]: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[AgreementTerms]", pipeline_response) + deserialized = self._deserialize("OldAgreementTermsList", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.MarketplaceOrdering/agreements"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.MarketplaceOrdering/agreements"} diff --git a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/operations/_operations.py b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/operations/_operations.py index ee4f6788af41..bb838f873bf9 100644 --- a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/operations/_operations.py +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/operations/_operations.py @@ -70,10 +70,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -93,7 +93,7 @@ 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: # make call to next link with the client's api-version @@ -109,7 +109,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) 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 @@ -117,13 +117,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # 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 @@ -137,4 +137,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.MarketplaceOrdering/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.MarketplaceOrdering/operations"} diff --git a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/models/__init__.py b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/models/__init__.py index cd71d25b3ad3..e11412054100 100644 --- a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/models/__init__.py +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/models/__init__.py @@ -9,6 +9,8 @@ from ._models_py3 import AgreementTerms from ._models_py3 import ErrorResponse from ._models_py3 import ErrorResponseError +from ._models_py3 import OldAgreementTerms +from ._models_py3 import OldAgreementTermsList from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import OperationListResult @@ -17,14 +19,17 @@ from ._marketplace_ordering_agreements_enums import CreatedByType from ._marketplace_ordering_agreements_enums import OfferType +from ._marketplace_ordering_agreements_enums import State 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__ = [ "AgreementTerms", "ErrorResponse", "ErrorResponseError", + "OldAgreementTerms", + "OldAgreementTermsList", "Operation", "OperationDisplay", "OperationListResult", @@ -32,6 +37,7 @@ "SystemData", "CreatedByType", "OfferType", + "State", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/models/_marketplace_ordering_agreements_enums.py b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/models/_marketplace_ordering_agreements_enums.py index 5e3c8d9aff0f..2a6d56ed1f8c 100644 --- a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/models/_marketplace_ordering_agreements_enums.py +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/models/_marketplace_ordering_agreements_enums.py @@ -23,3 +23,10 @@ class OfferType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OfferType.""" VIRTUALMACHINE = "virtualmachine" + + +class State(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Whether the agreement is active or cancelled.""" + + ACTIVE = "Active" + CANCELED = "Canceled" diff --git a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/models/_models_py3.py b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/models/_models_py3.py index c804b3e09e11..0ece981ae184 100644 --- a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/models/_models_py3.py +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/models/_models_py3.py @@ -203,6 +203,109 @@ def __init__(self, **kwargs): self.message = None +class OldAgreementTerms(Resource): + """Terms properties for provided Publisher/Offer/Plan tuple. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar id_properties_id: A unique identifier of the agreement. + :vartype id_properties_id: str + :ivar publisher: Publisher identifier string of image being deployed. + :vartype publisher: str + :ivar offer: Offer identifier string of image being deployed. + :vartype offer: str + :ivar sign_date: Date and time in UTC of when the terms were accepted. This is empty if state + is cancelled. + :vartype sign_date: ~datetime.datetime + :ivar cancel_date: Date and time in UTC of when the terms were cancelled. This is empty if + state is active. + :vartype cancel_date: ~datetime.datetime + :ivar state: Whether the agreement is active or cancelled. Known values are: "Active" and + "Canceled". + :vartype state: str or ~azure.mgmt.marketplaceordering.models.State + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "id_properties_id": {"key": "properties.id", "type": "str"}, + "publisher": {"key": "properties.publisher", "type": "str"}, + "offer": {"key": "properties.offer", "type": "str"}, + "sign_date": {"key": "properties.signDate", "type": "iso-8601"}, + "cancel_date": {"key": "properties.cancelDate", "type": "iso-8601"}, + "state": {"key": "properties.state", "type": "str"}, + } + + def __init__( + self, + *, + id_properties_id: Optional[str] = None, + publisher: Optional[str] = None, + offer: Optional[str] = None, + sign_date: Optional[datetime.datetime] = None, + cancel_date: Optional[datetime.datetime] = None, + state: Optional[Union[str, "_models.State"]] = None, + **kwargs + ): + """ + :keyword id_properties_id: A unique identifier of the agreement. + :paramtype id_properties_id: str + :keyword publisher: Publisher identifier string of image being deployed. + :paramtype publisher: str + :keyword offer: Offer identifier string of image being deployed. + :paramtype offer: str + :keyword sign_date: Date and time in UTC of when the terms were accepted. This is empty if + state is cancelled. + :paramtype sign_date: ~datetime.datetime + :keyword cancel_date: Date and time in UTC of when the terms were cancelled. This is empty if + state is active. + :paramtype cancel_date: ~datetime.datetime + :keyword state: Whether the agreement is active or cancelled. Known values are: "Active" and + "Canceled". + :paramtype state: str or ~azure.mgmt.marketplaceordering.models.State + """ + super().__init__(**kwargs) + self.id_properties_id = id_properties_id + self.publisher = publisher + self.offer = offer + self.sign_date = sign_date + self.cancel_date = cancel_date + self.state = state + + +class OldAgreementTermsList(_serialization.Model): + """Agreement Terms definition list. + + :ivar value: + :vartype value: list[~azure.mgmt.marketplaceordering.models.OldAgreementTerms] + """ + + _attribute_map = { + "value": {"key": "value", "type": "[OldAgreementTerms]"}, + } + + def __init__(self, *, value: Optional[List["_models.OldAgreementTerms"]] = None, **kwargs): + """ + :keyword value: + :paramtype value: list[~azure.mgmt.marketplaceordering.models.OldAgreementTerms] + """ + super().__init__(**kwargs) + self.value = value + + class Operation(_serialization.Model): """Microsoft.MarketplaceOrdering REST API operation. diff --git a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/operations/__init__.py b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/operations/__init__.py index b36a228c2f8d..64839b431b29 100644 --- a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/operations/__init__.py +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/operations/__init__.py @@ -10,7 +10,7 @@ from ._operations import Operations 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/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/operations/_marketplace_agreements_operations.py b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/operations/_marketplace_agreements_operations.py index 7a220aa0b009..e1cb35116928 100644 --- a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/operations/_marketplace_agreements_operations.py +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/operations/_marketplace_agreements_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -50,7 +50,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-01-01")) # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +66,7 @@ def build_get_request( "planId": _SERIALIZER.url("plan_id", plan_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") @@ -88,8 +88,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-01-01")) # type: Literal["2021-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -105,7 +105,7 @@ def build_create_request( "planId": _SERIALIZER.url("plan_id", plan_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") @@ -124,7 +124,7 @@ def build_sign_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-01-01")) # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -139,7 +139,7 @@ def build_sign_request( "planId": _SERIALIZER.url("plan_id", plan_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") @@ -156,7 +156,7 @@ def build_cancel_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-01-01")) # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -171,7 +171,7 @@ def build_cancel_request( "planId": _SERIALIZER.url("plan_id", plan_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") @@ -188,7 +188,7 @@ def build_get_agreement_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-01-01")) # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -203,7 +203,7 @@ def build_get_agreement_request( "planId": _SERIALIZER.url("plan_id", plan_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") @@ -218,7 +218,7 @@ def build_list_request(subscription_id: str, **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-01-01")) # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -229,7 +229,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "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") @@ -290,10 +290,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AgreementTerms] + ) + cls: ClsType[_models.AgreementTerms] = kwargs.pop("cls", None) request = build_get_request( offer_type=offer_type, @@ -307,9 +307,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 ) @@ -327,7 +327,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.MarketplaceOrdering/offerTypes/{offerType}/publishers/{publisherId}/offers/{offerId}/plans/{planId}/agreements/current"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MarketplaceOrdering/offerTypes/{offerType}/publishers/{publisherId}/offers/{offerId}/plans/{planId}/agreements/current" + } @overload def create( @@ -440,11 +442,11 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-01-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AgreementTerms] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AgreementTerms] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -469,9 +471,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 ) @@ -489,10 +491,12 @@ def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.MarketplaceOrdering/offerTypes/{offerType}/publishers/{publisherId}/offers/{offerId}/plans/{planId}/agreements/current"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MarketplaceOrdering/offerTypes/{offerType}/publishers/{publisherId}/offers/{offerId}/plans/{planId}/agreements/current" + } @distributed_trace - def sign(self, publisher_id: str, offer_id: str, plan_id: str, **kwargs: Any) -> _models.AgreementTerms: + def sign(self, publisher_id: str, offer_id: str, plan_id: str, **kwargs: Any) -> _models.OldAgreementTerms: """Sign marketplace terms. :param publisher_id: Publisher identifier string of image being deployed. Required. @@ -502,8 +506,8 @@ def sign(self, publisher_id: str, offer_id: str, plan_id: str, **kwargs: Any) -> :param plan_id: Plan identifier string of image being deployed. Required. :type plan_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgreementTerms or the result of cls(response) - :rtype: ~azure.mgmt.marketplaceordering.models.AgreementTerms + :return: OldAgreementTerms or the result of cls(response) + :rtype: ~azure.mgmt.marketplaceordering.models.OldAgreementTerms :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -517,10 +521,10 @@ def sign(self, publisher_id: str, offer_id: str, plan_id: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AgreementTerms] + ) + cls: ClsType[_models.OldAgreementTerms] = kwargs.pop("cls", None) request = build_sign_request( publisher_id=publisher_id, @@ -533,9 +537,9 @@ def sign(self, publisher_id: str, offer_id: str, plan_id: 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 = 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 ) @@ -546,17 +550,19 @@ def sign(self, publisher_id: str, offer_id: str, plan_id: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AgreementTerms", pipeline_response) + deserialized = self._deserialize("OldAgreementTerms", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - sign.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.MarketplaceOrdering/agreements/{publisherId}/offers/{offerId}/plans/{planId}/sign"} # type: ignore + sign.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MarketplaceOrdering/agreements/{publisherId}/offers/{offerId}/plans/{planId}/sign" + } @distributed_trace - def cancel(self, publisher_id: str, offer_id: str, plan_id: str, **kwargs: Any) -> _models.AgreementTerms: + def cancel(self, publisher_id: str, offer_id: str, plan_id: str, **kwargs: Any) -> _models.OldAgreementTerms: """Cancel marketplace terms. :param publisher_id: Publisher identifier string of image being deployed. Required. @@ -566,8 +572,8 @@ def cancel(self, publisher_id: str, offer_id: str, plan_id: str, **kwargs: Any) :param plan_id: Plan identifier string of image being deployed. Required. :type plan_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgreementTerms or the result of cls(response) - :rtype: ~azure.mgmt.marketplaceordering.models.AgreementTerms + :return: OldAgreementTerms or the result of cls(response) + :rtype: ~azure.mgmt.marketplaceordering.models.OldAgreementTerms :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -581,10 +587,10 @@ def cancel(self, publisher_id: str, offer_id: str, plan_id: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AgreementTerms] + ) + cls: ClsType[_models.OldAgreementTerms] = kwargs.pop("cls", None) request = build_cancel_request( publisher_id=publisher_id, @@ -597,9 +603,9 @@ def cancel(self, publisher_id: str, offer_id: str, plan_id: 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 = 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,17 +616,19 @@ def cancel(self, publisher_id: str, offer_id: str, plan_id: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AgreementTerms", pipeline_response) + deserialized = self._deserialize("OldAgreementTerms", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - cancel.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.MarketplaceOrdering/agreements/{publisherId}/offers/{offerId}/plans/{planId}/cancel"} # type: ignore + cancel.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MarketplaceOrdering/agreements/{publisherId}/offers/{offerId}/plans/{planId}/cancel" + } @distributed_trace - def get_agreement(self, publisher_id: str, offer_id: str, plan_id: str, **kwargs: Any) -> _models.AgreementTerms: + def get_agreement(self, publisher_id: str, offer_id: str, plan_id: str, **kwargs: Any) -> _models.OldAgreementTerms: """Get marketplace agreement. :param publisher_id: Publisher identifier string of image being deployed. Required. @@ -630,8 +638,8 @@ def get_agreement(self, publisher_id: str, offer_id: str, plan_id: str, **kwargs :param plan_id: Plan identifier string of image being deployed. Required. :type plan_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgreementTerms or the result of cls(response) - :rtype: ~azure.mgmt.marketplaceordering.models.AgreementTerms + :return: OldAgreementTerms or the result of cls(response) + :rtype: ~azure.mgmt.marketplaceordering.models.OldAgreementTerms :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -645,10 +653,10 @@ def get_agreement(self, publisher_id: str, offer_id: str, plan_id: str, **kwargs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AgreementTerms] + ) + cls: ClsType[_models.OldAgreementTerms] = kwargs.pop("cls", None) request = build_get_agreement_request( publisher_id=publisher_id, @@ -661,9 +669,9 @@ def get_agreement(self, publisher_id: str, offer_id: str, plan_id: 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 ) @@ -674,22 +682,24 @@ def get_agreement(self, publisher_id: str, offer_id: str, plan_id: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AgreementTerms", pipeline_response) + deserialized = self._deserialize("OldAgreementTerms", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_agreement.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.MarketplaceOrdering/agreements/{publisherId}/offers/{offerId}/plans/{planId}"} # type: ignore + get_agreement.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MarketplaceOrdering/agreements/{publisherId}/offers/{offerId}/plans/{planId}" + } @distributed_trace - def list(self, **kwargs: Any) -> List[_models.AgreementTerms]: + def list(self, **kwargs: Any) -> _models.OldAgreementTermsList: """List marketplace agreements in the subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of AgreementTerms or the result of cls(response) - :rtype: list[~azure.mgmt.marketplaceordering.models.AgreementTerms] + :return: OldAgreementTermsList or the result of cls(response) + :rtype: ~azure.mgmt.marketplaceordering.models.OldAgreementTermsList :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -703,10 +713,10 @@ def list(self, **kwargs: Any) -> List[_models.AgreementTerms]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.AgreementTerms]] + ) + cls: ClsType[_models.OldAgreementTermsList] = kwargs.pop("cls", None) request = build_list_request( subscription_id=self._config.subscription_id, @@ -716,9 +726,9 @@ def list(self, **kwargs: Any) -> List[_models.AgreementTerms]: 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 ) @@ -729,11 +739,11 @@ def list(self, **kwargs: Any) -> List[_models.AgreementTerms]: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[AgreementTerms]", pipeline_response) + deserialized = self._deserialize("OldAgreementTermsList", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.MarketplaceOrdering/agreements"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.MarketplaceOrdering/agreements"} diff --git a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/operations/_operations.py b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/operations/_operations.py index a3134bd644cc..3942bcc649c4 100644 --- a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/operations/_operations.py +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/operations/_operations.py @@ -45,7 +45,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-01-01")) # type: Literal["2021-01-01"] + api_version: Literal["2021-01-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,10 +91,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2021-01-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2021-01-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -114,7 +114,7 @@ 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: # make call to next link with the client's api-version @@ -130,7 +130,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) 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 @@ -138,13 +138,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # 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 @@ -158,4 +158,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.MarketplaceOrdering/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.MarketplaceOrdering/operations"} diff --git a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/generated_samples/cancel_marketplace_terms.py b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/generated_samples/cancel_marketplace_terms.py new file mode 100644 index 000000000000..0fb64ce4fbcf --- /dev/null +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/generated_samples/cancel_marketplace_terms.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.marketplaceordering import MarketplaceOrderingAgreements + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-marketplaceordering +# USAGE + python cancel_marketplace_terms.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 = MarketplaceOrderingAgreements( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.marketplace_agreements.cancel( + publisher_id="pubid", + offer_id="offid", + plan_id="planid", + ) + print(response) + + +# x-ms-original-file: specification/marketplaceordering/resource-manager/Microsoft.MarketplaceOrdering/stable/2021-01-01/examples/CancelMarketplaceTerms.json +if __name__ == "__main__": + main() diff --git a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/generated_samples/get_agreement_marketplace_terms.py b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/generated_samples/get_agreement_marketplace_terms.py new file mode 100644 index 000000000000..e1188e11b543 --- /dev/null +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/generated_samples/get_agreement_marketplace_terms.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.marketplaceordering import MarketplaceOrderingAgreements + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-marketplaceordering +# USAGE + python get_agreement_marketplace_terms.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 = MarketplaceOrderingAgreements( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.marketplace_agreements.get_agreement( + publisher_id="pubid", + offer_id="offid", + plan_id="planid", + ) + print(response) + + +# x-ms-original-file: specification/marketplaceordering/resource-manager/Microsoft.MarketplaceOrdering/stable/2021-01-01/examples/GetAgreementMarketplaceTerms.json +if __name__ == "__main__": + main() diff --git a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/generated_samples/list_operations.py b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/generated_samples/operations_list.py similarity index 98% rename from sdk/marketplaceordering/azure-mgmt-marketplaceordering/generated_samples/list_operations.py rename to sdk/marketplaceordering/azure-mgmt-marketplaceordering/generated_samples/operations_list.py index 0f9e5151495e..85d1de6d7aba 100644 --- a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/generated_samples/list_operations.py +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/generated_samples/operations_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-marketplaceordering # USAGE - python list_operations.py + python operations_list.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, diff --git a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/generated_samples/sign_marketplace_terms.py b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/generated_samples/sign_marketplace_terms.py new file mode 100644 index 000000000000..38ee845c46a5 --- /dev/null +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/generated_samples/sign_marketplace_terms.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.marketplaceordering import MarketplaceOrderingAgreements + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-marketplaceordering +# USAGE + python sign_marketplace_terms.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 = MarketplaceOrderingAgreements( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.marketplace_agreements.sign( + publisher_id="pubid", + offer_id="offid", + plan_id="planid", + ) + print(response) + + +# x-ms-original-file: specification/marketplaceordering/resource-manager/Microsoft.MarketplaceOrdering/stable/2021-01-01/examples/SignMarketplaceTerms.json +if __name__ == "__main__": + main()