diff --git a/sdk/sphere/azure-mgmt-sphere/CHANGELOG.md b/sdk/sphere/azure-mgmt-sphere/CHANGELOG.md index dc0eb96c8351..730dc7449d83 100644 --- a/sdk/sphere/azure-mgmt-sphere/CHANGELOG.md +++ b/sdk/sphere/azure-mgmt-sphere/CHANGELOG.md @@ -1,5 +1,68 @@ # Release History +## 1.0.0 (2024-03-26) + +### Features Added + + - Added operation CatalogsOperations.begin_upload_image + - Model Catalog has a new parameter properties + - Model Certificate has a new parameter properties + - Model Deployment has a new parameter properties + - Model Device has a new parameter properties + - Model DeviceGroup has a new parameter properties + - Model DeviceGroupUpdate has a new parameter properties + - Model DeviceUpdate has a new parameter properties + - Model Image has a new parameter properties + - Model Product has a new parameter properties + - Model ProductUpdate has a new parameter properties + +### Breaking Changes + + - Model Catalog no longer has parameter provisioning_state + - Model Certificate no longer has parameter certificate + - Model Certificate no longer has parameter expiry_utc + - Model Certificate no longer has parameter not_before_utc + - Model Certificate no longer has parameter provisioning_state + - Model Certificate no longer has parameter status + - Model Certificate no longer has parameter subject + - Model Certificate no longer has parameter thumbprint + - Model Deployment no longer has parameter deployed_images + - Model Deployment no longer has parameter deployment_date_utc + - Model Deployment no longer has parameter deployment_id + - Model Deployment no longer has parameter provisioning_state + - Model Device no longer has parameter chip_sku + - Model Device no longer has parameter device_id + - Model Device no longer has parameter last_available_os_version + - Model Device no longer has parameter last_installed_os_version + - Model Device no longer has parameter last_os_update_utc + - Model Device no longer has parameter last_update_request_utc + - Model Device no longer has parameter provisioning_state + - Model DeviceGroup no longer has parameter allow_crash_dumps_collection + - Model DeviceGroup no longer has parameter description + - Model DeviceGroup no longer has parameter has_deployment + - Model DeviceGroup no longer has parameter os_feed_type + - Model DeviceGroup no longer has parameter provisioning_state + - Model DeviceGroup no longer has parameter regional_data_boundary + - Model DeviceGroup no longer has parameter update_policy + - Model DeviceGroupUpdate no longer has parameter allow_crash_dumps_collection + - Model DeviceGroupUpdate no longer has parameter description + - Model DeviceGroupUpdate no longer has parameter os_feed_type + - Model DeviceGroupUpdate no longer has parameter regional_data_boundary + - Model DeviceGroupUpdate no longer has parameter update_policy + - Model DeviceUpdate no longer has parameter device_group_id + - Model Image no longer has parameter component_id + - Model Image no longer has parameter description + - Model Image no longer has parameter image + - Model Image no longer has parameter image_id + - Model Image no longer has parameter image_name + - Model Image no longer has parameter image_type + - Model Image no longer has parameter provisioning_state + - Model Image no longer has parameter regional_data_boundary + - Model Image no longer has parameter uri + - Model Product no longer has parameter description + - Model Product no longer has parameter provisioning_state + - Model ProductUpdate no longer has parameter description + ## 1.0.0b1 (2023-07-21) * Initial Release diff --git a/sdk/sphere/azure-mgmt-sphere/README.md b/sdk/sphere/azure-mgmt-sphere/README.md index c02358046a36..d9beb577aba9 100644 --- a/sdk/sphere/azure-mgmt-sphere/README.md +++ b/sdk/sphere/azure-mgmt-sphere/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Sphere Management Client Library. -This package has been tested with Python 3.7+. +This package has been tested with Python 3.8+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.7+ is required to use this package. +- Python 3.8+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package @@ -59,6 +59,3 @@ Code samples for this package can be found at: If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) section of the project. - - -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-sphere%2FREADME.png) diff --git a/sdk/sphere/azure-mgmt-sphere/_meta.json b/sdk/sphere/azure-mgmt-sphere/_meta.json index 12fac62b6d69..eddc790ba776 100644 --- a/sdk/sphere/azure-mgmt-sphere/_meta.json +++ b/sdk/sphere/azure-mgmt-sphere/_meta.json @@ -1,11 +1,11 @@ { - "commit": "23d88533ddfde4d1565a897fe95d42fb0d9333e5", + "commit": "09c37754dac91874ff689ed1e60effb4268c8669", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.6", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.6.0", - "@autorest/modelerfour@4.26.2" + "@autorest/python@6.13.7", + "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/sphere/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.6.0 --use=@autorest/modelerfour@4.26.2 --version=3.9.6 --version-tolerant=False", + "autorest_command": "autorest specification/sphere/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.13.7 --use=@autorest/modelerfour@4.27.0 --version=3.9.7 --version-tolerant=False", "readme": "specification/sphere/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/sphere/azure-mgmt-sphere/assets.json b/sdk/sphere/azure-mgmt-sphere/assets.json index 79c3c2f6bb70..0fb81f7f4518 100644 --- a/sdk/sphere/azure-mgmt-sphere/assets.json +++ b/sdk/sphere/azure-mgmt-sphere/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/sphere/azure-mgmt-sphere", - "Tag": "python/sphere/azure-mgmt-sphere_180c756981" + "Tag": "python/sphere/azure-mgmt-sphere_20733529ee" } diff --git a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/_azure_sphere_mgmt_client.py b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/_azure_sphere_mgmt_client.py index cca0bdfda955..91f4eac30524 100644 --- a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/_azure_sphere_mgmt_client.py +++ b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/_azure_sphere_mgmt_client.py @@ -9,8 +9,10 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy from . import models as _models from ._configuration import AzureSphereMgmtClientConfiguration @@ -56,8 +58,8 @@ class AzureSphereMgmtClient: # pylint: disable=client-accepts-api-version-keywo :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -73,7 +75,25 @@ def __init__( self._config = AzureSphereMgmtClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -88,7 +108,7 @@ def __init__( self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -108,7 +128,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: self._client.close() diff --git a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/_configuration.py b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/_configuration.py index f69a9e96e3ad..1310dcc89a5c 100644 --- a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/_configuration.py +++ b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/_configuration.py @@ -8,7 +8,6 @@ from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy @@ -19,7 +18,7 @@ from azure.core.credentials import TokenCredential -class AzureSphereMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class AzureSphereMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for AzureSphereMgmtClient. Note that all parameters used to create this instance are saved as instance @@ -29,14 +28,13 @@ class AzureSphereMgmtClientConfiguration(Configuration): # pylint: disable=too- :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(AzureSphereMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2022-09-01-preview") + api_version: str = kwargs.pop("api_version", "2024-04-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -48,6 +46,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-sphere/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = ARMChallengeAuthenticationPolicy( diff --git a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/_serialization.py b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/_serialization.py index 842ae727fbbc..2f781d740827 100644 --- a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/_serialization.py +++ b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/_serialization.py @@ -63,8 +63,8 @@ import isodate # type: ignore -from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback -from azure.core.serialization import NULL as AzureCoreNull +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") @@ -124,7 +124,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: pass return ET.fromstring(data_as_str) # nosec - except ET.ParseError: + except ET.ParseError as err: # It might be because the server has an issue, and returned JSON with # content-type XML.... # So let's try a JSON load, and if it's still broken @@ -143,7 +143,7 @@ def _json_attemp(data): # The function hack is because Py2.7 messes up with exception # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") - raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("XML is invalid") from err raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -170,13 +170,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -295,7 +288,7 @@ class Model(object): _validation: Dict[str, Dict[str, Any]] = {} def __init__(self, **kwargs: Any) -> None: - self.additional_properties: Dict[str, Any] = {} + self.additional_properties: Optional[Dict[str, Any]] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -340,7 +333,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to azure from this model. + """Return the JSON that would be sent to server from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -351,7 +344,7 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore def as_dict( self, @@ -390,7 +383,7 @@ def my_key_transformer(key, attr_desc, value): :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore @classmethod def _infer_class_models(cls): @@ -415,7 +408,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( @@ -445,7 +438,7 @@ def from_dict( if key_extractors is None else key_extractors ) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def _flatten_subtype(cls, key, objects): @@ -545,7 +538,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -561,7 +554,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -649,7 +642,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): 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) + local_node.text = str(new_attr) serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore @@ -662,12 +655,13 @@ def _serialize(self, target_obj, data_type=None, **kwargs): _serialized.update(_new_attr) # type: ignore _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] - except ValueError: - continue + except ValueError as err: + if isinstance(err, SerializationError): + raise except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err else: return serialized @@ -709,7 +703,7 @@ def body(self, data, data_type, **kwargs): ] data = deserializer._deserialize(data_type, data) except DeserializationError as err: - raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + raise SerializationError("Unable to build a model: " + str(err)) from err return self._serialize(data, data_type, **kwargs) @@ -729,6 +723,7 @@ def url(self, name, data, data_type, **kwargs): if kwargs.get("skip_quote") is True: output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") except SerializationError: @@ -741,7 +736,9 @@ def query(self, name, data, data_type, **kwargs): :param data: The data to be serialized. :param str data_type: The type to be serialized from. - :rtype: str + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. + :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -749,10 +746,8 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] - if not kwargs.get("skip_quote", False): - data = [quote(str(d), safe="") for d in data] - return str(self.serialize_iter(data, internal_data_type, **kwargs)) + do_quote = not kwargs.get("skip_quote", False) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -803,7 +798,7 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: - if data is AzureCoreNull: + if data is CoreNull: return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -823,7 +818,7 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback(SerializationError, msg.format(data, data_type), err) + raise SerializationError(msg.format(data, data_type)) from err else: return self._serialize(data, **kwargs) @@ -891,6 +886,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. + :keyword bool do_quote: Whether to quote the serialized result of each iterable element. + Defaults to False. :rtype: list, str """ if isinstance(data, str): @@ -903,9 +900,14 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): for d in data: try: serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized.append(None) + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + if div: serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) @@ -950,7 +952,9 @@ def serialize_dict(self, attr, dict_type, **kwargs): for key, value in attr.items(): try: serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized[self.serialize_unicode(key)] = None if "xml" in serialization_ctxt: @@ -983,7 +987,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) if obj_type is _long_type: return self.serialize_long(attr) - if obj_type is unicode_str: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1160,10 +1164,10 @@ def serialize_iso(attr, **kwargs): return date + microseconds + "Z" except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err except AttributeError as err: msg = "ISO-8601 object must be valid Datetime object." - raise_with_traceback(TypeError, msg, err) + raise TypeError(msg) from err @staticmethod def serialize_unix(attr, **kwargs): @@ -1199,7 +1203,6 @@ def rest_key_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1220,7 +1223,6 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1361,7 +1363,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1381,7 +1383,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1434,7 +1436,7 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) @@ -1471,7 +1473,7 @@ def _deserialize(self, target_obj, data): d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: additional_properties = self._build_additional_properties(attributes, data) return self._instantiate_model(response, d_attrs, additional_properties) @@ -1505,14 +1507,14 @@ def _classify_target(self, target, data): if target is None: return None, None - if isinstance(target, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + target = target._classify(data, self.dependencies) # type: ignore except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1568,7 +1570,7 @@ def _unpack_content(raw_data, content_type=None): if hasattr(raw_data, "_content_consumed"): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data @@ -1642,7 +1644,7 @@ def deserialize_data(self, data, data_type): except (ValueError, TypeError, AttributeError) as err: msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return self._deserialize(obj_type, data) @@ -1690,7 +1692,7 @@ def deserialize_object(self, attr, **kwargs): if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1747,7 +1749,7 @@ def deserialize_basic(self, attr, data_type): if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + elif isinstance(attr, str): if attr.lower() in ["true", "1"]: return True elif attr.lower() in ["false", "0"]: @@ -1798,7 +1800,6 @@ def deserialize_enum(data, enum_obj): data = data.value if isinstance(data, int): # Workaround. We might consider remove it in the future. - # https://github.com/Azure/azure-rest-api-specs/issues/141 try: return list(enum_obj.__members__.values())[data] except IndexError: @@ -1852,10 +1853,10 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) # type: ignore + return decimal.Decimal(str(attr)) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err @staticmethod def deserialize_long(attr): @@ -1883,7 +1884,7 @@ def deserialize_duration(attr): duration = isodate.parse_duration(attr) except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return duration @@ -1900,7 +1901,7 @@ def deserialize_date(attr): 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) + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) @staticmethod def deserialize_time(attr): @@ -1935,7 +1936,7 @@ def deserialize_rfc(attr): date_obj = date_obj.astimezone(tz=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1972,7 +1973,7 @@ def deserialize_iso(attr): raise OverflowError("Hit max or min date") except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1988,9 +1989,10 @@ def deserialize_unix(attr): if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore try: + attr = int(attr) date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: msg = "Cannot deserialize to unix datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj diff --git a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/_vendor.py b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/_vendor.py +++ b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) diff --git a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/_version.py b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/_version.py index e5754a47ce68..c47f66669f1b 100644 --- a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/_version.py +++ b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b1" +VERSION = "1.0.0" diff --git a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/_azure_sphere_mgmt_client.py b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/_azure_sphere_mgmt_client.py index 66134097ad1f..77f51864cfe9 100644 --- a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/_azure_sphere_mgmt_client.py +++ b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/_azure_sphere_mgmt_client.py @@ -9,8 +9,10 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy from .. import models as _models from .._serialization import Deserializer, Serializer @@ -56,8 +58,8 @@ class AzureSphereMgmtClient: # pylint: disable=client-accepts-api-version-keywo :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -73,7 +75,25 @@ def __init__( self._config = AzureSphereMgmtClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -88,7 +108,9 @@ def __init__( self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -108,7 +130,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: await self._client.close() diff --git a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/_configuration.py b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/_configuration.py index 04bfd0ceded9..23812e9c7589 100644 --- a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/_configuration.py +++ b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/_configuration.py @@ -8,7 +8,6 @@ from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy @@ -19,7 +18,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class AzureSphereMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class AzureSphereMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for AzureSphereMgmtClient. Note that all parameters used to create this instance are saved as instance @@ -29,14 +28,13 @@ class AzureSphereMgmtClientConfiguration(Configuration): # pylint: disable=too- :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(AzureSphereMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2022-09-01-preview") + api_version: str = kwargs.pop("api_version", "2024-04-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -48,6 +46,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-sphere/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( diff --git a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/operations/_catalogs_operations.py b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/operations/_catalogs_operations.py index c2abb7072a18..f664db778ca3 100644 --- a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/operations/_catalogs_operations.py +++ b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/operations/_catalogs_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -43,6 +43,7 @@ build_list_device_insights_request, build_list_devices_request, build_update_request, + build_upload_image_request, ) T = TypeVar("T") @@ -72,7 +73,6 @@ def __init__(self, *args, **kwargs) -> None: def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Catalog"]: """List Catalog resources by subscription ID. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Catalog or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sphere.models.Catalog] :raises ~azure.core.exceptions.HttpResponseError: @@ -94,15 +94,14 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Catalog" def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -114,13 +113,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("CatalogListResult", pipeline_response) @@ -130,11 +129,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -147,8 +146,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureSphere/catalogs"} - @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Catalog"]: """List Catalog resources by resource group. @@ -156,7 +153,6 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Catalog or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sphere.models.Catalog] :raises ~azure.core.exceptions.HttpResponseError: @@ -178,16 +174,15 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -199,13 +194,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("CatalogListResult", pipeline_response) @@ -215,11 +210,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -232,10 +227,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs" - } - @distributed_trace_async async def get(self, resource_group_name: str, catalog_name: str, **kwargs: Any) -> _models.Catalog: """Get a Catalog. @@ -245,7 +236,6 @@ async def get(self, resource_group_name: str, catalog_name: str, **kwargs: Any) :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Catalog or the result of cls(response) :rtype: ~azure.mgmt.sphere.models.Catalog :raises ~azure.core.exceptions.HttpResponseError: @@ -264,21 +254,20 @@ async def get(self, resource_group_name: str, catalog_name: str, **kwargs: Any) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Catalog] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -291,16 +280,12 @@ async def get(self, resource_group_name: str, catalog_name: str, **kwargs: Any) deserialized = self._deserialize("Catalog", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}" - } + return deserialized # type: ignore async def _create_or_update_initial( - self, resource_group_name: str, catalog_name: str, resource: Union[_models.Catalog, IO], **kwargs: Any + self, resource_group_name: str, catalog_name: str, resource: Union[_models.Catalog, IO[bytes]], **kwargs: Any ) -> _models.Catalog: error_map = { 401: ClientAuthenticationError, @@ -325,7 +310,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(resource, "Catalog") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, @@ -333,16 +318,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -366,10 +350,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}" - } - @overload async def begin_create_or_update( self, @@ -392,14 +372,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Catalog or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sphere.models.Catalog] @@ -411,7 +383,7 @@ async def begin_create_or_update( self, resource_group_name: str, catalog_name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -424,18 +396,10 @@ async def begin_create_or_update( :param catalog_name: Name of catalog. Required. :type catalog_name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Catalog or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sphere.models.Catalog] @@ -444,7 +408,7 @@ async def begin_create_or_update( @distributed_trace_async async def begin_create_or_update( - self, resource_group_name: str, catalog_name: str, resource: Union[_models.Catalog, IO], **kwargs: Any + self, resource_group_name: str, catalog_name: str, resource: Union[_models.Catalog, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Catalog]: """Create a Catalog. @@ -453,19 +417,9 @@ async def begin_create_or_update( :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param resource: Resource create parameters. Is either a Catalog type or a IO type. Required. - :type resource: ~azure.mgmt.sphere.models.Catalog or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param resource: Resource create parameters. Is either a Catalog type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.sphere.models.Catalog or IO[bytes] :return: An instance of AsyncLROPoller that returns either Catalog or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sphere.models.Catalog] @@ -497,7 +451,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Catalog", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -510,17 +464,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Catalog].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - 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.AzureSphere/catalogs/{catalogName}" - } + return AsyncLROPoller[_models.Catalog]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload async def update( @@ -544,7 +496,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Catalog or the result of cls(response) :rtype: ~azure.mgmt.sphere.models.Catalog :raises ~azure.core.exceptions.HttpResponseError: @@ -555,7 +506,7 @@ async def update( self, resource_group_name: str, catalog_name: str, - properties: IO, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -568,11 +519,10 @@ async def update( :param catalog_name: Name of catalog. Required. :type catalog_name: str :param properties: The resource properties to be updated. Required. - :type properties: IO + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Catalog or the result of cls(response) :rtype: ~azure.mgmt.sphere.models.Catalog :raises ~azure.core.exceptions.HttpResponseError: @@ -580,7 +530,11 @@ async def update( @distributed_trace_async async def update( - self, resource_group_name: str, catalog_name: str, properties: Union[_models.CatalogUpdate, IO], **kwargs: Any + self, + resource_group_name: str, + catalog_name: str, + properties: Union[_models.CatalogUpdate, IO[bytes]], + **kwargs: Any ) -> _models.Catalog: """Update a Catalog. @@ -590,12 +544,8 @@ async def update( :param catalog_name: Name of catalog. Required. :type catalog_name: str :param properties: The resource properties to be updated. Is either a CatalogUpdate type or a - IO type. Required. - :type properties: ~azure.mgmt.sphere.models.CatalogUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + IO[bytes] type. Required. + :type properties: ~azure.mgmt.sphere.models.CatalogUpdate or IO[bytes] :return: Catalog or the result of cls(response) :rtype: ~azure.mgmt.sphere.models.Catalog :raises ~azure.core.exceptions.HttpResponseError: @@ -623,7 +573,7 @@ async def update( else: _json = self._serialize.body(properties, "CatalogUpdate") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, @@ -631,16 +581,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -653,13 +602,9 @@ async def update( deserialized = self._deserialize("Catalog", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}" - } + return deserialized # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, catalog_name: str, **kwargs: Any @@ -678,21 +623,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -708,11 +652,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, catalog_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -723,14 +663,6 @@ async def begin_delete(self, resource_group_name: str, catalog_name: str, **kwar :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -757,7 +689,7 @@ async def begin_delete(self, resource_group_name: str, catalog_name: str, **kwar def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -768,22 +700,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def count_devices( self, resource_group_name: str, catalog_name: str, **kwargs: Any - ) -> _models.CountDeviceResponse: + ) -> _models.CountDevicesResponse: """Counts devices in catalog. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -791,9 +719,8 @@ async def count_devices( :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CountDeviceResponse or the result of cls(response) - :rtype: ~azure.mgmt.sphere.models.CountDeviceResponse + :return: CountDevicesResponse or the result of cls(response) + :rtype: ~azure.mgmt.sphere.models.CountDevicesResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -808,23 +735,22 @@ async def count_devices( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.CountDeviceResponse] = kwargs.pop("cls", None) + cls: ClsType[_models.CountDevicesResponse] = kwargs.pop("cls", None) - request = build_count_devices_request( + _request = build_count_devices_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.count_devices.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -834,16 +760,12 @@ async def count_devices( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CountDeviceResponse", pipeline_response) + deserialized = self._deserialize("CountDevicesResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - count_devices.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/countDevices" - } + return deserialized # type: ignore @distributed_trace def list_deployments( @@ -871,7 +793,6 @@ def list_deployments( :type skip: int :param maxpagesize: The maximum number of result items per page. Default value is None. :type maxpagesize: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Deployment or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sphere.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: @@ -893,7 +814,7 @@ def list_deployments( def prepare_request(next_link=None): if not next_link: - request = build_list_deployments_request( + _request = build_list_deployments_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, @@ -902,12 +823,11 @@ def prepare_request(next_link=None): skip=skip, maxpagesize=maxpagesize, api_version=api_version, - template_url=self.list_deployments.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -919,13 +839,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("DeploymentListResult", pipeline_response) @@ -935,11 +855,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -952,10 +872,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_deployments.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDeployments" - } - @overload def list_device_groups( self, @@ -990,7 +906,6 @@ def list_device_groups( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DeviceGroup or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sphere.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: @@ -1001,7 +916,7 @@ def list_device_groups( self, resource_group_name: str, catalog_name: str, - list_device_groups_request: IO, + list_device_groups_request: IO[bytes], filter: Optional[str] = None, top: Optional[int] = None, skip: Optional[int] = None, @@ -1018,7 +933,7 @@ def list_device_groups( :param catalog_name: Name of catalog. Required. :type catalog_name: str :param list_device_groups_request: List device groups for catalog. Required. - :type list_device_groups_request: IO + :type list_device_groups_request: IO[bytes] :param filter: Filter the result list using the given expression. Default value is None. :type filter: str :param top: The number of result items to return. Default value is None. @@ -1030,7 +945,6 @@ def list_device_groups( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DeviceGroup or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sphere.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: @@ -1041,7 +955,7 @@ def list_device_groups( self, resource_group_name: str, catalog_name: str, - list_device_groups_request: Union[_models.ListDeviceGroupsRequest, IO], + list_device_groups_request: Union[_models.ListDeviceGroupsRequest, IO[bytes]], filter: Optional[str] = None, top: Optional[int] = None, skip: Optional[int] = None, @@ -1056,8 +970,9 @@ def list_device_groups( :param catalog_name: Name of catalog. Required. :type catalog_name: str :param list_device_groups_request: List device groups for catalog. Is either a - ListDeviceGroupsRequest type or a IO type. Required. - :type list_device_groups_request: ~azure.mgmt.sphere.models.ListDeviceGroupsRequest or IO + ListDeviceGroupsRequest type or a IO[bytes] type. Required. + :type list_device_groups_request: ~azure.mgmt.sphere.models.ListDeviceGroupsRequest or + IO[bytes] :param filter: Filter the result list using the given expression. Default value is None. :type filter: str :param top: The number of result items to return. Default value is None. @@ -1066,10 +981,6 @@ def list_device_groups( :type skip: int :param maxpagesize: The maximum number of result items per page. Default value is None. :type maxpagesize: int - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DeviceGroup or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sphere.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: @@ -1099,7 +1010,7 @@ def list_device_groups( def prepare_request(next_link=None): if not next_link: - request = build_list_device_groups_request( + _request = build_list_device_groups_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, @@ -1111,12 +1022,11 @@ def prepare_request(next_link=None): content_type=content_type, json=_json, content=_content, - template_url=self.list_device_groups.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1128,13 +1038,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("DeviceGroupListResult", pipeline_response) @@ -1144,11 +1054,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1161,10 +1071,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_device_groups.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDeviceGroups" - } - @distributed_trace def list_device_insights( self, @@ -1191,7 +1097,6 @@ def list_device_insights( :type skip: int :param maxpagesize: The maximum number of result items per page. Default value is None. :type maxpagesize: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DeviceInsight or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sphere.models.DeviceInsight] :raises ~azure.core.exceptions.HttpResponseError: @@ -1213,7 +1118,7 @@ def list_device_insights( def prepare_request(next_link=None): if not next_link: - request = build_list_device_insights_request( + _request = build_list_device_insights_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, @@ -1222,12 +1127,11 @@ def prepare_request(next_link=None): skip=skip, maxpagesize=maxpagesize, api_version=api_version, - template_url=self.list_device_insights.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1239,13 +1143,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("PagedDeviceInsight", pipeline_response) @@ -1255,11 +1159,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1272,10 +1176,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_device_insights.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDeviceInsights" - } - @distributed_trace def list_devices( self, @@ -1302,7 +1202,6 @@ def list_devices( :type skip: int :param maxpagesize: The maximum number of result items per page. Default value is None. :type maxpagesize: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Device or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sphere.models.Device] :raises ~azure.core.exceptions.HttpResponseError: @@ -1324,7 +1223,7 @@ def list_devices( def prepare_request(next_link=None): if not next_link: - request = build_list_devices_request( + _request = build_list_devices_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, @@ -1333,12 +1232,11 @@ def prepare_request(next_link=None): skip=skip, maxpagesize=maxpagesize, api_version=api_version, - template_url=self.list_devices.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1350,13 +1248,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("DeviceListResult", pipeline_response) @@ -1366,11 +1264,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1383,6 +1281,185 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_devices.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDevices" - } + async def _upload_image_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + catalog_name: str, + upload_image_request: Union[_models.Image, IO[bytes]], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + 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 + _content = None + if isinstance(upload_image_request, (IOBase, bytes)): + _content = upload_image_request + else: + _json = self._serialize.body(upload_image_request, "Image") + + _request = build_upload_image_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @overload + async def begin_upload_image( + self, + resource_group_name: str, + catalog_name: str, + upload_image_request: _models.Image, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Creates an image. Use this action when the image ID is unknown. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param upload_image_request: Image upload request body. Required. + :type upload_image_request: ~azure.mgmt.sphere.models.Image + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_upload_image( + self, + resource_group_name: str, + catalog_name: str, + upload_image_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Creates an image. Use this action when the image ID is unknown. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param upload_image_request: Image upload request body. Required. + :type upload_image_request: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_upload_image( + self, + resource_group_name: str, + catalog_name: str, + upload_image_request: Union[_models.Image, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Creates an image. Use this action when the image ID is unknown. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param upload_image_request: Image upload request body. Is either a Image type or a IO[bytes] + type. Required. + :type upload_image_request: ~azure.mgmt.sphere.models.Image or IO[bytes] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + 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: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._upload_image_initial( # type: ignore + resource_group_name=resource_group_name, + catalog_name=catalog_name, + upload_image_request=upload_image_request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/operations/_certificates_operations.py b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/operations/_certificates_operations.py index 065eb3b690f7..d37cee204668 100644 --- a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/operations/_certificates_operations.py +++ b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/operations/_certificates_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -85,7 +85,6 @@ def list_by_catalog( :type skip: int :param maxpagesize: The maximum number of result items per page. Default value is None. :type maxpagesize: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Certificate or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sphere.models.Certificate] :raises ~azure.core.exceptions.HttpResponseError: @@ -107,7 +106,7 @@ def list_by_catalog( def prepare_request(next_link=None): if not next_link: - request = build_list_by_catalog_request( + _request = build_list_by_catalog_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, @@ -116,12 +115,11 @@ def prepare_request(next_link=None): skip=skip, maxpagesize=maxpagesize, api_version=api_version, - template_url=self.list_by_catalog.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -133,13 +131,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("CertificateListResult", pipeline_response) @@ -149,11 +147,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -166,10 +164,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_catalog.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates" - } - @distributed_trace_async async def get( self, resource_group_name: str, catalog_name: str, serial_number: str, **kwargs: Any @@ -184,7 +178,6 @@ async def get( :param serial_number: Serial number of the certificate. Use '.default' to get current active certificate. Required. :type serial_number: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Certificate or the result of cls(response) :rtype: ~azure.mgmt.sphere.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: @@ -203,22 +196,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, catalog_name=catalog_name, serial_number=serial_number, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -231,13 +223,9 @@ async def get( deserialized = self._deserialize("Certificate", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}" - } + return deserialized # type: ignore @distributed_trace_async async def retrieve_cert_chain( @@ -253,7 +241,6 @@ async def retrieve_cert_chain( :param serial_number: Serial number of the certificate. Use '.default' to get current active certificate. Required. :type serial_number: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateChainResponse or the result of cls(response) :rtype: ~azure.mgmt.sphere.models.CertificateChainResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -272,22 +259,21 @@ async def retrieve_cert_chain( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CertificateChainResponse] = kwargs.pop("cls", None) - request = build_retrieve_cert_chain_request( + _request = build_retrieve_cert_chain_request( resource_group_name=resource_group_name, catalog_name=catalog_name, serial_number=serial_number, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.retrieve_cert_chain.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -300,13 +286,9 @@ async def retrieve_cert_chain( deserialized = self._deserialize("CertificateChainResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - retrieve_cert_chain.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}/retrieveCertChain" - } + return deserialized # type: ignore @overload async def retrieve_proof_of_possession_nonce( @@ -335,7 +317,6 @@ async def retrieve_proof_of_possession_nonce( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ProofOfPossessionNonceResponse or the result of cls(response) :rtype: ~azure.mgmt.sphere.models.ProofOfPossessionNonceResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -347,7 +328,7 @@ async def retrieve_proof_of_possession_nonce( resource_group_name: str, catalog_name: str, serial_number: str, - proof_of_possession_nonce_request: IO, + proof_of_possession_nonce_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -363,11 +344,10 @@ async def retrieve_proof_of_possession_nonce( certificate. Required. :type serial_number: str :param proof_of_possession_nonce_request: Proof of possession nonce request body. Required. - :type proof_of_possession_nonce_request: IO + :type proof_of_possession_nonce_request: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ProofOfPossessionNonceResponse or the result of cls(response) :rtype: ~azure.mgmt.sphere.models.ProofOfPossessionNonceResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -379,7 +359,7 @@ async def retrieve_proof_of_possession_nonce( resource_group_name: str, catalog_name: str, serial_number: str, - proof_of_possession_nonce_request: Union[_models.ProofOfPossessionNonceRequest, IO], + proof_of_possession_nonce_request: Union[_models.ProofOfPossessionNonceRequest, IO[bytes]], **kwargs: Any ) -> _models.ProofOfPossessionNonceResponse: """Gets the proof of possession nonce. @@ -393,13 +373,9 @@ async def retrieve_proof_of_possession_nonce( certificate. Required. :type serial_number: str :param proof_of_possession_nonce_request: Proof of possession nonce request body. Is either a - ProofOfPossessionNonceRequest type or a IO type. Required. + ProofOfPossessionNonceRequest type or a IO[bytes] type. Required. :type proof_of_possession_nonce_request: - ~azure.mgmt.sphere.models.ProofOfPossessionNonceRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ~azure.mgmt.sphere.models.ProofOfPossessionNonceRequest or IO[bytes] :return: ProofOfPossessionNonceResponse or the result of cls(response) :rtype: ~azure.mgmt.sphere.models.ProofOfPossessionNonceResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -427,7 +403,7 @@ async def retrieve_proof_of_possession_nonce( else: _json = self._serialize.body(proof_of_possession_nonce_request, "ProofOfPossessionNonceRequest") - request = build_retrieve_proof_of_possession_nonce_request( + _request = build_retrieve_proof_of_possession_nonce_request( resource_group_name=resource_group_name, catalog_name=catalog_name, serial_number=serial_number, @@ -436,16 +412,15 @@ async def retrieve_proof_of_possession_nonce( content_type=content_type, json=_json, content=_content, - template_url=self.retrieve_proof_of_possession_nonce.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -458,10 +433,6 @@ async def retrieve_proof_of_possession_nonce( deserialized = self._deserialize("ProofOfPossessionNonceResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - retrieve_proof_of_possession_nonce.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}/retrieveProofOfPossessionNonce" - } + return deserialized # type: ignore diff --git a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/operations/_deployments_operations.py b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/operations/_deployments_operations.py index b8de8c7ca002..725ee89e6380 100644 --- a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/operations/_deployments_operations.py +++ b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/operations/_deployments_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -94,7 +94,6 @@ def list_by_device_group( :type skip: int :param maxpagesize: The maximum number of result items per page. Default value is None. :type maxpagesize: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Deployment or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sphere.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: @@ -116,7 +115,7 @@ def list_by_device_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_device_group_request( + _request = build_list_by_device_group_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -127,12 +126,11 @@ def prepare_request(next_link=None): skip=skip, maxpagesize=maxpagesize, api_version=api_version, - template_url=self.list_by_device_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -144,13 +142,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("DeploymentListResult", pipeline_response) @@ -160,11 +158,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -177,10 +175,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_device_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments" - } - @distributed_trace_async async def get( self, @@ -206,7 +200,6 @@ async def get( :param deployment_name: Deployment name. Use .default for deployment creation and to get the current deployment for the associated device group. Required. :type deployment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Deployment or the result of cls(response) :rtype: ~azure.mgmt.sphere.models.Deployment :raises ~azure.core.exceptions.HttpResponseError: @@ -225,7 +218,7 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Deployment] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -233,16 +226,15 @@ async def get( deployment_name=deployment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -255,13 +247,9 @@ async def get( deserialized = self._deserialize("Deployment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, @@ -270,7 +258,7 @@ async def _create_or_update_initial( product_name: str, device_group_name: str, deployment_name: str, - resource: Union[_models.Deployment, IO], + resource: Union[_models.Deployment, IO[bytes]], **kwargs: Any ) -> _models.Deployment: error_map = { @@ -296,7 +284,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(resource, "Deployment") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -307,16 +295,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -340,10 +327,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}" - } - @overload async def begin_create_or_update( self, @@ -377,14 +360,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Deployment or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sphere.models.Deployment] @@ -399,7 +374,7 @@ async def begin_create_or_update( product_name: str, device_group_name: str, deployment_name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -420,18 +395,10 @@ async def begin_create_or_update( current deployment for the associated device group. Required. :type deployment_name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Deployment or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sphere.models.Deployment] @@ -446,7 +413,7 @@ async def begin_create_or_update( product_name: str, device_group_name: str, deployment_name: str, - resource: Union[_models.Deployment, IO], + resource: Union[_models.Deployment, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Deployment]: """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used @@ -464,20 +431,9 @@ async def begin_create_or_update( :param deployment_name: Deployment name. Use .default for deployment creation and to get the current deployment for the associated device group. Required. :type deployment_name: str - :param resource: Resource create parameters. Is either a Deployment type or a IO type. + :param resource: Resource create parameters. Is either a Deployment type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.sphere.models.Deployment or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :type resource: ~azure.mgmt.sphere.models.Deployment or IO[bytes] :return: An instance of AsyncLROPoller that returns either Deployment or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sphere.models.Deployment] @@ -512,7 +468,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Deployment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -525,17 +481,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Deployment].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - 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.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}" - } + return AsyncLROPoller[_models.Deployment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -560,7 +514,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -568,16 +522,15 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements deployment_name=deployment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -593,11 +546,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async async def begin_delete( @@ -624,14 +573,6 @@ async def begin_delete( :param deployment_name: Deployment name. Use .default for deployment creation and to get the current deployment for the associated device group. Required. :type deployment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -661,7 +602,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -672,14 +613,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/operations/_device_groups_operations.py b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/operations/_device_groups_operations.py index 753bba2b79da..9382f33a87d3 100644 --- a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/operations/_device_groups_operations.py +++ b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/operations/_device_groups_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -94,7 +94,6 @@ def list_by_product( :type skip: int :param maxpagesize: The maximum number of result items per page. Default value is None. :type maxpagesize: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DeviceGroup or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sphere.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: @@ -116,7 +115,7 @@ def list_by_product( def prepare_request(next_link=None): if not next_link: - request = build_list_by_product_request( + _request = build_list_by_product_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -126,12 +125,11 @@ def prepare_request(next_link=None): skip=skip, maxpagesize=maxpagesize, api_version=api_version, - template_url=self.list_by_product.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -143,13 +141,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("DeviceGroupListResult", pipeline_response) @@ -159,11 +157,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -176,10 +174,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_product.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups" - } - @distributed_trace_async async def get( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any @@ -196,7 +190,6 @@ async def get( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DeviceGroup or the result of cls(response) :rtype: ~azure.mgmt.sphere.models.DeviceGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -215,23 +208,22 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DeviceGroup] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -244,13 +236,9 @@ async def get( deserialized = self._deserialize("DeviceGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, @@ -258,7 +246,7 @@ async def _create_or_update_initial( catalog_name: str, product_name: str, device_group_name: str, - resource: Union[_models.DeviceGroup, IO], + resource: Union[_models.DeviceGroup, IO[bytes]], **kwargs: Any ) -> _models.DeviceGroup: error_map = { @@ -284,7 +272,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(resource, "DeviceGroup") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -294,16 +282,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -327,10 +314,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" - } - @overload async def begin_create_or_update( self, @@ -360,14 +343,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either DeviceGroup or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sphere.models.DeviceGroup] @@ -381,7 +356,7 @@ async def begin_create_or_update( catalog_name: str, product_name: str, device_group_name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -399,18 +374,10 @@ async def begin_create_or_update( :param device_group_name: Name of device group. Required. :type device_group_name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either DeviceGroup or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sphere.models.DeviceGroup] @@ -424,7 +391,7 @@ async def begin_create_or_update( catalog_name: str, product_name: str, device_group_name: str, - resource: Union[_models.DeviceGroup, IO], + resource: Union[_models.DeviceGroup, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.DeviceGroup]: """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used @@ -439,20 +406,9 @@ async def begin_create_or_update( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param resource: Resource create parameters. Is either a DeviceGroup type or a IO type. + :param resource: Resource create parameters. Is either a DeviceGroup type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.sphere.models.DeviceGroup or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :type resource: ~azure.mgmt.sphere.models.DeviceGroup or IO[bytes] :return: An instance of AsyncLROPoller that returns either DeviceGroup or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sphere.models.DeviceGroup] @@ -486,7 +442,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("DeviceGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -499,17 +455,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.DeviceGroup].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - 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.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" - } + return AsyncLROPoller[_models.DeviceGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _update_initial( self, @@ -517,7 +471,7 @@ async def _update_initial( catalog_name: str, product_name: str, device_group_name: str, - properties: Union[_models.DeviceGroupUpdate, IO], + properties: Union[_models.DeviceGroupUpdate, IO[bytes]], **kwargs: Any ) -> Optional[_models.DeviceGroup]: error_map = { @@ -543,7 +497,7 @@ async def _update_initial( else: _json = self._serialize.body(properties, "DeviceGroupUpdate") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -553,16 +507,15 @@ async def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -582,13 +535,9 @@ async def _update_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" - } + return deserialized # type: ignore @overload async def begin_update( @@ -619,14 +568,6 @@ async def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either DeviceGroup or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sphere.models.DeviceGroup] @@ -640,7 +581,7 @@ async def begin_update( catalog_name: str, product_name: str, device_group_name: str, - properties: IO, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -658,18 +599,10 @@ async def begin_update( :param device_group_name: Name of device group. Required. :type device_group_name: str :param properties: The resource properties to be updated. Required. - :type properties: IO + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either DeviceGroup or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sphere.models.DeviceGroup] @@ -683,7 +616,7 @@ async def begin_update( catalog_name: str, product_name: str, device_group_name: str, - properties: Union[_models.DeviceGroupUpdate, IO], + properties: Union[_models.DeviceGroupUpdate, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.DeviceGroup]: """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used @@ -699,19 +632,8 @@ async def begin_update( :param device_group_name: Name of device group. Required. :type device_group_name: str :param properties: The resource properties to be updated. Is either a DeviceGroupUpdate type or - a IO type. Required. - :type properties: ~azure.mgmt.sphere.models.DeviceGroupUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + a IO[bytes] type. Required. + :type properties: ~azure.mgmt.sphere.models.DeviceGroupUpdate or IO[bytes] :return: An instance of AsyncLROPoller that returns either DeviceGroup or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sphere.models.DeviceGroup] @@ -745,7 +667,7 @@ async def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("DeviceGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -757,17 +679,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.DeviceGroup].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" - } + return AsyncLROPoller[_models.DeviceGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any @@ -786,23 +706,22 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -818,11 +737,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async async def begin_delete( @@ -840,14 +755,6 @@ async def begin_delete( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -876,7 +783,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -887,17 +794,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _claim_devices_initial( # pylint: disable=inconsistent-return-statements self, @@ -905,7 +808,7 @@ async def _claim_devices_initial( # pylint: disable=inconsistent-return-stateme catalog_name: str, product_name: str, device_group_name: str, - claim_devices_request: Union[_models.ClaimDevicesRequest, IO], + claim_devices_request: Union[_models.ClaimDevicesRequest, IO[bytes]], **kwargs: Any ) -> None: error_map = { @@ -931,7 +834,7 @@ async def _claim_devices_initial( # pylint: disable=inconsistent-return-stateme else: _json = self._serialize.body(claim_devices_request, "ClaimDevicesRequest") - request = build_claim_devices_request( + _request = build_claim_devices_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -941,16 +844,15 @@ async def _claim_devices_initial( # pylint: disable=inconsistent-return-stateme content_type=content_type, json=_json, content=_content, - template_url=self._claim_devices_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -962,13 +864,10 @@ async def _claim_devices_initial( # pylint: disable=inconsistent-return-stateme response_headers = {} response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _claim_devices_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/claimDevices" - } + return cls(pipeline_response, None, response_headers) # type: ignore @overload async def begin_claim_devices( @@ -999,14 +898,6 @@ async def begin_claim_devices( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1019,7 +910,7 @@ async def begin_claim_devices( catalog_name: str, product_name: str, device_group_name: str, - claim_devices_request: IO, + claim_devices_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1037,18 +928,10 @@ async def begin_claim_devices( :param device_group_name: Name of device group. Required. :type device_group_name: str :param claim_devices_request: Bulk claim devices request body. Required. - :type claim_devices_request: IO + :type claim_devices_request: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1061,7 +944,7 @@ async def begin_claim_devices( catalog_name: str, product_name: str, device_group_name: str, - claim_devices_request: Union[_models.ClaimDevicesRequest, IO], + claim_devices_request: Union[_models.ClaimDevicesRequest, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names @@ -1077,19 +960,8 @@ async def begin_claim_devices( :param device_group_name: Name of device group. Required. :type device_group_name: str :param claim_devices_request: Bulk claim devices request body. Is either a ClaimDevicesRequest - type or a IO type. Required. - :type claim_devices_request: ~azure.mgmt.sphere.models.ClaimDevicesRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + type or a IO[bytes] type. Required. + :type claim_devices_request: ~azure.mgmt.sphere.models.ClaimDevicesRequest or IO[bytes] :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1121,7 +993,7 @@ async def begin_claim_devices( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -1132,22 +1004,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_claim_devices.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/claimDevices" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def count_devices( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any - ) -> _models.CountDeviceResponse: + ) -> _models.CountDevicesResponse: """Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. @@ -1160,9 +1028,8 @@ async def count_devices( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CountDeviceResponse or the result of cls(response) - :rtype: ~azure.mgmt.sphere.models.CountDeviceResponse + :return: CountDevicesResponse or the result of cls(response) + :rtype: ~azure.mgmt.sphere.models.CountDevicesResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -1177,25 +1044,24 @@ async def count_devices( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.CountDeviceResponse] = kwargs.pop("cls", None) + cls: ClsType[_models.CountDevicesResponse] = kwargs.pop("cls", None) - request = build_count_devices_request( + _request = build_count_devices_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.count_devices.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1205,13 +1071,9 @@ async def count_devices( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CountDeviceResponse", pipeline_response) + deserialized = self._deserialize("CountDevicesResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - count_devices.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/countDevices" - } + return deserialized # type: ignore diff --git a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/operations/_devices_operations.py b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/operations/_devices_operations.py index 7167ba94e83a..629912a6c361 100644 --- a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/operations/_devices_operations.py +++ b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/operations/_devices_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -79,7 +79,6 @@ def list_by_device_group( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Device or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sphere.models.Device] :raises ~azure.core.exceptions.HttpResponseError: @@ -101,19 +100,18 @@ def list_by_device_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_device_group_request( + _request = build_list_by_device_group_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_device_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -125,13 +123,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("DeviceListResult", pipeline_response) @@ -141,11 +139,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -158,10 +156,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_device_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices" - } - @distributed_trace_async async def get( self, @@ -186,7 +180,6 @@ async def get( :type device_group_name: str :param device_name: Device name. Required. :type device_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Device or the result of cls(response) :rtype: ~azure.mgmt.sphere.models.Device :raises ~azure.core.exceptions.HttpResponseError: @@ -205,7 +198,7 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Device] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -213,16 +206,15 @@ async def get( device_name=device_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -235,13 +227,9 @@ async def get( deserialized = self._deserialize("Device", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, @@ -250,7 +238,7 @@ async def _create_or_update_initial( product_name: str, device_group_name: str, device_name: str, - resource: Union[_models.Device, IO], + resource: Union[_models.Device, IO[bytes]], **kwargs: Any ) -> _models.Device: error_map = { @@ -276,7 +264,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(resource, "Device") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -287,16 +275,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -320,10 +307,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" - } - @overload async def begin_create_or_update( self, @@ -356,14 +339,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Device or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sphere.models.Device] @@ -378,7 +353,7 @@ async def begin_create_or_update( product_name: str, device_group_name: str, device_name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -398,18 +373,10 @@ async def begin_create_or_update( :param device_name: Device name. Required. :type device_name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Device or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sphere.models.Device] @@ -424,7 +391,7 @@ async def begin_create_or_update( product_name: str, device_group_name: str, device_name: str, - resource: Union[_models.Device, IO], + resource: Union[_models.Device, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Device]: """Create a Device. Use '.unassigned' or '.default' for the device group and product names to @@ -441,19 +408,9 @@ async def begin_create_or_update( :type device_group_name: str :param device_name: Device name. Required. :type device_name: str - :param resource: Resource create parameters. Is either a Device type or a IO type. Required. - :type resource: ~azure.mgmt.sphere.models.Device or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param resource: Resource create parameters. Is either a Device type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.sphere.models.Device or IO[bytes] :return: An instance of AsyncLROPoller that returns either Device or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sphere.models.Device] @@ -488,7 +445,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Device", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -501,17 +458,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Device].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - 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.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" - } + return AsyncLROPoller[_models.Device]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _update_initial( self, @@ -520,7 +475,7 @@ async def _update_initial( product_name: str, device_group_name: str, device_name: str, - properties: Union[_models.DeviceUpdate, IO], + properties: Union[_models.DeviceUpdate, IO[bytes]], **kwargs: Any ) -> Optional[_models.Device]: error_map = { @@ -546,7 +501,7 @@ async def _update_initial( else: _json = self._serialize.body(properties, "DeviceUpdate") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -557,16 +512,15 @@ async def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -585,13 +539,9 @@ async def _update_initial( response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" - } + return deserialized # type: ignore @overload async def begin_update( @@ -625,14 +575,6 @@ async def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Device or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sphere.models.Device] @@ -647,7 +589,7 @@ async def begin_update( product_name: str, device_group_name: str, device_name: str, - properties: IO, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -667,18 +609,10 @@ async def begin_update( :param device_name: Device name. Required. :type device_name: str :param properties: The resource properties to be updated. Required. - :type properties: IO + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Device or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sphere.models.Device] @@ -693,7 +627,7 @@ async def begin_update( product_name: str, device_group_name: str, device_name: str, - properties: Union[_models.DeviceUpdate, IO], + properties: Union[_models.DeviceUpdate, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Device]: """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move @@ -710,20 +644,9 @@ async def begin_update( :type device_group_name: str :param device_name: Device name. Required. :type device_name: str - :param properties: The resource properties to be updated. Is either a DeviceUpdate type or a IO - type. Required. - :type properties: ~azure.mgmt.sphere.models.DeviceUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param properties: The resource properties to be updated. Is either a DeviceUpdate type or a + IO[bytes] type. Required. + :type properties: ~azure.mgmt.sphere.models.DeviceUpdate or IO[bytes] :return: An instance of AsyncLROPoller that returns either Device or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sphere.models.Device] @@ -758,7 +681,7 @@ async def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Device", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -770,17 +693,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Device].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" - } + return AsyncLROPoller[_models.Device]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -805,7 +726,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -813,16 +734,15 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements device_name=device_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -838,11 +758,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async async def begin_delete( @@ -867,14 +783,6 @@ async def begin_delete( :type device_group_name: str :param device_name: Device name. Required. :type device_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -904,7 +812,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -915,17 +823,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _generate_capability_image_initial( self, @@ -934,7 +838,7 @@ async def _generate_capability_image_initial( product_name: str, device_group_name: str, device_name: str, - generate_device_capability_request: Union[_models.GenerateCapabilityImageRequest, IO], + generate_device_capability_request: Union[_models.GenerateCapabilityImageRequest, IO[bytes]], **kwargs: Any ) -> Optional[_models.SignedCapabilityImageResponse]: error_map = { @@ -960,7 +864,7 @@ async def _generate_capability_image_initial( else: _json = self._serialize.body(generate_device_capability_request, "GenerateCapabilityImageRequest") - request = build_generate_capability_image_request( + _request = build_generate_capability_image_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -971,16 +875,15 @@ async def _generate_capability_image_initial( content_type=content_type, json=_json, content=_content, - template_url=self._generate_capability_image_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -997,15 +900,12 @@ async def _generate_capability_image_initial( if response.status_code == 202: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _generate_capability_image_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}/generateCapabilityImage" - } + return deserialized # type: ignore @overload async def begin_generate_capability_image( @@ -1041,14 +941,6 @@ async def begin_generate_capability_image( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either SignedCapabilityImageResponse or the result of cls(response) :rtype: @@ -1064,7 +956,7 @@ async def begin_generate_capability_image( product_name: str, device_group_name: str, device_name: str, - generate_device_capability_request: IO, + generate_device_capability_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1085,18 +977,10 @@ async def begin_generate_capability_image( :param device_name: Device name. Required. :type device_name: str :param generate_device_capability_request: Generate capability image request body. Required. - :type generate_device_capability_request: IO + :type generate_device_capability_request: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either SignedCapabilityImageResponse or the result of cls(response) :rtype: @@ -1112,7 +996,7 @@ async def begin_generate_capability_image( product_name: str, device_group_name: str, device_name: str, - generate_device_capability_request: Union[_models.GenerateCapabilityImageRequest, IO], + generate_device_capability_request: Union[_models.GenerateCapabilityImageRequest, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.SignedCapabilityImageResponse]: """Generates the capability image for the device. Use '.unassigned' or '.default' for the device @@ -1131,20 +1015,9 @@ async def begin_generate_capability_image( :param device_name: Device name. Required. :type device_name: str :param generate_device_capability_request: Generate capability image request body. Is either a - GenerateCapabilityImageRequest type or a IO type. Required. + GenerateCapabilityImageRequest type or a IO[bytes] type. Required. :type generate_device_capability_request: - ~azure.mgmt.sphere.models.GenerateCapabilityImageRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + ~azure.mgmt.sphere.models.GenerateCapabilityImageRequest or IO[bytes] :return: An instance of AsyncLROPoller that returns either SignedCapabilityImageResponse or the result of cls(response) :rtype: @@ -1180,7 +1053,7 @@ async def begin_generate_capability_image( def get_long_running_output(pipeline_response): deserialized = self._deserialize("SignedCapabilityImageResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1192,14 +1065,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.SignedCapabilityImageResponse].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_generate_capability_image.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}/generateCapabilityImage" - } + return AsyncLROPoller[_models.SignedCapabilityImageResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/operations/_images_operations.py b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/operations/_images_operations.py index 7c213b2919a9..d88387cf3a7c 100644 --- a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/operations/_images_operations.py +++ b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/operations/_images_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -87,7 +87,6 @@ def list_by_catalog( :type skip: int :param maxpagesize: The maximum number of result items per page. Default value is None. :type maxpagesize: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Image or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sphere.models.Image] :raises ~azure.core.exceptions.HttpResponseError: @@ -109,7 +108,7 @@ def list_by_catalog( def prepare_request(next_link=None): if not next_link: - request = build_list_by_catalog_request( + _request = build_list_by_catalog_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, @@ -118,12 +117,11 @@ def prepare_request(next_link=None): skip=skip, maxpagesize=maxpagesize, api_version=api_version, - template_url=self.list_by_catalog.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -135,13 +133,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ImageListResult", pipeline_response) @@ -151,11 +149,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -168,10 +166,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_catalog.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images" - } - @distributed_trace_async async def get(self, resource_group_name: str, catalog_name: str, image_name: str, **kwargs: Any) -> _models.Image: """Get a Image. @@ -181,9 +175,8 @@ async def get(self, resource_group_name: str, catalog_name: str, image_name: str :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. :type image_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Image or the result of cls(response) :rtype: ~azure.mgmt.sphere.models.Image :raises ~azure.core.exceptions.HttpResponseError: @@ -202,22 +195,21 @@ async def get(self, resource_group_name: str, catalog_name: str, image_name: str api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Image] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, catalog_name=catalog_name, image_name=image_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -230,20 +222,16 @@ async def get(self, resource_group_name: str, catalog_name: str, image_name: str deserialized = self._deserialize("Image", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, catalog_name: str, image_name: str, - resource: Union[_models.Image, IO], + resource: Union[_models.Image, IO[bytes]], **kwargs: Any ) -> _models.Image: error_map = { @@ -269,7 +257,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(resource, "Image") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, image_name=image_name, @@ -278,16 +266,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -311,10 +298,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}" - } - @overload async def begin_create_or_update( self, @@ -333,21 +316,13 @@ async def begin_create_or_update( :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. :type image_name: str :param resource: Resource create parameters. Required. :type resource: ~azure.mgmt.sphere.models.Image :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Image or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sphere.models.Image] :raises ~azure.core.exceptions.HttpResponseError: @@ -359,7 +334,7 @@ async def begin_create_or_update( resource_group_name: str, catalog_name: str, image_name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -371,21 +346,13 @@ async def begin_create_or_update( :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. :type image_name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Image or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sphere.models.Image] :raises ~azure.core.exceptions.HttpResponseError: @@ -397,7 +364,7 @@ async def begin_create_or_update( resource_group_name: str, catalog_name: str, image_name: str, - resource: Union[_models.Image, IO], + resource: Union[_models.Image, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Image]: """Create a Image. @@ -407,21 +374,11 @@ async def begin_create_or_update( :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. :type image_name: str - :param resource: Resource create parameters. Is either a Image type or a IO type. Required. - :type resource: ~azure.mgmt.sphere.models.Image or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param resource: Resource create parameters. Is either a Image type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.sphere.models.Image or IO[bytes] :return: An instance of AsyncLROPoller that returns either Image or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sphere.models.Image] :raises ~azure.core.exceptions.HttpResponseError: @@ -453,7 +410,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Image", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -466,17 +423,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Image].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - 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.AzureSphere/catalogs/{catalogName}/images/{imageName}" - } + return AsyncLROPoller[_models.Image]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, catalog_name: str, image_name: str, **kwargs: Any @@ -495,22 +450,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, catalog_name=catalog_name, image_name=image_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -526,11 +480,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async async def begin_delete( @@ -543,16 +493,8 @@ async def begin_delete( :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. :type image_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -580,7 +522,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -591,14 +533,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/operations/_operations.py b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/operations/_operations.py index 0bd8b453cb3b..708da10bdc80 100644 --- a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/operations/_operations.py +++ b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -56,7 +56,6 @@ def __init__(self, *args, **kwargs) -> None: def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: """List the operations for the provider. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Operation or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sphere.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: @@ -78,14 +77,13 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -97,13 +95,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) @@ -113,11 +111,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -129,5 +127,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.AzureSphere/operations"} diff --git a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/operations/_products_operations.py b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/operations/_products_operations.py index 943ef3e21eaf..03419065ce1a 100644 --- a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/operations/_products_operations.py +++ b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/aio/operations/_products_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -75,7 +75,6 @@ def list_by_catalog( :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Product or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sphere.models.Product] :raises ~azure.core.exceptions.HttpResponseError: @@ -97,17 +96,16 @@ def list_by_catalog( def prepare_request(next_link=None): if not next_link: - request = build_list_by_catalog_request( + _request = build_list_by_catalog_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_catalog.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -119,13 +117,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ProductListResult", pipeline_response) @@ -135,11 +133,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -152,10 +150,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_catalog.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products" - } - @distributed_trace_async async def get( self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any @@ -170,7 +164,6 @@ async def get( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Product or the result of cls(response) :rtype: ~azure.mgmt.sphere.models.Product :raises ~azure.core.exceptions.HttpResponseError: @@ -189,22 +182,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Product] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -217,20 +209,16 @@ async def get( deserialized = self._deserialize("Product", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, catalog_name: str, product_name: str, - resource: Union[_models.Product, IO], + resource: Union[_models.Product, IO[bytes]], **kwargs: Any ) -> _models.Product: error_map = { @@ -256,7 +244,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(resource, "Product") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -265,16 +253,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -298,10 +285,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" - } - @overload async def begin_create_or_update( self, @@ -328,14 +311,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sphere.models.Product] @@ -348,7 +323,7 @@ async def begin_create_or_update( resource_group_name: str, catalog_name: str, product_name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -364,18 +339,10 @@ async def begin_create_or_update( :param product_name: Name of product. Required. :type product_name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sphere.models.Product] @@ -388,7 +355,7 @@ async def begin_create_or_update( resource_group_name: str, catalog_name: str, product_name: str, - resource: Union[_models.Product, IO], + resource: Union[_models.Product, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Product]: """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for @@ -401,19 +368,9 @@ async def begin_create_or_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param resource: Resource create parameters. Is either a Product type or a IO type. Required. - :type resource: ~azure.mgmt.sphere.models.Product or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param resource: Resource create parameters. Is either a Product type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.sphere.models.Product or IO[bytes] :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sphere.models.Product] @@ -446,7 +403,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Product", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -459,24 +416,22 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Product].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - 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.AzureSphere/catalogs/{catalogName}/products/{productName}" - } + return AsyncLROPoller[_models.Product]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _update_initial( self, resource_group_name: str, catalog_name: str, product_name: str, - properties: Union[_models.ProductUpdate, IO], + properties: Union[_models.ProductUpdate, IO[bytes]], **kwargs: Any ) -> Optional[_models.Product]: error_map = { @@ -502,7 +457,7 @@ async def _update_initial( else: _json = self._serialize.body(properties, "ProductUpdate") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -511,16 +466,15 @@ async def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -540,13 +494,9 @@ async def _update_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" - } + return deserialized # type: ignore @overload async def begin_update( @@ -574,14 +524,6 @@ async def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sphere.models.Product] @@ -594,7 +536,7 @@ async def begin_update( resource_group_name: str, catalog_name: str, product_name: str, - properties: IO, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -610,18 +552,10 @@ async def begin_update( :param product_name: Name of product. Required. :type product_name: str :param properties: The resource properties to be updated. Required. - :type properties: IO + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sphere.models.Product] @@ -634,7 +568,7 @@ async def begin_update( resource_group_name: str, catalog_name: str, product_name: str, - properties: Union[_models.ProductUpdate, IO], + properties: Union[_models.ProductUpdate, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Product]: """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for @@ -648,19 +582,8 @@ async def begin_update( :param product_name: Name of product. Required. :type product_name: str :param properties: The resource properties to be updated. Is either a ProductUpdate type or a - IO type. Required. - :type properties: ~azure.mgmt.sphere.models.ProductUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + IO[bytes] type. Required. + :type properties: ~azure.mgmt.sphere.models.ProductUpdate or IO[bytes] :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sphere.models.Product] @@ -693,7 +616,7 @@ async def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Product", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -705,17 +628,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Product].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" - } + return AsyncLROPoller[_models.Product]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any @@ -734,22 +655,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -765,11 +685,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async async def begin_delete( @@ -785,14 +701,6 @@ async def begin_delete( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -820,7 +728,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -831,22 +739,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def count_devices( self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any - ) -> _models.CountDeviceResponse: + ) -> _models.CountDevicesResponse: """Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used for product name. @@ -857,9 +761,8 @@ async def count_devices( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CountDeviceResponse or the result of cls(response) - :rtype: ~azure.mgmt.sphere.models.CountDeviceResponse + :return: CountDevicesResponse or the result of cls(response) + :rtype: ~azure.mgmt.sphere.models.CountDevicesResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -874,24 +777,23 @@ async def count_devices( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.CountDeviceResponse] = kwargs.pop("cls", None) + cls: ClsType[_models.CountDevicesResponse] = kwargs.pop("cls", None) - request = build_count_devices_request( + _request = build_count_devices_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.count_devices.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -901,16 +803,12 @@ async def count_devices( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CountDeviceResponse", pipeline_response) + deserialized = self._deserialize("CountDevicesResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - count_devices.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/countDevices" - } + return deserialized # type: ignore @distributed_trace def generate_default_device_groups( @@ -926,7 +824,6 @@ def generate_default_device_groups( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DeviceGroup or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sphere.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: @@ -948,18 +845,17 @@ def generate_default_device_groups( def prepare_request(next_link=None): if not next_link: - request = build_generate_default_device_groups_request( + _request = build_generate_default_device_groups_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.generate_default_device_groups.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -971,13 +867,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("DeviceGroupListResult", pipeline_response) @@ -987,11 +883,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1003,7 +899,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - generate_default_device_groups.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/generateDefaultDeviceGroups" - } diff --git a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/models/__init__.py b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/models/__init__.py index af2a07416a3e..0cca1962be11 100644 --- a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/models/__init__.py +++ b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/models/__init__.py @@ -8,6 +8,7 @@ from ._models_py3 import Catalog from ._models_py3 import CatalogListResult +from ._models_py3 import CatalogProperties from ._models_py3 import CatalogUpdate from ._models_py3 import Certificate from ._models_py3 import CertificateChainResponse @@ -15,24 +16,29 @@ from ._models_py3 import CertificateProperties from ._models_py3 import ClaimDevicesRequest from ._models_py3 import CountDeviceResponse +from ._models_py3 import CountDevicesResponse from ._models_py3 import CountElementsResponse from ._models_py3 import Deployment from ._models_py3 import DeploymentListResult +from ._models_py3 import DeploymentProperties from ._models_py3 import Device from ._models_py3 import DeviceGroup from ._models_py3 import DeviceGroupListResult +from ._models_py3 import DeviceGroupProperties from ._models_py3 import DeviceGroupUpdate +from ._models_py3 import DeviceGroupUpdateProperties from ._models_py3 import DeviceInsight from ._models_py3 import DeviceListResult -from ._models_py3 import DevicePatchProperties +from ._models_py3 import DeviceProperties from ._models_py3 import DeviceUpdate +from ._models_py3 import DeviceUpdateProperties from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse from ._models_py3 import GenerateCapabilityImageRequest from ._models_py3 import Image from ._models_py3 import ImageListResult -from ._models_py3 import ImageUploadRequestBody +from ._models_py3 import ImageProperties from ._models_py3 import ListDeviceGroupsRequest from ._models_py3 import Operation from ._models_py3 import OperationDisplay @@ -40,7 +46,9 @@ from ._models_py3 import PagedDeviceInsight from ._models_py3 import Product from ._models_py3 import ProductListResult +from ._models_py3 import ProductProperties from ._models_py3 import ProductUpdate +from ._models_py3 import ProductUpdateProperties from ._models_py3 import ProofOfPossessionNonceRequest from ._models_py3 import ProofOfPossessionNonceResponse from ._models_py3 import ProxyResource @@ -67,6 +75,7 @@ __all__ = [ "Catalog", "CatalogListResult", + "CatalogProperties", "CatalogUpdate", "Certificate", "CertificateChainResponse", @@ -74,24 +83,29 @@ "CertificateProperties", "ClaimDevicesRequest", "CountDeviceResponse", + "CountDevicesResponse", "CountElementsResponse", "Deployment", "DeploymentListResult", + "DeploymentProperties", "Device", "DeviceGroup", "DeviceGroupListResult", + "DeviceGroupProperties", "DeviceGroupUpdate", + "DeviceGroupUpdateProperties", "DeviceInsight", "DeviceListResult", - "DevicePatchProperties", + "DeviceProperties", "DeviceUpdate", + "DeviceUpdateProperties", "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", "GenerateCapabilityImageRequest", "Image", "ImageListResult", - "ImageUploadRequestBody", + "ImageProperties", "ListDeviceGroupsRequest", "Operation", "OperationDisplay", @@ -99,7 +113,9 @@ "PagedDeviceInsight", "Product", "ProductListResult", + "ProductProperties", "ProductUpdate", + "ProductUpdateProperties", "ProofOfPossessionNonceRequest", "ProofOfPossessionNonceResponse", "ProxyResource", diff --git a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/models/_azure_sphere_mgmt_client_enums.py b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/models/_azure_sphere_mgmt_client_enums.py index 57c7a2804411..1f9fa3a9a2e5 100644 --- a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/models/_azure_sphere_mgmt_client_enums.py +++ b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/models/_azure_sphere_mgmt_client_enums.py @@ -129,7 +129,7 @@ class OSFeedType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the resource.""" + """Provisioning state of resource.""" SUCCEEDED = "Succeeded" """Resource has been created.""" diff --git a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/models/_models_py3.py b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/models/_models_py3.py index 85033d4895ac..6d76d57fa0da 100644 --- a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/models/_models_py3.py +++ b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/models/_models_py3.py @@ -23,7 +23,7 @@ class Resource(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -64,10 +64,10 @@ class TrackedResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -117,10 +117,10 @@ class Catalog(TrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -134,9 +134,8 @@ class Catalog(TrackedResource): :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. :vartype location: str - :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - :vartype provisioning_state: str or ~azure.mgmt.sphere.models.ProvisioningState + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.sphere.models.CatalogProperties """ _validation = { @@ -145,7 +144,6 @@ class Catalog(TrackedResource): "type": {"readonly": True}, "system_data": {"readonly": True}, "location": {"required": True}, - "provisioning_state": {"readonly": True}, } _attribute_map = { @@ -155,24 +153,35 @@ class Catalog(TrackedResource): "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "properties": {"key": "properties", "type": "CatalogProperties"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.CatalogProperties"] = None, + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword location: The geo-location where the resource lives. Required. :paramtype location: str + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.sphere.models.CatalogProperties """ super().__init__(tags=tags, location=location, **kwargs) - self.provisioning_state = None + self.properties = properties class CatalogListResult(_serialization.Model): """The response of a Catalog list operation. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. :ivar value: The Catalog items on this page. Required. :vartype value: list[~azure.mgmt.sphere.models.Catalog] @@ -182,6 +191,7 @@ class CatalogListResult(_serialization.Model): _validation = { "value": {"required": True}, + "next_link": {"readonly": True}, } _attribute_map = { @@ -189,16 +199,43 @@ class CatalogListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.Catalog"], next_link: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.Catalog"], **kwargs: Any) -> None: """ :keyword value: The Catalog items on this page. Required. :paramtype value: list[~azure.mgmt.sphere.models.Catalog] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str """ super().__init__(**kwargs) self.value = value - self.next_link = next_link + self.next_link = None + + +class CatalogProperties(_serialization.Model): + """Catalog properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tenant_id: The Azure Sphere tenant ID associated with the catalog. + :vartype tenant_id: str + :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.sphere.models.ProvisioningState + """ + + _validation = { + "tenant_id": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "tenant_id": {"key": "tenantId", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.tenant_id = None + self.provisioning_state = None class CatalogUpdate(_serialization.Model): @@ -228,7 +265,7 @@ class ProxyResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -240,32 +277,14 @@ class ProxyResource(Resource): :vartype system_data: ~azure.mgmt.sphere.models.SystemData """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - - -class Certificate(ProxyResource): # pylint: disable=too-many-instance-attributes +class Certificate(ProxyResource): """An certificate resource belonging to a catalog resource. Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -275,22 +294,8 @@ class Certificate(ProxyResource): # pylint: disable=too-many-instance-attribute :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.sphere.models.SystemData - :ivar certificate: The certificate as a UTF-8 encoded base 64 string. - :vartype certificate: str - :ivar status: The certificate status. Known values are: "Active", "Inactive", "Expired", and - "Revoked". - :vartype status: str or ~azure.mgmt.sphere.models.CertificateStatus - :ivar subject: The certificate subject. - :vartype subject: str - :ivar thumbprint: The certificate thumbprint. - :vartype thumbprint: str - :ivar expiry_utc: The certificate expiry date. - :vartype expiry_utc: ~datetime.datetime - :ivar not_before_utc: The certificate not before date. - :vartype not_before_utc: ~datetime.datetime - :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - :vartype provisioning_state: str or ~azure.mgmt.sphere.models.ProvisioningState + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.sphere.models.CertificateProperties """ _validation = { @@ -298,13 +303,6 @@ class Certificate(ProxyResource): # pylint: disable=too-many-instance-attribute "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "certificate": {"readonly": True}, - "status": {"readonly": True}, - "subject": {"readonly": True}, - "thumbprint": {"readonly": True}, - "expiry_utc": {"readonly": True}, - "not_before_utc": {"readonly": True}, - "provisioning_state": {"readonly": True}, } _attribute_map = { @@ -312,25 +310,16 @@ class Certificate(ProxyResource): # pylint: disable=too-many-instance-attribute "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "certificate": {"key": "properties.certificate", "type": "str"}, - "status": {"key": "properties.status", "type": "str"}, - "subject": {"key": "properties.subject", "type": "str"}, - "thumbprint": {"key": "properties.thumbprint", "type": "str"}, - "expiry_utc": {"key": "properties.expiryUtc", "type": "iso-8601"}, - "not_before_utc": {"key": "properties.notBeforeUtc", "type": "iso-8601"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "properties": {"key": "properties", "type": "CertificateProperties"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, *, properties: Optional["_models.CertificateProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.sphere.models.CertificateProperties + """ super().__init__(**kwargs) - self.certificate = None - self.status = None - self.subject = None - self.thumbprint = None - self.expiry_utc = None - self.not_before_utc = None - self.provisioning_state = None + self.properties = properties class CertificateChainResponse(_serialization.Model): @@ -359,7 +348,9 @@ def __init__(self, **kwargs: Any) -> None: class CertificateListResult(_serialization.Model): """The response of a Certificate list operation. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. :ivar value: The Certificate items on this page. Required. :vartype value: list[~azure.mgmt.sphere.models.Certificate] @@ -369,6 +360,7 @@ class CertificateListResult(_serialization.Model): _validation = { "value": {"required": True}, + "next_link": {"readonly": True}, } _attribute_map = { @@ -376,16 +368,14 @@ class CertificateListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.Certificate"], next_link: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.Certificate"], **kwargs: Any) -> None: """ :keyword value: The Certificate items on this page. Required. :paramtype value: list[~azure.mgmt.sphere.models.Certificate] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str """ super().__init__(**kwargs) self.value = value - self.next_link = next_link + self.next_link = None class CertificateProperties(_serialization.Model): @@ -446,7 +436,7 @@ def __init__(self, **kwargs: Any) -> None: class ClaimDevicesRequest(_serialization.Model): """Request to the action call to bulk claim devices. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar device_identifiers: Device identifiers of the devices to be claimed. Required. :vartype device_identifiers: list[str] @@ -472,7 +462,7 @@ def __init__(self, *, device_identifiers: List[str], **kwargs: Any) -> None: class CountElementsResponse(_serialization.Model): """Response of the count for elements. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: Number of children resources in parent resource. Required. :vartype value: int @@ -496,28 +486,23 @@ def __init__(self, *, value: int, **kwargs: Any) -> None: class CountDeviceResponse(CountElementsResponse): - """Response to the action call for count devices in a catalog. + """Response to the action call for count devices in a catalog (preview API). - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: Number of children resources in parent resource. Required. :vartype value: int """ - _validation = { - "value": {"required": True}, - } - _attribute_map = { - "value": {"key": "value", "type": "int"}, - } +class CountDevicesResponse(CountElementsResponse): + """Response to the action call for count devices in a catalog. - def __init__(self, *, value: int, **kwargs: Any) -> None: - """ - :keyword value: Number of children resources in parent resource. Required. - :paramtype value: int - """ - super().__init__(value=value, **kwargs) + All required parameters must be populated in order to send to server. + + :ivar value: Number of children resources in parent resource. Required. + :vartype value: int + """ class Deployment(ProxyResource): @@ -526,7 +511,7 @@ class Deployment(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -536,15 +521,8 @@ class Deployment(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.sphere.models.SystemData - :ivar deployment_id: Deployment ID. - :vartype deployment_id: str - :ivar deployed_images: Images deployed. - :vartype deployed_images: list[~azure.mgmt.sphere.models.Image] - :ivar deployment_date_utc: Deployment date UTC. - :vartype deployment_date_utc: ~datetime.datetime - :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - :vartype provisioning_state: str or ~azure.mgmt.sphere.models.ProvisioningState + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.sphere.models.DeploymentProperties """ _validation = { @@ -552,8 +530,6 @@ class Deployment(ProxyResource): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "deployment_date_utc": {"readonly": True}, - "provisioning_state": {"readonly": True}, } _attribute_map = { @@ -561,36 +537,24 @@ class Deployment(ProxyResource): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "deployment_id": {"key": "properties.deploymentId", "type": "str"}, - "deployed_images": {"key": "properties.deployedImages", "type": "[Image]"}, - "deployment_date_utc": {"key": "properties.deploymentDateUtc", "type": "iso-8601"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "properties": {"key": "properties", "type": "DeploymentProperties"}, } - def __init__( - self, - *, - deployment_id: Optional[str] = None, - deployed_images: Optional[List["_models.Image"]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, properties: Optional["_models.DeploymentProperties"] = None, **kwargs: Any) -> None: """ - :keyword deployment_id: Deployment ID. - :paramtype deployment_id: str - :keyword deployed_images: Images deployed. - :paramtype deployed_images: list[~azure.mgmt.sphere.models.Image] + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.sphere.models.DeploymentProperties """ super().__init__(**kwargs) - self.deployment_id = deployment_id - self.deployed_images = deployed_images - self.deployment_date_utc = None - self.provisioning_state = None + self.properties = properties class DeploymentListResult(_serialization.Model): """The response of a Deployment list operation. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. :ivar value: The Deployment items on this page. Required. :vartype value: list[~azure.mgmt.sphere.models.Deployment] @@ -600,6 +564,7 @@ class DeploymentListResult(_serialization.Model): _validation = { "value": {"required": True}, + "next_link": {"readonly": True}, } _attribute_map = { @@ -607,25 +572,71 @@ class DeploymentListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.Deployment"], next_link: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.Deployment"], **kwargs: Any) -> None: """ :keyword value: The Deployment items on this page. Required. :paramtype value: list[~azure.mgmt.sphere.models.Deployment] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str """ super().__init__(**kwargs) self.value = value - self.next_link = next_link + self.next_link = None + + +class DeploymentProperties(_serialization.Model): + """The properties of deployment. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar deployment_id: Deployment ID. + :vartype deployment_id: str + :ivar deployed_images: Images deployed. + :vartype deployed_images: list[~azure.mgmt.sphere.models.Image] + :ivar deployment_date_utc: Deployment date UTC. + :vartype deployment_date_utc: ~datetime.datetime + :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.sphere.models.ProvisioningState + """ + _validation = { + "deployment_date_utc": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } -class Device(ProxyResource): # pylint: disable=too-many-instance-attributes + _attribute_map = { + "deployment_id": {"key": "deploymentId", "type": "str"}, + "deployed_images": {"key": "deployedImages", "type": "[Image]"}, + "deployment_date_utc": {"key": "deploymentDateUtc", "type": "iso-8601"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + deployment_id: Optional[str] = None, + deployed_images: Optional[List["_models.Image"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword deployment_id: Deployment ID. + :paramtype deployment_id: str + :keyword deployed_images: Images deployed. + :paramtype deployed_images: list[~azure.mgmt.sphere.models.Image] + """ + super().__init__(**kwargs) + self.deployment_id = deployment_id + self.deployed_images = deployed_images + self.deployment_date_utc = None + self.provisioning_state = None + + +class Device(ProxyResource): """An device resource belonging to a device group resource. Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -635,21 +646,8 @@ class Device(ProxyResource): # pylint: disable=too-many-instance-attributes :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.sphere.models.SystemData - :ivar device_id: Device ID. - :vartype device_id: str - :ivar chip_sku: SKU of the chip. - :vartype chip_sku: str - :ivar last_available_os_version: OS version available for installation when update requested. - :vartype last_available_os_version: str - :ivar last_installed_os_version: OS version running on device when update requested. - :vartype last_installed_os_version: str - :ivar last_os_update_utc: Time when update requested and new OS version available. - :vartype last_os_update_utc: ~datetime.datetime - :ivar last_update_request_utc: Time when update was last requested. - :vartype last_update_request_utc: ~datetime.datetime - :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - :vartype provisioning_state: str or ~azure.mgmt.sphere.models.ProvisioningState + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.sphere.models.DeviceProperties """ _validation = { @@ -657,12 +655,6 @@ class Device(ProxyResource): # pylint: disable=too-many-instance-attributes "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "chip_sku": {"readonly": True}, - "last_available_os_version": {"readonly": True}, - "last_installed_os_version": {"readonly": True}, - "last_os_update_utc": {"readonly": True}, - "last_update_request_utc": {"readonly": True}, - "provisioning_state": {"readonly": True}, } _attribute_map = { @@ -670,37 +662,25 @@ class Device(ProxyResource): # pylint: disable=too-many-instance-attributes "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "device_id": {"key": "properties.deviceId", "type": "str"}, - "chip_sku": {"key": "properties.chipSku", "type": "str"}, - "last_available_os_version": {"key": "properties.lastAvailableOsVersion", "type": "str"}, - "last_installed_os_version": {"key": "properties.lastInstalledOsVersion", "type": "str"}, - "last_os_update_utc": {"key": "properties.lastOsUpdateUtc", "type": "iso-8601"}, - "last_update_request_utc": {"key": "properties.lastUpdateRequestUtc", "type": "iso-8601"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "properties": {"key": "properties", "type": "DeviceProperties"}, } - def __init__(self, *, device_id: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, properties: Optional["_models.DeviceProperties"] = None, **kwargs: Any) -> None: """ - :keyword device_id: Device ID. - :paramtype device_id: str + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.sphere.models.DeviceProperties """ super().__init__(**kwargs) - self.device_id = device_id - self.chip_sku = None - self.last_available_os_version = None - self.last_installed_os_version = None - self.last_os_update_utc = None - self.last_update_request_utc = None - self.provisioning_state = None + self.properties = properties -class DeviceGroup(ProxyResource): # pylint: disable=too-many-instance-attributes +class DeviceGroup(ProxyResource): """An device group resource belonging to a product resource. Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -710,6 +690,72 @@ class DeviceGroup(ProxyResource): # pylint: disable=too-many-instance-attribute :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.sphere.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.sphere.models.DeviceGroupProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "DeviceGroupProperties"}, + } + + def __init__(self, *, properties: Optional["_models.DeviceGroupProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.sphere.models.DeviceGroupProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class DeviceGroupListResult(_serialization.Model): + """The response of a DeviceGroup list operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: The DeviceGroup items on this page. Required. + :vartype value: list[~azure.mgmt.sphere.models.DeviceGroup] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[DeviceGroup]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.DeviceGroup"], **kwargs: Any) -> None: + """ + :keyword value: The DeviceGroup items on this page. Required. + :paramtype value: list[~azure.mgmt.sphere.models.DeviceGroup] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class DeviceGroupProperties(_serialization.Model): + """The properties of deviceGroup. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar description: Description of the device group. :vartype description: str :ivar os_feed_type: Operating system feed type of the device group. Known values are: "Retail" @@ -733,26 +779,18 @@ class DeviceGroup(ProxyResource): # pylint: disable=too-many-instance-attribute """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, "has_deployment": {"readonly": True}, "provisioning_state": {"readonly": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "description": {"key": "properties.description", "type": "str"}, - "os_feed_type": {"key": "properties.osFeedType", "type": "str"}, - "update_policy": {"key": "properties.updatePolicy", "type": "str"}, - "allow_crash_dumps_collection": {"key": "properties.allowCrashDumpsCollection", "type": "str"}, - "regional_data_boundary": {"key": "properties.regionalDataBoundary", "type": "str"}, - "has_deployment": {"key": "properties.hasDeployment", "type": "bool"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "os_feed_type": {"key": "osFeedType", "type": "str"}, + "update_policy": {"key": "updatePolicy", "type": "str"}, + "allow_crash_dumps_collection": {"key": "allowCrashDumpsCollection", "type": "str"}, + "regional_data_boundary": {"key": "regionalDataBoundary", "type": "str"}, + "has_deployment": {"key": "hasDeployment", "type": "bool"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, } def __init__( @@ -792,40 +830,28 @@ def __init__( self.provisioning_state = None -class DeviceGroupListResult(_serialization.Model): - """The response of a DeviceGroup list operation. - - All required parameters must be populated in order to send to Azure. - - :ivar value: The DeviceGroup items on this page. Required. - :vartype value: list[~azure.mgmt.sphere.models.DeviceGroup] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } +class DeviceGroupUpdate(_serialization.Model): + """The type used for update operations of the DeviceGroup. + + :ivar properties: The updatable properties of the DeviceGroup. + :vartype properties: ~azure.mgmt.sphere.models.DeviceGroupUpdateProperties + """ _attribute_map = { - "value": {"key": "value", "type": "[DeviceGroup]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "properties": {"key": "properties", "type": "DeviceGroupUpdateProperties"}, } - def __init__(self, *, value: List["_models.DeviceGroup"], next_link: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, properties: Optional["_models.DeviceGroupUpdateProperties"] = None, **kwargs: Any) -> None: """ - :keyword value: The DeviceGroup items on this page. Required. - :paramtype value: list[~azure.mgmt.sphere.models.DeviceGroup] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str + :keyword properties: The updatable properties of the DeviceGroup. + :paramtype properties: ~azure.mgmt.sphere.models.DeviceGroupUpdateProperties """ super().__init__(**kwargs) - self.value = value - self.next_link = next_link + self.properties = properties -class DeviceGroupUpdate(_serialization.Model): - """The type used for update operations of the DeviceGroup. +class DeviceGroupUpdateProperties(_serialization.Model): + """The updatable properties of the DeviceGroup. :ivar description: Description of the device group. :vartype description: str @@ -845,11 +871,11 @@ class DeviceGroupUpdate(_serialization.Model): """ _attribute_map = { - "description": {"key": "properties.description", "type": "str"}, - "os_feed_type": {"key": "properties.osFeedType", "type": "str"}, - "update_policy": {"key": "properties.updatePolicy", "type": "str"}, - "allow_crash_dumps_collection": {"key": "properties.allowCrashDumpsCollection", "type": "str"}, - "regional_data_boundary": {"key": "properties.regionalDataBoundary", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "os_feed_type": {"key": "osFeedType", "type": "str"}, + "update_policy": {"key": "updatePolicy", "type": "str"}, + "allow_crash_dumps_collection": {"key": "allowCrashDumpsCollection", "type": "str"}, + "regional_data_boundary": {"key": "regionalDataBoundary", "type": "str"}, } def __init__( @@ -890,7 +916,7 @@ def __init__( class DeviceInsight(_serialization.Model): """Device insight report. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar device_id: Device ID. Required. :vartype device_id: str @@ -977,7 +1003,9 @@ def __init__( class DeviceListResult(_serialization.Model): """The response of a Device list operation. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. :ivar value: The Device items on this page. Required. :vartype value: list[~azure.mgmt.sphere.models.Device] @@ -987,6 +1015,7 @@ class DeviceListResult(_serialization.Model): _validation = { "value": {"required": True}, + "next_link": {"readonly": True}, } _attribute_map = { @@ -994,53 +1023,101 @@ class DeviceListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.Device"], next_link: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.Device"], **kwargs: Any) -> None: """ :keyword value: The Device items on this page. Required. :paramtype value: list[~azure.mgmt.sphere.models.Device] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str """ super().__init__(**kwargs) self.value = value - self.next_link = next_link + self.next_link = None -class DevicePatchProperties(_serialization.Model): - """The properties of device patch. +class DeviceProperties(_serialization.Model): + """The properties of device. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar device_group_id: Device group id. Required. - :vartype device_group_id: str + :ivar device_id: Device ID. + :vartype device_id: str + :ivar chip_sku: SKU of the chip. + :vartype chip_sku: str + :ivar last_available_os_version: OS version available for installation when update requested. + :vartype last_available_os_version: str + :ivar last_installed_os_version: OS version running on device when update requested. + :vartype last_installed_os_version: str + :ivar last_os_update_utc: Time when update requested and new OS version available. + :vartype last_os_update_utc: ~datetime.datetime + :ivar last_update_request_utc: Time when update was last requested. + :vartype last_update_request_utc: ~datetime.datetime + :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.sphere.models.ProvisioningState """ _validation = { - "device_group_id": {"required": True}, + "chip_sku": {"readonly": True}, + "last_available_os_version": {"readonly": True}, + "last_installed_os_version": {"readonly": True}, + "last_os_update_utc": {"readonly": True}, + "last_update_request_utc": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - "device_group_id": {"key": "deviceGroupId", "type": "str"}, + "device_id": {"key": "deviceId", "type": "str"}, + "chip_sku": {"key": "chipSku", "type": "str"}, + "last_available_os_version": {"key": "lastAvailableOsVersion", "type": "str"}, + "last_installed_os_version": {"key": "lastInstalledOsVersion", "type": "str"}, + "last_os_update_utc": {"key": "lastOsUpdateUtc", "type": "iso-8601"}, + "last_update_request_utc": {"key": "lastUpdateRequestUtc", "type": "iso-8601"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, } - def __init__(self, *, device_group_id: str, **kwargs: Any) -> None: + def __init__(self, *, device_id: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword device_group_id: Device group id. Required. - :paramtype device_group_id: str + :keyword device_id: Device ID. + :paramtype device_id: str """ super().__init__(**kwargs) - self.device_group_id = device_group_id + self.device_id = device_id + self.chip_sku = None + self.last_available_os_version = None + self.last_installed_os_version = None + self.last_os_update_utc = None + self.last_update_request_utc = None + self.provisioning_state = None class DeviceUpdate(_serialization.Model): """The type used for update operations of the Device. + :ivar properties: The updatable properties of the Device. + :vartype properties: ~azure.mgmt.sphere.models.DeviceUpdateProperties + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "DeviceUpdateProperties"}, + } + + def __init__(self, *, properties: Optional["_models.DeviceUpdateProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The updatable properties of the Device. + :paramtype properties: ~azure.mgmt.sphere.models.DeviceUpdateProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class DeviceUpdateProperties(_serialization.Model): + """The updatable properties of the Device. + :ivar device_group_id: Device group id. :vartype device_group_id: str """ _attribute_map = { - "device_group_id": {"key": "properties.deviceGroupId", "type": "str"}, + "device_group_id": {"key": "deviceGroupId", "type": "str"}, } def __init__(self, *, device_group_id: Optional[str] = None, **kwargs: Any) -> None: @@ -1147,7 +1224,7 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: A class GenerateCapabilityImageRequest(_serialization.Model): """Request of the action to create a signed device capability image. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar capabilities: List of capabilities to create. Required. :vartype capabilities: list[str or ~azure.mgmt.sphere.models.CapabilityType] @@ -1170,13 +1247,13 @@ def __init__(self, *, capabilities: List[Union[str, "_models.CapabilityType"]], self.capabilities = capabilities -class Image(ProxyResource): # pylint: disable=too-many-instance-attributes +class Image(ProxyResource): """An image resource belonging to a catalog resource. Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1186,6 +1263,72 @@ class Image(ProxyResource): # pylint: disable=too-many-instance-attributes :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.sphere.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.sphere.models.ImageProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "ImageProperties"}, + } + + def __init__(self, *, properties: Optional["_models.ImageProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.sphere.models.ImageProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ImageListResult(_serialization.Model): + """The response of a Image list operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: The Image items on this page. Required. + :vartype value: list[~azure.mgmt.sphere.models.Image] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Image]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.Image"], **kwargs: Any) -> None: + """ + :keyword value: The Image items on this page. Required. + :paramtype value: list[~azure.mgmt.sphere.models.Image] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class ImageProperties(_serialization.Model): + """The properties of image. + + Variables are only populated by the server, and will be ignored when sending a request. + :ivar image: Image as a UTF-8 encoded base 64 string on image create. This field contains the image URI on image reads. :vartype image: str @@ -1215,10 +1358,6 @@ class Image(ProxyResource): # pylint: disable=too-many-instance-attributes """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, "image_name": {"readonly": True}, "uri": {"readonly": True}, "description": {"readonly": True}, @@ -1228,19 +1367,15 @@ class Image(ProxyResource): # pylint: disable=too-many-instance-attributes } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "image": {"key": "properties.image", "type": "str"}, - "image_id": {"key": "properties.imageId", "type": "str"}, - "image_name": {"key": "properties.imageName", "type": "str"}, - "regional_data_boundary": {"key": "properties.regionalDataBoundary", "type": "str"}, - "uri": {"key": "properties.uri", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "component_id": {"key": "properties.componentId", "type": "str"}, - "image_type": {"key": "properties.imageType", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "image": {"key": "image", "type": "str"}, + "image_id": {"key": "imageId", "type": "str"}, + "image_name": {"key": "imageName", "type": "str"}, + "regional_data_boundary": {"key": "regionalDataBoundary", "type": "str"}, + "uri": {"key": "uri", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "component_id": {"key": "componentId", "type": "str"}, + "image_type": {"key": "imageType", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, } def __init__( @@ -1273,64 +1408,6 @@ def __init__( self.provisioning_state = None -class ImageListResult(_serialization.Model): - """The response of a Image list operation. - - All required parameters must be populated in order to send to Azure. - - :ivar value: The Image items on this page. Required. - :vartype value: list[~azure.mgmt.sphere.models.Image] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Image]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.Image"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The Image items on this page. Required. - :paramtype value: list[~azure.mgmt.sphere.models.Image] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ImageUploadRequestBody(_serialization.Model): - """Image upload request body. - - All required parameters must be populated in order to send to Azure. - - :ivar images: . Required. - :vartype images: str - """ - - _validation = { - "images": {"required": True}, - } - - _attribute_map = { - "images": {"key": "images", "type": "str"}, - } - - def __init__(self, *, images: str, **kwargs: Any) -> None: - """ - :keyword images: . Required. - :paramtype images: str - """ - super().__init__(**kwargs) - self.images = images - - class ListDeviceGroupsRequest(_serialization.Model): """Request of the action to list device groups for a catalog. @@ -1475,7 +1552,9 @@ def __init__(self, **kwargs: Any) -> None: class PagedDeviceInsight(_serialization.Model): """Paged collection of DeviceInsight items. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. :ivar value: The DeviceInsight items on this page. Required. :vartype value: list[~azure.mgmt.sphere.models.DeviceInsight] @@ -1485,6 +1564,7 @@ class PagedDeviceInsight(_serialization.Model): _validation = { "value": {"required": True}, + "next_link": {"readonly": True}, } _attribute_map = { @@ -1492,16 +1572,14 @@ class PagedDeviceInsight(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.DeviceInsight"], next_link: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.DeviceInsight"], **kwargs: Any) -> None: """ :keyword value: The DeviceInsight items on this page. Required. :paramtype value: list[~azure.mgmt.sphere.models.DeviceInsight] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str """ super().__init__(**kwargs) self.value = value - self.next_link = next_link + self.next_link = None class Product(ProxyResource): @@ -1510,7 +1588,7 @@ class Product(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1520,11 +1598,8 @@ class Product(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.sphere.models.SystemData - :ivar description: Description of the product. - :vartype description: str - :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - :vartype provisioning_state: str or ~azure.mgmt.sphere.models.ProvisioningState + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.sphere.models.ProductProperties """ _validation = { @@ -1532,7 +1607,6 @@ class Product(ProxyResource): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "provisioning_state": {"readonly": True}, } _attribute_map = { @@ -1540,24 +1614,24 @@ class Product(ProxyResource): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "description": {"key": "properties.description", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "properties": {"key": "properties", "type": "ProductProperties"}, } - def __init__(self, *, description: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, properties: Optional["_models.ProductProperties"] = None, **kwargs: Any) -> None: """ - :keyword description: Description of the product. - :paramtype description: str + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: ~azure.mgmt.sphere.models.ProductProperties """ super().__init__(**kwargs) - self.description = description - self.provisioning_state = None + self.properties = properties class ProductListResult(_serialization.Model): """The response of a Product list operation. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. :ivar value: The Product items on this page. Required. :vartype value: list[~azure.mgmt.sphere.models.Product] @@ -1567,6 +1641,7 @@ class ProductListResult(_serialization.Model): _validation = { "value": {"required": True}, + "next_link": {"readonly": True}, } _attribute_map = { @@ -1574,27 +1649,76 @@ class ProductListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.Product"], next_link: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.Product"], **kwargs: Any) -> None: """ :keyword value: The Product items on this page. Required. :paramtype value: list[~azure.mgmt.sphere.models.Product] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str """ super().__init__(**kwargs) self.value = value - self.next_link = next_link + self.next_link = None + + +class ProductProperties(_serialization.Model): + """The properties of product. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar description: Description of the product. + :vartype description: str + :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.sphere.models.ProvisioningState + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__(self, *, description: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword description: Description of the product. + :paramtype description: str + """ + super().__init__(**kwargs) + self.description = description + self.provisioning_state = None class ProductUpdate(_serialization.Model): """The type used for update operations of the Product. + :ivar properties: The updatable properties of the Product. + :vartype properties: ~azure.mgmt.sphere.models.ProductUpdateProperties + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "ProductUpdateProperties"}, + } + + def __init__(self, *, properties: Optional["_models.ProductUpdateProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The updatable properties of the Product. + :paramtype properties: ~azure.mgmt.sphere.models.ProductUpdateProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ProductUpdateProperties(_serialization.Model): + """The updatable properties of the Product. + :ivar description: Description of the product. :vartype description: str """ _attribute_map = { - "description": {"key": "properties.description", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__(self, *, description: Optional[str] = None, **kwargs: Any) -> None: @@ -1609,7 +1733,7 @@ def __init__(self, *, description: Optional[str] = None, **kwargs: Any) -> None: class ProofOfPossessionNonceRequest(_serialization.Model): """Request for the proof of possession nonce. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar proof_of_possession_nonce: The proof of possession nonce. Required. :vartype proof_of_possession_nonce: str @@ -1655,30 +1779,6 @@ class ProofOfPossessionNonceResponse(CertificateProperties): :vartype provisioning_state: str or ~azure.mgmt.sphere.models.ProvisioningState """ - _validation = { - "certificate": {"readonly": True}, - "status": {"readonly": True}, - "subject": {"readonly": True}, - "thumbprint": {"readonly": True}, - "expiry_utc": {"readonly": True}, - "not_before_utc": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "certificate": {"key": "certificate", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "subject": {"key": "subject", "type": "str"}, - "thumbprint": {"key": "thumbprint", "type": "str"}, - "expiry_utc": {"key": "expiryUtc", "type": "iso-8601"}, - "not_before_utc": {"key": "notBeforeUtc", "type": "iso-8601"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - class SignedCapabilityImageResponse(_serialization.Model): """Signed device capability image response. diff --git a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/operations/_catalogs_operations.py b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/operations/_catalogs_operations.py index 371240c6f7c9..c3239696b6e6 100644 --- a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/operations/_catalogs_operations.py +++ b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/operations/_catalogs_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -30,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +43,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +52,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -67,7 +67,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +82,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -97,7 +97,7 @@ def build_get_request(resource_group_name: str, catalog_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -113,7 +113,7 @@ def build_get_request(resource_group_name: str, catalog_name: str, subscription_ "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str", pattern=r"^[A-Za-z0-9_-]{1,50}$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -130,7 +130,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -147,7 +147,7 @@ def build_create_or_update_request( "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str", pattern=r"^[A-Za-z0-9_-]{1,50}$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -166,7 +166,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -183,7 +183,7 @@ def build_update_request( "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str", pattern=r"^[A-Za-z0-9_-]{1,50}$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -202,7 +202,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -218,7 +218,7 @@ def build_delete_request( "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str", pattern=r"^[A-Za-z0-9_-]{1,50}$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -235,7 +235,7 @@ def build_count_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -251,7 +251,7 @@ def build_count_devices_request( "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str", pattern=r"^[A-Za-z0-9_-]{1,50}$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -276,7 +276,7 @@ def build_list_deployments_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -292,7 +292,7 @@ def build_list_deployments_request( "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str", pattern=r"^[A-Za-z0-9_-]{1,50}$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -325,7 +325,7 @@ def build_list_device_groups_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -342,7 +342,7 @@ def build_list_device_groups_request( "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str", pattern=r"^[A-Za-z0-9_-]{1,50}$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -377,7 +377,7 @@ def build_list_device_insights_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -393,7 +393,7 @@ def build_list_device_insights_request( "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str", pattern=r"^[A-Za-z0-9_-]{1,50}$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -426,7 +426,7 @@ def build_list_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -442,7 +442,7 @@ def build_list_devices_request( "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str", pattern=r"^[A-Za-z0-9_-]{1,50}$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -461,6 +461,42 @@ def build_list_devices_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) +def build_upload_image_request( + resource_group_name: str, catalog_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/uploadImage", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str", pattern=r"^[A-Za-z0-9_-]{1,50}$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + class CatalogsOperations: """ .. warning:: @@ -484,7 +520,6 @@ def __init__(self, *args, **kwargs): def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Catalog"]: """List Catalog resources by subscription ID. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Catalog or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.sphere.models.Catalog] :raises ~azure.core.exceptions.HttpResponseError: @@ -506,15 +541,14 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Catalog"]: def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -526,13 +560,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("CatalogListResult", pipeline_response) @@ -542,11 +576,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -559,8 +593,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureSphere/catalogs"} - @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Catalog"]: """List Catalog resources by resource group. @@ -568,7 +600,6 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Catalog or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.sphere.models.Catalog] :raises ~azure.core.exceptions.HttpResponseError: @@ -590,16 +621,15 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -611,13 +641,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("CatalogListResult", pipeline_response) @@ -627,11 +657,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -644,10 +674,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs" - } - @distributed_trace def get(self, resource_group_name: str, catalog_name: str, **kwargs: Any) -> _models.Catalog: """Get a Catalog. @@ -657,7 +683,6 @@ def get(self, resource_group_name: str, catalog_name: str, **kwargs: Any) -> _mo :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Catalog or the result of cls(response) :rtype: ~azure.mgmt.sphere.models.Catalog :raises ~azure.core.exceptions.HttpResponseError: @@ -676,21 +701,20 @@ def get(self, resource_group_name: str, catalog_name: str, **kwargs: Any) -> _mo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Catalog] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -703,16 +727,12 @@ def get(self, resource_group_name: str, catalog_name: str, **kwargs: Any) -> _mo deserialized = self._deserialize("Catalog", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}" - } + return deserialized # type: ignore def _create_or_update_initial( - self, resource_group_name: str, catalog_name: str, resource: Union[_models.Catalog, IO], **kwargs: Any + self, resource_group_name: str, catalog_name: str, resource: Union[_models.Catalog, IO[bytes]], **kwargs: Any ) -> _models.Catalog: error_map = { 401: ClientAuthenticationError, @@ -737,7 +757,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(resource, "Catalog") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, @@ -745,16 +765,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -778,10 +797,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}" - } - @overload def begin_create_or_update( self, @@ -804,14 +819,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Catalog or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sphere.models.Catalog] :raises ~azure.core.exceptions.HttpResponseError: @@ -822,7 +829,7 @@ def begin_create_or_update( self, resource_group_name: str, catalog_name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -835,18 +842,10 @@ def begin_create_or_update( :param catalog_name: Name of catalog. Required. :type catalog_name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Catalog or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sphere.models.Catalog] :raises ~azure.core.exceptions.HttpResponseError: @@ -854,7 +853,7 @@ def begin_create_or_update( @distributed_trace def begin_create_or_update( - self, resource_group_name: str, catalog_name: str, resource: Union[_models.Catalog, IO], **kwargs: Any + self, resource_group_name: str, catalog_name: str, resource: Union[_models.Catalog, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Catalog]: """Create a Catalog. @@ -863,19 +862,9 @@ def begin_create_or_update( :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param resource: Resource create parameters. Is either a Catalog type or a IO type. Required. - :type resource: ~azure.mgmt.sphere.models.Catalog or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param resource: Resource create parameters. Is either a Catalog type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.sphere.models.Catalog or IO[bytes] :return: An instance of LROPoller that returns either Catalog or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sphere.models.Catalog] :raises ~azure.core.exceptions.HttpResponseError: @@ -906,7 +895,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Catalog", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -918,17 +907,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Catalog].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - 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.AzureSphere/catalogs/{catalogName}" - } + return LROPoller[_models.Catalog]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload def update( @@ -952,7 +939,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Catalog or the result of cls(response) :rtype: ~azure.mgmt.sphere.models.Catalog :raises ~azure.core.exceptions.HttpResponseError: @@ -963,7 +949,7 @@ def update( self, resource_group_name: str, catalog_name: str, - properties: IO, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -976,11 +962,10 @@ def update( :param catalog_name: Name of catalog. Required. :type catalog_name: str :param properties: The resource properties to be updated. Required. - :type properties: IO + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Catalog or the result of cls(response) :rtype: ~azure.mgmt.sphere.models.Catalog :raises ~azure.core.exceptions.HttpResponseError: @@ -988,7 +973,11 @@ def update( @distributed_trace def update( - self, resource_group_name: str, catalog_name: str, properties: Union[_models.CatalogUpdate, IO], **kwargs: Any + self, + resource_group_name: str, + catalog_name: str, + properties: Union[_models.CatalogUpdate, IO[bytes]], + **kwargs: Any ) -> _models.Catalog: """Update a Catalog. @@ -998,12 +987,8 @@ def update( :param catalog_name: Name of catalog. Required. :type catalog_name: str :param properties: The resource properties to be updated. Is either a CatalogUpdate type or a - IO type. Required. - :type properties: ~azure.mgmt.sphere.models.CatalogUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + IO[bytes] type. Required. + :type properties: ~azure.mgmt.sphere.models.CatalogUpdate or IO[bytes] :return: Catalog or the result of cls(response) :rtype: ~azure.mgmt.sphere.models.Catalog :raises ~azure.core.exceptions.HttpResponseError: @@ -1031,7 +1016,7 @@ def update( else: _json = self._serialize.body(properties, "CatalogUpdate") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, @@ -1039,16 +1024,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1061,13 +1045,9 @@ def update( deserialized = self._deserialize("Catalog", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}" - } + return deserialized # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, catalog_name: str, **kwargs: Any @@ -1086,21 +1066,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1116,11 +1095,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, catalog_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1131,14 +1106,6 @@ def begin_delete(self, resource_group_name: str, catalog_name: str, **kwargs: An :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1165,7 +1132,7 @@ def begin_delete(self, resource_group_name: str, catalog_name: str, **kwargs: An def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -1176,20 +1143,16 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def count_devices(self, resource_group_name: str, catalog_name: str, **kwargs: Any) -> _models.CountDeviceResponse: + def count_devices(self, resource_group_name: str, catalog_name: str, **kwargs: Any) -> _models.CountDevicesResponse: """Counts devices in catalog. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1197,9 +1160,8 @@ def count_devices(self, resource_group_name: str, catalog_name: str, **kwargs: A :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CountDeviceResponse or the result of cls(response) - :rtype: ~azure.mgmt.sphere.models.CountDeviceResponse + :return: CountDevicesResponse or the result of cls(response) + :rtype: ~azure.mgmt.sphere.models.CountDevicesResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -1214,23 +1176,22 @@ def count_devices(self, resource_group_name: str, catalog_name: str, **kwargs: A _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.CountDeviceResponse] = kwargs.pop("cls", None) + cls: ClsType[_models.CountDevicesResponse] = kwargs.pop("cls", None) - request = build_count_devices_request( + _request = build_count_devices_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.count_devices.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1240,16 +1201,12 @@ def count_devices(self, resource_group_name: str, catalog_name: str, **kwargs: A error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CountDeviceResponse", pipeline_response) + deserialized = self._deserialize("CountDevicesResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - count_devices.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/countDevices" - } + return deserialized # type: ignore @distributed_trace def list_deployments( @@ -1277,7 +1234,6 @@ def list_deployments( :type skip: int :param maxpagesize: The maximum number of result items per page. Default value is None. :type maxpagesize: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Deployment or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.sphere.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: @@ -1299,7 +1255,7 @@ def list_deployments( def prepare_request(next_link=None): if not next_link: - request = build_list_deployments_request( + _request = build_list_deployments_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, @@ -1308,12 +1264,11 @@ def prepare_request(next_link=None): skip=skip, maxpagesize=maxpagesize, api_version=api_version, - template_url=self.list_deployments.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1325,13 +1280,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("DeploymentListResult", pipeline_response) @@ -1341,11 +1296,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1358,10 +1313,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_deployments.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDeployments" - } - @overload def list_device_groups( self, @@ -1396,7 +1347,6 @@ def list_device_groups( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DeviceGroup or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.sphere.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: @@ -1407,7 +1357,7 @@ def list_device_groups( self, resource_group_name: str, catalog_name: str, - list_device_groups_request: IO, + list_device_groups_request: IO[bytes], filter: Optional[str] = None, top: Optional[int] = None, skip: Optional[int] = None, @@ -1424,7 +1374,7 @@ def list_device_groups( :param catalog_name: Name of catalog. Required. :type catalog_name: str :param list_device_groups_request: List device groups for catalog. Required. - :type list_device_groups_request: IO + :type list_device_groups_request: IO[bytes] :param filter: Filter the result list using the given expression. Default value is None. :type filter: str :param top: The number of result items to return. Default value is None. @@ -1436,7 +1386,6 @@ def list_device_groups( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DeviceGroup or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.sphere.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: @@ -1447,7 +1396,7 @@ def list_device_groups( self, resource_group_name: str, catalog_name: str, - list_device_groups_request: Union[_models.ListDeviceGroupsRequest, IO], + list_device_groups_request: Union[_models.ListDeviceGroupsRequest, IO[bytes]], filter: Optional[str] = None, top: Optional[int] = None, skip: Optional[int] = None, @@ -1462,8 +1411,9 @@ def list_device_groups( :param catalog_name: Name of catalog. Required. :type catalog_name: str :param list_device_groups_request: List device groups for catalog. Is either a - ListDeviceGroupsRequest type or a IO type. Required. - :type list_device_groups_request: ~azure.mgmt.sphere.models.ListDeviceGroupsRequest or IO + ListDeviceGroupsRequest type or a IO[bytes] type. Required. + :type list_device_groups_request: ~azure.mgmt.sphere.models.ListDeviceGroupsRequest or + IO[bytes] :param filter: Filter the result list using the given expression. Default value is None. :type filter: str :param top: The number of result items to return. Default value is None. @@ -1472,10 +1422,6 @@ def list_device_groups( :type skip: int :param maxpagesize: The maximum number of result items per page. Default value is None. :type maxpagesize: int - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DeviceGroup or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.sphere.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: @@ -1505,7 +1451,7 @@ def list_device_groups( def prepare_request(next_link=None): if not next_link: - request = build_list_device_groups_request( + _request = build_list_device_groups_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, @@ -1517,12 +1463,11 @@ def prepare_request(next_link=None): content_type=content_type, json=_json, content=_content, - template_url=self.list_device_groups.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1534,13 +1479,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("DeviceGroupListResult", pipeline_response) @@ -1550,11 +1495,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1567,10 +1512,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_device_groups.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDeviceGroups" - } - @distributed_trace def list_device_insights( self, @@ -1597,7 +1538,6 @@ def list_device_insights( :type skip: int :param maxpagesize: The maximum number of result items per page. Default value is None. :type maxpagesize: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DeviceInsight or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.sphere.models.DeviceInsight] :raises ~azure.core.exceptions.HttpResponseError: @@ -1619,7 +1559,7 @@ def list_device_insights( def prepare_request(next_link=None): if not next_link: - request = build_list_device_insights_request( + _request = build_list_device_insights_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, @@ -1628,12 +1568,11 @@ def prepare_request(next_link=None): skip=skip, maxpagesize=maxpagesize, api_version=api_version, - template_url=self.list_device_insights.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1645,13 +1584,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PagedDeviceInsight", pipeline_response) @@ -1661,11 +1600,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1678,10 +1617,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_device_insights.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDeviceInsights" - } - @distributed_trace def list_devices( self, @@ -1708,7 +1643,6 @@ def list_devices( :type skip: int :param maxpagesize: The maximum number of result items per page. Default value is None. :type maxpagesize: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Device or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.sphere.models.Device] :raises ~azure.core.exceptions.HttpResponseError: @@ -1730,7 +1664,7 @@ def list_devices( def prepare_request(next_link=None): if not next_link: - request = build_list_devices_request( + _request = build_list_devices_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, @@ -1739,12 +1673,11 @@ def prepare_request(next_link=None): skip=skip, maxpagesize=maxpagesize, api_version=api_version, - template_url=self.list_devices.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1756,13 +1689,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("DeviceListResult", pipeline_response) @@ -1772,11 +1705,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1789,6 +1722,185 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_devices.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDevices" - } + def _upload_image_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + catalog_name: str, + upload_image_request: Union[_models.Image, IO[bytes]], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + 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 + _content = None + if isinstance(upload_image_request, (IOBase, bytes)): + _content = upload_image_request + else: + _json = self._serialize.body(upload_image_request, "Image") + + _request = build_upload_image_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @overload + def begin_upload_image( + self, + resource_group_name: str, + catalog_name: str, + upload_image_request: _models.Image, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Creates an image. Use this action when the image ID is unknown. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param upload_image_request: Image upload request body. Required. + :type upload_image_request: ~azure.mgmt.sphere.models.Image + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_upload_image( + self, + resource_group_name: str, + catalog_name: str, + upload_image_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Creates an image. Use this action when the image ID is unknown. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param upload_image_request: Image upload request body. Required. + :type upload_image_request: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_upload_image( + self, + resource_group_name: str, + catalog_name: str, + upload_image_request: Union[_models.Image, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Creates an image. Use this action when the image ID is unknown. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param upload_image_request: Image upload request body. Is either a Image type or a IO[bytes] + type. Required. + :type upload_image_request: ~azure.mgmt.sphere.models.Image or IO[bytes] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + 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: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._upload_image_initial( # type: ignore + resource_group_name=resource_group_name, + catalog_name=catalog_name, + upload_image_request=upload_image_request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/operations/_certificates_operations.py b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/operations/_certificates_operations.py index 28dc86682851..93d4c9ffd01e 100644 --- a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/operations/_certificates_operations.py +++ b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/operations/_certificates_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -28,7 +28,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +51,7 @@ def build_list_by_catalog_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,9 +67,10 @@ def build_list_by_catalog_request( "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str", pattern=r"^[A-Za-z0-9_-]{1,50}$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: _params["$filter"] = _SERIALIZER.query("filter", filter, "str") if top is not None: @@ -78,7 +79,6 @@ def build_list_by_catalog_request( _params["$skip"] = _SERIALIZER.query("skip", skip, "int") if maxpagesize is not None: _params["$maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "int") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -92,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +109,7 @@ def build_get_request( "serialNumber": _SERIALIZER.url("serial_number", serial_number, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -126,7 +126,7 @@ def build_retrieve_cert_chain_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -143,7 +143,7 @@ def build_retrieve_cert_chain_request( "serialNumber": _SERIALIZER.url("serial_number", serial_number, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -154,13 +154,13 @@ def build_retrieve_cert_chain_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_retrieve_proof_of_possession_nonce_request( +def build_retrieve_proof_of_possession_nonce_request( # pylint: disable=name-too-long resource_group_name: str, catalog_name: str, serial_number: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -178,7 +178,7 @@ def build_retrieve_proof_of_possession_nonce_request( "serialNumber": _SERIALIZER.url("serial_number", serial_number, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -236,7 +236,6 @@ def list_by_catalog( :type skip: int :param maxpagesize: The maximum number of result items per page. Default value is None. :type maxpagesize: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Certificate or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.sphere.models.Certificate] :raises ~azure.core.exceptions.HttpResponseError: @@ -258,7 +257,7 @@ def list_by_catalog( def prepare_request(next_link=None): if not next_link: - request = build_list_by_catalog_request( + _request = build_list_by_catalog_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, @@ -267,12 +266,11 @@ def prepare_request(next_link=None): skip=skip, maxpagesize=maxpagesize, api_version=api_version, - template_url=self.list_by_catalog.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -284,13 +282,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("CertificateListResult", pipeline_response) @@ -300,11 +298,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -317,10 +315,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_catalog.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates" - } - @distributed_trace def get( self, resource_group_name: str, catalog_name: str, serial_number: str, **kwargs: Any @@ -335,7 +329,6 @@ def get( :param serial_number: Serial number of the certificate. Use '.default' to get current active certificate. Required. :type serial_number: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Certificate or the result of cls(response) :rtype: ~azure.mgmt.sphere.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: @@ -354,22 +347,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, catalog_name=catalog_name, serial_number=serial_number, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -382,13 +374,9 @@ def get( deserialized = self._deserialize("Certificate", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}" - } + return deserialized # type: ignore @distributed_trace def retrieve_cert_chain( @@ -404,7 +392,6 @@ def retrieve_cert_chain( :param serial_number: Serial number of the certificate. Use '.default' to get current active certificate. Required. :type serial_number: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateChainResponse or the result of cls(response) :rtype: ~azure.mgmt.sphere.models.CertificateChainResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -423,22 +410,21 @@ def retrieve_cert_chain( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CertificateChainResponse] = kwargs.pop("cls", None) - request = build_retrieve_cert_chain_request( + _request = build_retrieve_cert_chain_request( resource_group_name=resource_group_name, catalog_name=catalog_name, serial_number=serial_number, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.retrieve_cert_chain.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -451,13 +437,9 @@ def retrieve_cert_chain( deserialized = self._deserialize("CertificateChainResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - retrieve_cert_chain.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}/retrieveCertChain" - } + return deserialized # type: ignore @overload def retrieve_proof_of_possession_nonce( @@ -486,7 +468,6 @@ def retrieve_proof_of_possession_nonce( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ProofOfPossessionNonceResponse or the result of cls(response) :rtype: ~azure.mgmt.sphere.models.ProofOfPossessionNonceResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -498,7 +479,7 @@ def retrieve_proof_of_possession_nonce( resource_group_name: str, catalog_name: str, serial_number: str, - proof_of_possession_nonce_request: IO, + proof_of_possession_nonce_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -514,11 +495,10 @@ def retrieve_proof_of_possession_nonce( certificate. Required. :type serial_number: str :param proof_of_possession_nonce_request: Proof of possession nonce request body. Required. - :type proof_of_possession_nonce_request: IO + :type proof_of_possession_nonce_request: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ProofOfPossessionNonceResponse or the result of cls(response) :rtype: ~azure.mgmt.sphere.models.ProofOfPossessionNonceResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -530,7 +510,7 @@ def retrieve_proof_of_possession_nonce( resource_group_name: str, catalog_name: str, serial_number: str, - proof_of_possession_nonce_request: Union[_models.ProofOfPossessionNonceRequest, IO], + proof_of_possession_nonce_request: Union[_models.ProofOfPossessionNonceRequest, IO[bytes]], **kwargs: Any ) -> _models.ProofOfPossessionNonceResponse: """Gets the proof of possession nonce. @@ -544,13 +524,9 @@ def retrieve_proof_of_possession_nonce( certificate. Required. :type serial_number: str :param proof_of_possession_nonce_request: Proof of possession nonce request body. Is either a - ProofOfPossessionNonceRequest type or a IO type. Required. + ProofOfPossessionNonceRequest type or a IO[bytes] type. Required. :type proof_of_possession_nonce_request: - ~azure.mgmt.sphere.models.ProofOfPossessionNonceRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ~azure.mgmt.sphere.models.ProofOfPossessionNonceRequest or IO[bytes] :return: ProofOfPossessionNonceResponse or the result of cls(response) :rtype: ~azure.mgmt.sphere.models.ProofOfPossessionNonceResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -578,7 +554,7 @@ def retrieve_proof_of_possession_nonce( else: _json = self._serialize.body(proof_of_possession_nonce_request, "ProofOfPossessionNonceRequest") - request = build_retrieve_proof_of_possession_nonce_request( + _request = build_retrieve_proof_of_possession_nonce_request( resource_group_name=resource_group_name, catalog_name=catalog_name, serial_number=serial_number, @@ -587,16 +563,15 @@ def retrieve_proof_of_possession_nonce( content_type=content_type, json=_json, content=_content, - template_url=self.retrieve_proof_of_possession_nonce.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -609,10 +584,6 @@ def retrieve_proof_of_possession_nonce( deserialized = self._deserialize("ProofOfPossessionNonceResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - retrieve_proof_of_possession_nonce.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}/retrieveProofOfPossessionNonce" - } + return deserialized # type: ignore diff --git a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/operations/_deployments_operations.py b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/operations/_deployments_operations.py index c4f0698a825e..cb6b9f96acce 100644 --- a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/operations/_deployments_operations.py +++ b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/operations/_deployments_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -30,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +55,7 @@ def build_list_by_device_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80,9 +80,10 @@ def build_list_by_device_group_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: _params["$filter"] = _SERIALIZER.query("filter", filter, "str") if top is not None: @@ -91,7 +92,6 @@ def build_list_by_device_group_request( _params["$skip"] = _SERIALIZER.query("skip", skip, "int") if maxpagesize is not None: _params["$maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "int") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -111,7 +111,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -137,7 +137,7 @@ def build_get_request( "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -160,7 +160,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -187,7 +187,7 @@ def build_create_or_update_request( "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -212,7 +212,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -238,7 +238,7 @@ def build_delete_request( "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -301,7 +301,6 @@ def list_by_device_group( :type skip: int :param maxpagesize: The maximum number of result items per page. Default value is None. :type maxpagesize: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Deployment or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.sphere.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: @@ -323,7 +322,7 @@ def list_by_device_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_device_group_request( + _request = build_list_by_device_group_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -334,12 +333,11 @@ def prepare_request(next_link=None): skip=skip, maxpagesize=maxpagesize, api_version=api_version, - template_url=self.list_by_device_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -351,13 +349,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("DeploymentListResult", pipeline_response) @@ -367,11 +365,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -384,10 +382,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_device_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments" - } - @distributed_trace def get( self, @@ -413,7 +407,6 @@ def get( :param deployment_name: Deployment name. Use .default for deployment creation and to get the current deployment for the associated device group. Required. :type deployment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Deployment or the result of cls(response) :rtype: ~azure.mgmt.sphere.models.Deployment :raises ~azure.core.exceptions.HttpResponseError: @@ -432,7 +425,7 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Deployment] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -440,16 +433,15 @@ def get( deployment_name=deployment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -462,13 +454,9 @@ def get( deserialized = self._deserialize("Deployment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, @@ -477,7 +465,7 @@ def _create_or_update_initial( product_name: str, device_group_name: str, deployment_name: str, - resource: Union[_models.Deployment, IO], + resource: Union[_models.Deployment, IO[bytes]], **kwargs: Any ) -> _models.Deployment: error_map = { @@ -503,7 +491,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(resource, "Deployment") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -514,16 +502,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -547,10 +534,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}" - } - @overload def begin_create_or_update( self, @@ -584,14 +567,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Deployment or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sphere.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: @@ -605,7 +580,7 @@ def begin_create_or_update( product_name: str, device_group_name: str, deployment_name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -626,18 +601,10 @@ def begin_create_or_update( current deployment for the associated device group. Required. :type deployment_name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Deployment or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sphere.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: @@ -651,7 +618,7 @@ def begin_create_or_update( product_name: str, device_group_name: str, deployment_name: str, - resource: Union[_models.Deployment, IO], + resource: Union[_models.Deployment, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Deployment]: """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used @@ -669,20 +636,9 @@ def begin_create_or_update( :param deployment_name: Deployment name. Use .default for deployment creation and to get the current deployment for the associated device group. Required. :type deployment_name: str - :param resource: Resource create parameters. Is either a Deployment type or a IO type. + :param resource: Resource create parameters. Is either a Deployment type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.sphere.models.Deployment or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :type resource: ~azure.mgmt.sphere.models.Deployment or IO[bytes] :return: An instance of LROPoller that returns either Deployment or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sphere.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: @@ -716,7 +672,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Deployment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -728,17 +684,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Deployment].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - 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.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}" - } + return LROPoller[_models.Deployment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -763,7 +717,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -771,16 +725,15 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements deployment_name=deployment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -796,11 +749,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace def begin_delete( @@ -827,14 +776,6 @@ def begin_delete( :param deployment_name: Deployment name. Use .default for deployment creation and to get the current deployment for the associated device group. Required. :type deployment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -864,7 +805,7 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -875,14 +816,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/operations/_device_groups_operations.py b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/operations/_device_groups_operations.py index 0f1d1ee6187b..a332175384cb 100644 --- a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/operations/_device_groups_operations.py +++ b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/operations/_device_groups_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -30,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +54,7 @@ def build_list_by_product_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -73,9 +73,10 @@ def build_list_by_product_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: _params["$filter"] = _SERIALIZER.query("filter", filter, "str") if top is not None: @@ -84,7 +85,6 @@ def build_list_by_product_request( _params["$skip"] = _SERIALIZER.query("skip", skip, "int") if maxpagesize is not None: _params["$maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "int") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -103,7 +103,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -128,7 +128,7 @@ def build_get_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -150,7 +150,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -176,7 +176,7 @@ def build_create_or_update_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -200,7 +200,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -226,7 +226,7 @@ def build_update_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -250,7 +250,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -275,7 +275,7 @@ def build_delete_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -297,7 +297,7 @@ def build_claim_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -323,7 +323,7 @@ def build_claim_devices_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -347,7 +347,7 @@ def build_count_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -372,7 +372,7 @@ def build_count_devices_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -432,7 +432,6 @@ def list_by_product( :type skip: int :param maxpagesize: The maximum number of result items per page. Default value is None. :type maxpagesize: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DeviceGroup or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.sphere.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: @@ -454,7 +453,7 @@ def list_by_product( def prepare_request(next_link=None): if not next_link: - request = build_list_by_product_request( + _request = build_list_by_product_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -464,12 +463,11 @@ def prepare_request(next_link=None): skip=skip, maxpagesize=maxpagesize, api_version=api_version, - template_url=self.list_by_product.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -481,13 +479,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("DeviceGroupListResult", pipeline_response) @@ -497,11 +495,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -514,10 +512,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_product.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups" - } - @distributed_trace def get( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any @@ -534,7 +528,6 @@ def get( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DeviceGroup or the result of cls(response) :rtype: ~azure.mgmt.sphere.models.DeviceGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -553,23 +546,22 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DeviceGroup] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -582,13 +574,9 @@ def get( deserialized = self._deserialize("DeviceGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, @@ -596,7 +584,7 @@ def _create_or_update_initial( catalog_name: str, product_name: str, device_group_name: str, - resource: Union[_models.DeviceGroup, IO], + resource: Union[_models.DeviceGroup, IO[bytes]], **kwargs: Any ) -> _models.DeviceGroup: error_map = { @@ -622,7 +610,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(resource, "DeviceGroup") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -632,16 +620,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -665,10 +652,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" - } - @overload def begin_create_or_update( self, @@ -698,14 +681,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either DeviceGroup or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sphere.models.DeviceGroup] @@ -719,7 +694,7 @@ def begin_create_or_update( catalog_name: str, product_name: str, device_group_name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -737,18 +712,10 @@ def begin_create_or_update( :param device_group_name: Name of device group. Required. :type device_group_name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either DeviceGroup or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sphere.models.DeviceGroup] @@ -762,7 +729,7 @@ def begin_create_or_update( catalog_name: str, product_name: str, device_group_name: str, - resource: Union[_models.DeviceGroup, IO], + resource: Union[_models.DeviceGroup, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.DeviceGroup]: """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used @@ -777,20 +744,9 @@ def begin_create_or_update( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param resource: Resource create parameters. Is either a DeviceGroup type or a IO type. + :param resource: Resource create parameters. Is either a DeviceGroup type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.sphere.models.DeviceGroup or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :type resource: ~azure.mgmt.sphere.models.DeviceGroup or IO[bytes] :return: An instance of LROPoller that returns either DeviceGroup or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sphere.models.DeviceGroup] @@ -824,7 +780,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("DeviceGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -836,17 +792,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.DeviceGroup].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - 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.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" - } + return LROPoller[_models.DeviceGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _update_initial( self, @@ -854,7 +808,7 @@ def _update_initial( catalog_name: str, product_name: str, device_group_name: str, - properties: Union[_models.DeviceGroupUpdate, IO], + properties: Union[_models.DeviceGroupUpdate, IO[bytes]], **kwargs: Any ) -> Optional[_models.DeviceGroup]: error_map = { @@ -880,7 +834,7 @@ def _update_initial( else: _json = self._serialize.body(properties, "DeviceGroupUpdate") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -890,16 +844,15 @@ def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -919,13 +872,9 @@ def _update_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" - } + return deserialized # type: ignore @overload def begin_update( @@ -956,14 +905,6 @@ def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either DeviceGroup or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sphere.models.DeviceGroup] @@ -977,7 +918,7 @@ def begin_update( catalog_name: str, product_name: str, device_group_name: str, - properties: IO, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -995,18 +936,10 @@ def begin_update( :param device_group_name: Name of device group. Required. :type device_group_name: str :param properties: The resource properties to be updated. Required. - :type properties: IO + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either DeviceGroup or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sphere.models.DeviceGroup] @@ -1020,7 +953,7 @@ def begin_update( catalog_name: str, product_name: str, device_group_name: str, - properties: Union[_models.DeviceGroupUpdate, IO], + properties: Union[_models.DeviceGroupUpdate, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.DeviceGroup]: """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used @@ -1036,19 +969,8 @@ def begin_update( :param device_group_name: Name of device group. Required. :type device_group_name: str :param properties: The resource properties to be updated. Is either a DeviceGroupUpdate type or - a IO type. Required. - :type properties: ~azure.mgmt.sphere.models.DeviceGroupUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + a IO[bytes] type. Required. + :type properties: ~azure.mgmt.sphere.models.DeviceGroupUpdate or IO[bytes] :return: An instance of LROPoller that returns either DeviceGroup or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sphere.models.DeviceGroup] @@ -1082,7 +1004,7 @@ def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("DeviceGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1094,17 +1016,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.DeviceGroup].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" - } + return LROPoller[_models.DeviceGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any @@ -1123,23 +1043,22 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1155,11 +1074,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace def begin_delete( @@ -1177,14 +1092,6 @@ def begin_delete( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1213,7 +1120,7 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -1224,17 +1131,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _claim_devices_initial( # pylint: disable=inconsistent-return-statements self, @@ -1242,7 +1145,7 @@ def _claim_devices_initial( # pylint: disable=inconsistent-return-statements catalog_name: str, product_name: str, device_group_name: str, - claim_devices_request: Union[_models.ClaimDevicesRequest, IO], + claim_devices_request: Union[_models.ClaimDevicesRequest, IO[bytes]], **kwargs: Any ) -> None: error_map = { @@ -1268,7 +1171,7 @@ def _claim_devices_initial( # pylint: disable=inconsistent-return-statements else: _json = self._serialize.body(claim_devices_request, "ClaimDevicesRequest") - request = build_claim_devices_request( + _request = build_claim_devices_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -1278,16 +1181,15 @@ def _claim_devices_initial( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self._claim_devices_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1299,13 +1201,10 @@ def _claim_devices_initial( # pylint: disable=inconsistent-return-statements response_headers = {} response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _claim_devices_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/claimDevices" - } + return cls(pipeline_response, None, response_headers) # type: ignore @overload def begin_claim_devices( @@ -1336,14 +1235,6 @@ def begin_claim_devices( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1356,7 +1247,7 @@ def begin_claim_devices( catalog_name: str, product_name: str, device_group_name: str, - claim_devices_request: IO, + claim_devices_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1374,18 +1265,10 @@ def begin_claim_devices( :param device_group_name: Name of device group. Required. :type device_group_name: str :param claim_devices_request: Bulk claim devices request body. Required. - :type claim_devices_request: IO + :type claim_devices_request: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1398,7 +1281,7 @@ def begin_claim_devices( catalog_name: str, product_name: str, device_group_name: str, - claim_devices_request: Union[_models.ClaimDevicesRequest, IO], + claim_devices_request: Union[_models.ClaimDevicesRequest, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names @@ -1414,19 +1297,8 @@ def begin_claim_devices( :param device_group_name: Name of device group. Required. :type device_group_name: str :param claim_devices_request: Bulk claim devices request body. Is either a ClaimDevicesRequest - type or a IO type. Required. - :type claim_devices_request: ~azure.mgmt.sphere.models.ClaimDevicesRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + type or a IO[bytes] type. Required. + :type claim_devices_request: ~azure.mgmt.sphere.models.ClaimDevicesRequest or IO[bytes] :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1458,7 +1330,7 @@ def begin_claim_devices( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -1469,22 +1341,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_claim_devices.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/claimDevices" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def count_devices( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any - ) -> _models.CountDeviceResponse: + ) -> _models.CountDevicesResponse: """Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. @@ -1497,9 +1365,8 @@ def count_devices( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CountDeviceResponse or the result of cls(response) - :rtype: ~azure.mgmt.sphere.models.CountDeviceResponse + :return: CountDevicesResponse or the result of cls(response) + :rtype: ~azure.mgmt.sphere.models.CountDevicesResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -1514,25 +1381,24 @@ def count_devices( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.CountDeviceResponse] = kwargs.pop("cls", None) + cls: ClsType[_models.CountDevicesResponse] = kwargs.pop("cls", None) - request = build_count_devices_request( + _request = build_count_devices_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.count_devices.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1542,13 +1408,9 @@ def count_devices( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CountDeviceResponse", pipeline_response) + deserialized = self._deserialize("CountDevicesResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - count_devices.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/countDevices" - } + return deserialized # type: ignore diff --git a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/operations/_devices_operations.py b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/operations/_devices_operations.py index 1b81e5f02e65..f040b41f04a0 100644 --- a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/operations/_devices_operations.py +++ b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/operations/_devices_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -30,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +50,7 @@ def build_list_by_device_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,7 +75,7 @@ def build_list_by_device_group_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -98,7 +98,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -124,7 +124,7 @@ def build_get_request( "deviceName": _SERIALIZER.url("device_name", device_name, "str", pattern=r"^[a-zA-Z0-9-]{128}$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -147,7 +147,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -174,7 +174,7 @@ def build_create_or_update_request( "deviceName": _SERIALIZER.url("device_name", device_name, "str", pattern=r"^[a-zA-Z0-9-]{128}$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -199,7 +199,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -226,7 +226,7 @@ def build_update_request( "deviceName": _SERIALIZER.url("device_name", device_name, "str", pattern=r"^[a-zA-Z0-9-]{128}$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -251,7 +251,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -277,7 +277,7 @@ def build_delete_request( "deviceName": _SERIALIZER.url("device_name", device_name, "str", pattern=r"^[a-zA-Z0-9-]{128}$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -300,7 +300,7 @@ def build_generate_capability_image_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -327,7 +327,7 @@ def build_generate_capability_image_request( "deviceName": _SERIALIZER.url("device_name", device_name, "str", pattern=r"^[a-zA-Z0-9-]{128}$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -375,7 +375,6 @@ def list_by_device_group( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Device or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.sphere.models.Device] :raises ~azure.core.exceptions.HttpResponseError: @@ -397,19 +396,18 @@ def list_by_device_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_device_group_request( + _request = build_list_by_device_group_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_device_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -421,13 +419,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("DeviceListResult", pipeline_response) @@ -437,11 +435,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -454,10 +452,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_device_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices" - } - @distributed_trace def get( self, @@ -482,7 +476,6 @@ def get( :type device_group_name: str :param device_name: Device name. Required. :type device_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Device or the result of cls(response) :rtype: ~azure.mgmt.sphere.models.Device :raises ~azure.core.exceptions.HttpResponseError: @@ -501,7 +494,7 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Device] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -509,16 +502,15 @@ def get( device_name=device_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -531,13 +523,9 @@ def get( deserialized = self._deserialize("Device", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, @@ -546,7 +534,7 @@ def _create_or_update_initial( product_name: str, device_group_name: str, device_name: str, - resource: Union[_models.Device, IO], + resource: Union[_models.Device, IO[bytes]], **kwargs: Any ) -> _models.Device: error_map = { @@ -572,7 +560,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(resource, "Device") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -583,16 +571,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -616,10 +603,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" - } - @overload def begin_create_or_update( self, @@ -652,14 +635,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Device or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sphere.models.Device] :raises ~azure.core.exceptions.HttpResponseError: @@ -673,7 +648,7 @@ def begin_create_or_update( product_name: str, device_group_name: str, device_name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -693,18 +668,10 @@ def begin_create_or_update( :param device_name: Device name. Required. :type device_name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Device or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sphere.models.Device] :raises ~azure.core.exceptions.HttpResponseError: @@ -718,7 +685,7 @@ def begin_create_or_update( product_name: str, device_group_name: str, device_name: str, - resource: Union[_models.Device, IO], + resource: Union[_models.Device, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Device]: """Create a Device. Use '.unassigned' or '.default' for the device group and product names to @@ -735,19 +702,9 @@ def begin_create_or_update( :type device_group_name: str :param device_name: Device name. Required. :type device_name: str - :param resource: Resource create parameters. Is either a Device type or a IO type. Required. - :type resource: ~azure.mgmt.sphere.models.Device or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param resource: Resource create parameters. Is either a Device type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.sphere.models.Device or IO[bytes] :return: An instance of LROPoller that returns either Device or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sphere.models.Device] :raises ~azure.core.exceptions.HttpResponseError: @@ -781,7 +738,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Device", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -793,17 +750,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Device].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - 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.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" - } + return LROPoller[_models.Device]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _update_initial( self, @@ -812,7 +767,7 @@ def _update_initial( product_name: str, device_group_name: str, device_name: str, - properties: Union[_models.DeviceUpdate, IO], + properties: Union[_models.DeviceUpdate, IO[bytes]], **kwargs: Any ) -> Optional[_models.Device]: error_map = { @@ -838,7 +793,7 @@ def _update_initial( else: _json = self._serialize.body(properties, "DeviceUpdate") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -849,16 +804,15 @@ def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -877,13 +831,9 @@ def _update_initial( response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" - } + return deserialized # type: ignore @overload def begin_update( @@ -917,14 +867,6 @@ def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Device or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sphere.models.Device] :raises ~azure.core.exceptions.HttpResponseError: @@ -938,7 +880,7 @@ def begin_update( product_name: str, device_group_name: str, device_name: str, - properties: IO, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -958,18 +900,10 @@ def begin_update( :param device_name: Device name. Required. :type device_name: str :param properties: The resource properties to be updated. Required. - :type properties: IO + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Device or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sphere.models.Device] :raises ~azure.core.exceptions.HttpResponseError: @@ -983,7 +917,7 @@ def begin_update( product_name: str, device_group_name: str, device_name: str, - properties: Union[_models.DeviceUpdate, IO], + properties: Union[_models.DeviceUpdate, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Device]: """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move @@ -1000,20 +934,9 @@ def begin_update( :type device_group_name: str :param device_name: Device name. Required. :type device_name: str - :param properties: The resource properties to be updated. Is either a DeviceUpdate type or a IO - type. Required. - :type properties: ~azure.mgmt.sphere.models.DeviceUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param properties: The resource properties to be updated. Is either a DeviceUpdate type or a + IO[bytes] type. Required. + :type properties: ~azure.mgmt.sphere.models.DeviceUpdate or IO[bytes] :return: An instance of LROPoller that returns either Device or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sphere.models.Device] :raises ~azure.core.exceptions.HttpResponseError: @@ -1047,7 +970,7 @@ def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Device", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1059,17 +982,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Device].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" - } + return LROPoller[_models.Device]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -1094,7 +1015,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -1102,16 +1023,15 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements device_name=device_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1127,11 +1047,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace def begin_delete( @@ -1156,14 +1072,6 @@ def begin_delete( :type device_group_name: str :param device_name: Device name. Required. :type device_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1193,7 +1101,7 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -1204,17 +1112,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _generate_capability_image_initial( self, @@ -1223,7 +1127,7 @@ def _generate_capability_image_initial( product_name: str, device_group_name: str, device_name: str, - generate_device_capability_request: Union[_models.GenerateCapabilityImageRequest, IO], + generate_device_capability_request: Union[_models.GenerateCapabilityImageRequest, IO[bytes]], **kwargs: Any ) -> Optional[_models.SignedCapabilityImageResponse]: error_map = { @@ -1249,7 +1153,7 @@ def _generate_capability_image_initial( else: _json = self._serialize.body(generate_device_capability_request, "GenerateCapabilityImageRequest") - request = build_generate_capability_image_request( + _request = build_generate_capability_image_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -1260,16 +1164,15 @@ def _generate_capability_image_initial( content_type=content_type, json=_json, content=_content, - template_url=self._generate_capability_image_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1286,15 +1189,12 @@ def _generate_capability_image_initial( if response.status_code == 202: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _generate_capability_image_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}/generateCapabilityImage" - } + return deserialized # type: ignore @overload def begin_generate_capability_image( @@ -1330,14 +1230,6 @@ def begin_generate_capability_image( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either SignedCapabilityImageResponse or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sphere.models.SignedCapabilityImageResponse] @@ -1352,7 +1244,7 @@ def begin_generate_capability_image( product_name: str, device_group_name: str, device_name: str, - generate_device_capability_request: IO, + generate_device_capability_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1373,18 +1265,10 @@ def begin_generate_capability_image( :param device_name: Device name. Required. :type device_name: str :param generate_device_capability_request: Generate capability image request body. Required. - :type generate_device_capability_request: IO + :type generate_device_capability_request: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either SignedCapabilityImageResponse or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sphere.models.SignedCapabilityImageResponse] @@ -1399,7 +1283,7 @@ def begin_generate_capability_image( product_name: str, device_group_name: str, device_name: str, - generate_device_capability_request: Union[_models.GenerateCapabilityImageRequest, IO], + generate_device_capability_request: Union[_models.GenerateCapabilityImageRequest, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.SignedCapabilityImageResponse]: """Generates the capability image for the device. Use '.unassigned' or '.default' for the device @@ -1418,20 +1302,9 @@ def begin_generate_capability_image( :param device_name: Device name. Required. :type device_name: str :param generate_device_capability_request: Generate capability image request body. Is either a - GenerateCapabilityImageRequest type or a IO type. Required. + GenerateCapabilityImageRequest type or a IO[bytes] type. Required. :type generate_device_capability_request: - ~azure.mgmt.sphere.models.GenerateCapabilityImageRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + ~azure.mgmt.sphere.models.GenerateCapabilityImageRequest or IO[bytes] :return: An instance of LROPoller that returns either SignedCapabilityImageResponse or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sphere.models.SignedCapabilityImageResponse] @@ -1466,7 +1339,7 @@ def begin_generate_capability_image( def get_long_running_output(pipeline_response): deserialized = self._deserialize("SignedCapabilityImageResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1478,14 +1351,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.SignedCapabilityImageResponse].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_generate_capability_image.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}/generateCapabilityImage" - } + return LROPoller[_models.SignedCapabilityImageResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/operations/_images_operations.py b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/operations/_images_operations.py index 9b0fd4f796e9..6d6800db2222 100644 --- a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/operations/_images_operations.py +++ b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/operations/_images_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -30,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +53,7 @@ def build_list_by_catalog_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,9 +69,10 @@ def build_list_by_catalog_request( "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str", pattern=r"^[A-Za-z0-9_-]{1,50}$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: _params["$filter"] = _SERIALIZER.query("filter", filter, "str") if top is not None: @@ -80,7 +81,6 @@ def build_list_by_catalog_request( _params["$skip"] = _SERIALIZER.query("skip", skip, "int") if maxpagesize is not None: _params["$maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "int") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -94,7 +94,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -111,7 +111,7 @@ def build_get_request( "imageName": _SERIALIZER.url("image_name", image_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -128,7 +128,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -146,7 +146,7 @@ def build_create_or_update_request( "imageName": _SERIALIZER.url("image_name", image_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -165,7 +165,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -182,7 +182,7 @@ def build_delete_request( "imageName": _SERIALIZER.url("image_name", image_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -238,7 +238,6 @@ def list_by_catalog( :type skip: int :param maxpagesize: The maximum number of result items per page. Default value is None. :type maxpagesize: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Image or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.sphere.models.Image] :raises ~azure.core.exceptions.HttpResponseError: @@ -260,7 +259,7 @@ def list_by_catalog( def prepare_request(next_link=None): if not next_link: - request = build_list_by_catalog_request( + _request = build_list_by_catalog_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, @@ -269,12 +268,11 @@ def prepare_request(next_link=None): skip=skip, maxpagesize=maxpagesize, api_version=api_version, - template_url=self.list_by_catalog.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -286,13 +284,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ImageListResult", pipeline_response) @@ -302,11 +300,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -319,10 +317,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_catalog.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images" - } - @distributed_trace def get(self, resource_group_name: str, catalog_name: str, image_name: str, **kwargs: Any) -> _models.Image: """Get a Image. @@ -332,9 +326,8 @@ def get(self, resource_group_name: str, catalog_name: str, image_name: str, **kw :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. :type image_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Image or the result of cls(response) :rtype: ~azure.mgmt.sphere.models.Image :raises ~azure.core.exceptions.HttpResponseError: @@ -353,22 +346,21 @@ def get(self, resource_group_name: str, catalog_name: str, image_name: str, **kw api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Image] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, catalog_name=catalog_name, image_name=image_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -381,20 +373,16 @@ def get(self, resource_group_name: str, catalog_name: str, image_name: str, **kw deserialized = self._deserialize("Image", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, catalog_name: str, image_name: str, - resource: Union[_models.Image, IO], + resource: Union[_models.Image, IO[bytes]], **kwargs: Any ) -> _models.Image: error_map = { @@ -420,7 +408,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(resource, "Image") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, image_name=image_name, @@ -429,16 +417,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -462,10 +449,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}" - } - @overload def begin_create_or_update( self, @@ -484,21 +467,13 @@ def begin_create_or_update( :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. :type image_name: str :param resource: Resource create parameters. Required. :type resource: ~azure.mgmt.sphere.models.Image :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Image or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sphere.models.Image] :raises ~azure.core.exceptions.HttpResponseError: @@ -510,7 +485,7 @@ def begin_create_or_update( resource_group_name: str, catalog_name: str, image_name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -522,21 +497,13 @@ def begin_create_or_update( :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. :type image_name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Image or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sphere.models.Image] :raises ~azure.core.exceptions.HttpResponseError: @@ -548,7 +515,7 @@ def begin_create_or_update( resource_group_name: str, catalog_name: str, image_name: str, - resource: Union[_models.Image, IO], + resource: Union[_models.Image, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Image]: """Create a Image. @@ -558,21 +525,11 @@ def begin_create_or_update( :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. :type image_name: str - :param resource: Resource create parameters. Is either a Image type or a IO type. Required. - :type resource: ~azure.mgmt.sphere.models.Image or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param resource: Resource create parameters. Is either a Image type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.sphere.models.Image or IO[bytes] :return: An instance of LROPoller that returns either Image or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sphere.models.Image] :raises ~azure.core.exceptions.HttpResponseError: @@ -604,7 +561,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Image", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -616,17 +573,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Image].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - 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.AzureSphere/catalogs/{catalogName}/images/{imageName}" - } + return LROPoller[_models.Image]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, catalog_name: str, image_name: str, **kwargs: Any @@ -645,22 +600,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, catalog_name=catalog_name, image_name=image_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -676,11 +630,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace def begin_delete( @@ -693,16 +643,8 @@ def begin_delete( :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. :type image_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -730,7 +672,7 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -741,14 +683,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/operations/_operations.py b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/operations/_operations.py index 92b9df1b8e68..a9b11c53029f 100644 --- a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/operations/_operations.py +++ b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -40,7 +40,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +78,6 @@ def __init__(self, *args, **kwargs): def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: """List the operations for the provider. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Operation or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.sphere.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: @@ -100,14 +99,13 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -119,13 +117,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) @@ -135,11 +133,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,5 +149,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.AzureSphere/operations"} diff --git a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/operations/_products_operations.py b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/operations/_products_operations.py index b6b9e975b403..2ccad72f2628 100644 --- a/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/operations/_products_operations.py +++ b/sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/operations/_products_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -30,7 +30,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +45,7 @@ def build_list_by_catalog_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +61,7 @@ def build_list_by_catalog_request( "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str", pattern=r"^[A-Za-z0-9_-]{1,50}$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -78,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +97,7 @@ def build_get_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,7 +114,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -134,7 +134,7 @@ def build_create_or_update_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -153,7 +153,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -173,7 +173,7 @@ def build_update_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -192,7 +192,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -211,7 +211,7 @@ def build_delete_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -228,7 +228,7 @@ def build_count_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -247,7 +247,7 @@ def build_count_devices_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -258,13 +258,13 @@ def build_count_devices_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_generate_default_device_groups_request( +def build_generate_default_device_groups_request( # pylint: disable=name-too-long resource_group_name: str, catalog_name: str, product_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -283,7 +283,7 @@ def build_generate_default_device_groups_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -324,7 +324,6 @@ def list_by_catalog( :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Product or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.sphere.models.Product] :raises ~azure.core.exceptions.HttpResponseError: @@ -346,17 +345,16 @@ def list_by_catalog( def prepare_request(next_link=None): if not next_link: - request = build_list_by_catalog_request( + _request = build_list_by_catalog_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_catalog.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -368,13 +366,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ProductListResult", pipeline_response) @@ -384,11 +382,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -401,10 +399,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_catalog.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products" - } - @distributed_trace def get(self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any) -> _models.Product: """Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for @@ -417,7 +411,6 @@ def get(self, resource_group_name: str, catalog_name: str, product_name: str, ** :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Product or the result of cls(response) :rtype: ~azure.mgmt.sphere.models.Product :raises ~azure.core.exceptions.HttpResponseError: @@ -436,22 +429,21 @@ def get(self, resource_group_name: str, catalog_name: str, product_name: str, ** api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Product] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -464,20 +456,16 @@ def get(self, resource_group_name: str, catalog_name: str, product_name: str, ** deserialized = self._deserialize("Product", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, catalog_name: str, product_name: str, - resource: Union[_models.Product, IO], + resource: Union[_models.Product, IO[bytes]], **kwargs: Any ) -> _models.Product: error_map = { @@ -503,7 +491,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(resource, "Product") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -512,16 +500,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -545,10 +532,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" - } - @overload def begin_create_or_update( self, @@ -575,14 +558,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Product or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sphere.models.Product] :raises ~azure.core.exceptions.HttpResponseError: @@ -594,7 +569,7 @@ def begin_create_or_update( resource_group_name: str, catalog_name: str, product_name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -610,18 +585,10 @@ def begin_create_or_update( :param product_name: Name of product. Required. :type product_name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Product or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sphere.models.Product] :raises ~azure.core.exceptions.HttpResponseError: @@ -633,7 +600,7 @@ def begin_create_or_update( resource_group_name: str, catalog_name: str, product_name: str, - resource: Union[_models.Product, IO], + resource: Union[_models.Product, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Product]: """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for @@ -646,19 +613,9 @@ def begin_create_or_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param resource: Resource create parameters. Is either a Product type or a IO type. Required. - :type resource: ~azure.mgmt.sphere.models.Product or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param resource: Resource create parameters. Is either a Product type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.sphere.models.Product or IO[bytes] :return: An instance of LROPoller that returns either Product or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sphere.models.Product] :raises ~azure.core.exceptions.HttpResponseError: @@ -690,7 +647,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Product", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -702,24 +659,22 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Product].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - 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.AzureSphere/catalogs/{catalogName}/products/{productName}" - } + return LROPoller[_models.Product]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _update_initial( self, resource_group_name: str, catalog_name: str, product_name: str, - properties: Union[_models.ProductUpdate, IO], + properties: Union[_models.ProductUpdate, IO[bytes]], **kwargs: Any ) -> Optional[_models.Product]: error_map = { @@ -745,7 +700,7 @@ def _update_initial( else: _json = self._serialize.body(properties, "ProductUpdate") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -754,16 +709,15 @@ def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -783,13 +737,9 @@ def _update_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" - } + return deserialized # type: ignore @overload def begin_update( @@ -817,14 +767,6 @@ def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Product or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sphere.models.Product] :raises ~azure.core.exceptions.HttpResponseError: @@ -836,7 +778,7 @@ def begin_update( resource_group_name: str, catalog_name: str, product_name: str, - properties: IO, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -852,18 +794,10 @@ def begin_update( :param product_name: Name of product. Required. :type product_name: str :param properties: The resource properties to be updated. Required. - :type properties: IO + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Product or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sphere.models.Product] :raises ~azure.core.exceptions.HttpResponseError: @@ -875,7 +809,7 @@ def begin_update( resource_group_name: str, catalog_name: str, product_name: str, - properties: Union[_models.ProductUpdate, IO], + properties: Union[_models.ProductUpdate, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Product]: """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for @@ -889,19 +823,8 @@ def begin_update( :param product_name: Name of product. Required. :type product_name: str :param properties: The resource properties to be updated. Is either a ProductUpdate type or a - IO type. Required. - :type properties: ~azure.mgmt.sphere.models.ProductUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + IO[bytes] type. Required. + :type properties: ~azure.mgmt.sphere.models.ProductUpdate or IO[bytes] :return: An instance of LROPoller that returns either Product or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sphere.models.Product] :raises ~azure.core.exceptions.HttpResponseError: @@ -933,7 +856,7 @@ def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Product", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -945,17 +868,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Product].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" - } + return LROPoller[_models.Product]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any @@ -974,22 +895,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1005,11 +925,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace def begin_delete( @@ -1025,14 +941,6 @@ def begin_delete( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1060,7 +968,7 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -1071,22 +979,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def count_devices( self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any - ) -> _models.CountDeviceResponse: + ) -> _models.CountDevicesResponse: """Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used for product name. @@ -1097,9 +1001,8 @@ def count_devices( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CountDeviceResponse or the result of cls(response) - :rtype: ~azure.mgmt.sphere.models.CountDeviceResponse + :return: CountDevicesResponse or the result of cls(response) + :rtype: ~azure.mgmt.sphere.models.CountDevicesResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -1114,24 +1017,23 @@ def count_devices( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.CountDeviceResponse] = kwargs.pop("cls", None) + cls: ClsType[_models.CountDevicesResponse] = kwargs.pop("cls", None) - request = build_count_devices_request( + _request = build_count_devices_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.count_devices.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1141,16 +1043,12 @@ def count_devices( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CountDeviceResponse", pipeline_response) + deserialized = self._deserialize("CountDevicesResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - count_devices.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/countDevices" - } + return deserialized # type: ignore @distributed_trace def generate_default_device_groups( @@ -1166,7 +1064,6 @@ def generate_default_device_groups( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DeviceGroup or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.sphere.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: @@ -1188,18 +1085,17 @@ def generate_default_device_groups( def prepare_request(next_link=None): if not next_link: - request = build_generate_default_device_groups_request( + _request = build_generate_default_device_groups_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.generate_default_device_groups.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1211,13 +1107,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "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) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("DeviceGroupListResult", pipeline_response) @@ -1227,11 +1123,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1243,7 +1139,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - generate_default_device_groups.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/generateDefaultDeviceGroups" - } diff --git a/sdk/sphere/azure-mgmt-sphere/dev_requirements.txt b/sdk/sphere/azure-mgmt-sphere/dev_requirements.txt index 13ab3cd586ac..883701a54091 100644 --- a/sdk/sphere/azure-mgmt-sphere/dev_requirements.txt +++ b/sdk/sphere/azure-mgmt-sphere/dev_requirements.txt @@ -1,3 +1,4 @@ -e ../../../tools/azure-sdk-tools -e ../../../tools/azure-devtools ../../identity/azure-identity +-e ../../resources/azure-mgmt-resource diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/delete_catalog.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/delete_catalog.py index 949782eb7ebd..174c34823406 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/delete_catalog.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/delete_catalog.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/DeleteCatalog.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteCatalog.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/delete_deployment.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/delete_deployment.py index 865d104f811d..766afb9bd7a8 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/delete_deployment.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/delete_deployment.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -38,6 +39,6 @@ def main(): ).result() -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/DeleteDeployment.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteDeployment.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/delete_device.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/delete_device.py index 936b51cf111f..dc56cd268a59 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/delete_device.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/delete_device.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -38,6 +39,6 @@ def main(): ).result() -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/DeleteDevice.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteDevice.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/delete_device_group.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/delete_device_group.py index c2517ccb25d2..c8444720da0d 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/delete_device_group.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/delete_device_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -37,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/DeleteDeviceGroup.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteDeviceGroup.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/delete_image.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/delete_image.py index cc217dd69c5a..73d65dff04a6 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/delete_image.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/delete_image.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -32,10 +33,10 @@ def main(): client.images.begin_delete( resource_group_name="MyResourceGroup1", catalog_name="MyCatalog1", - image_name="imageID", + image_name="00000000-0000-0000-0000-000000000000", ).result() -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/DeleteImage.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteImage.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/delete_product.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/delete_product.py index 9a6c5f68102b..7f990c8db184 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/delete_product.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/delete_product.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/DeleteProduct.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteProduct.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/get_catalog.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/get_catalog.py index e1839943ade0..4f6803d65a63 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/get_catalog.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/get_catalog.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetCatalog.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCatalog.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/get_catalogs_rg.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/get_catalogs_rg.py index 1f89275b5d16..000505a1eb73 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/get_catalogs_rg.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/get_catalogs_rg.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetCatalogsRG.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCatalogsRG.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/get_catalogs_sub.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/get_catalogs_sub.py index 3fe3ee393fe9..4c8fae8bc8a1 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/get_catalogs_sub.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/get_catalogs_sub.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetCatalogsSub.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCatalogsSub.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/get_certificate.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/get_certificate.py index 66e1de740869..f97e086ecf70 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/get_certificate.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/get_certificate.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetCertificate.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCertificate.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/get_certificates.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/get_certificates.py index f2d86a4636a8..cbb28f8a5a2c 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/get_certificates.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/get_certificates.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetCertificates.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCertificates.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/get_deployment.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/get_deployment.py index 7437f7ced032..811878bb2246 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/get_deployment.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/get_deployment.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -39,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetDeployment.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDeployment.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/get_deployments.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/get_deployments.py index 6d77ad58c735..ce3c85c9c362 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/get_deployments.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/get_deployments.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -39,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetDeployments.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDeployments.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/get_device.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/get_device.py index 1368f7740e41..ec3865ef039e 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/get_device.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/get_device.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -39,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetDevice.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDevice.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/get_device_group.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/get_device_group.py index afe03492aec3..48729325751f 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/get_device_group.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/get_device_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetDeviceGroup.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDeviceGroup.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/get_device_groups.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/get_device_groups.py index 7a2d19f5c3b1..a4df1ca62af9 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/get_device_groups.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/get_device_groups.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetDeviceGroups.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDeviceGroups.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/get_devices.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/get_devices.py index 71eaf0836109..2bcb0a5203b9 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/get_devices.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/get_devices.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -39,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetDevices.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDevices.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/get_image.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/get_image.py index 25478f3e8a32..e8acb0ba7a4f 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/get_image.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/get_image.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -32,11 +33,11 @@ def main(): response = client.images.get( resource_group_name="MyResourceGroup1", catalog_name="MyCatalog1", - image_name="myImageId", + image_name="00000000-0000-0000-0000-000000000000", ) print(response) -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetImage.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetImage.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/get_images.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/get_images.py index 6771c51c6671..e5d86729c47d 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/get_images.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/get_images.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetImages.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetImages.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/get_operations.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/get_operations.py index b5d5be0951fb..123e753981d6 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/get_operations.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/get_operations.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetOperations.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetOperations.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/get_product.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/get_product.py index b76bde7feb16..126742596e6c 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/get_product.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/get_product.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetProduct.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetProduct.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/get_products.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/get_products.py index 81ce7c4bf213..28aee3b8100d 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/get_products.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/get_products.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetProducts.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetProducts.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/post_claim_devices.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/post_claim_devices.py index c2a3c92de449..ee72edb4e0fa 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/post_claim_devices.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/post_claim_devices.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -42,6 +45,6 @@ def main(): ).result() -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostClaimDevices.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostClaimDevices.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/post_count_devices_catalog.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/post_count_devices_catalog.py index 8256a3517ffc..630b0c64334e 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/post_count_devices_catalog.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/post_count_devices_catalog.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostCountDevicesCatalog.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostCountDevicesCatalog.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/post_count_devices_device_group.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/post_count_devices_device_group.py index d1a86e2433da..4cd1cb251ec3 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/post_count_devices_device_group.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/post_count_devices_device_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostCountDevicesDeviceGroup.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostCountDevicesDeviceGroup.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/post_count_devices_product.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/post_count_devices_product.py index 70d4ccef9283..d3eb7d381c79 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/post_count_devices_product.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/post_count_devices_product.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostCountDevicesProduct.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostCountDevicesProduct.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/post_generate_default_device_groups.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/post_generate_default_device_groups.py index 61a260fbc4b2..97e05ad5ac9b 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/post_generate_default_device_groups.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/post_generate_default_device_groups.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostGenerateDefaultDeviceGroups.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostGenerateDefaultDeviceGroups.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/post_generate_device_capability_image.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/post_generate_device_capability_image.py index 2b36bd97187f..0ab01257a3d8 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/post_generate_device_capability_image.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/post_generate_device_capability_image.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -40,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostGenerateDeviceCapabilityImage.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostGenerateDeviceCapabilityImage.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/post_list_deployments_by_catalog.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/post_list_deployments_by_catalog.py index 9d7d0ab42e30..7eea9287b2ab 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/post_list_deployments_by_catalog.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/post_list_deployments_by_catalog.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostListDeploymentsByCatalog.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostListDeploymentsByCatalog.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/post_list_device_groups_catalog.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/post_list_device_groups_catalog.py index ebf2e6bc578c..f3a6b81fd2ea 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/post_list_device_groups_catalog.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/post_list_device_groups_catalog.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -38,6 +41,6 @@ def main(): print(item) -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostListDeviceGroupsCatalog.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostListDeviceGroupsCatalog.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/post_list_device_insights_catalog.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/post_list_device_insights_catalog.py index 3e6442b988db..2f46302ed399 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/post_list_device_insights_catalog.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/post_list_device_insights_catalog.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostListDeviceInsightsCatalog.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostListDeviceInsightsCatalog.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/post_list_devices_by_catalog.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/post_list_devices_by_catalog.py index 62f2ded24ae2..d61b162fa704 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/post_list_devices_by_catalog.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/post_list_devices_by_catalog.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostListDevicesByCatalog.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostListDevicesByCatalog.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/post_retrieve_catalog_cert_chain.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/post_retrieve_catalog_cert_chain.py index 3c1839442784..5441c24b0fde 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/post_retrieve_catalog_cert_chain.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/post_retrieve_catalog_cert_chain.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostRetrieveCatalogCertChain.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostRetrieveCatalogCertChain.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/post_retrieve_proof_of_possession_nonce.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/post_retrieve_proof_of_possession_nonce.py index 3c45894d96e6..d6791103d720 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/post_retrieve_proof_of_possession_nonce.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/post_retrieve_proof_of_possession_nonce.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -38,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostRetrieveProofOfPossessionNonce.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostRetrieveProofOfPossessionNonce.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/post_upload_image_catalog.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/post_upload_image_catalog.py new file mode 100644 index 000000000000..296529b5b85c --- /dev/null +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/post_upload_image_catalog.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 typing import Any, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.sphere import AzureSphereMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-sphere +# USAGE + python post_upload_image_catalog.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 = AzureSphereMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.catalogs.begin_upload_image( + resource_group_name="MyResourceGroup1", + catalog_name="MyCatalog1", + upload_image_request={"properties": {"image": "bXliYXNlNjRzdHJpbmc="}}, + ).result() + + +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostUploadImageCatalog.json +if __name__ == "__main__": + main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/put_catalog.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/put_catalog.py index 9c335a5f53be..e98fce548b6a 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/put_catalog.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/put_catalog.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -37,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PutCatalog.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutCatalog.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/put_device_group.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/put_device_group.py index a64c5d000758..1c16f85b2d0d 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/put_device_group.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/put_device_group.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -45,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PutDeviceGroup.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutDeviceGroup.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/generated_samples/put_image.py b/sdk/sphere/azure-mgmt-sphere/generated_samples/put_image.py index 3257cd416283..0871cec6b065 100644 --- a/sdk/sphere/azure-mgmt-sphere/generated_samples/put_image.py +++ b/sdk/sphere/azure-mgmt-sphere/generated_samples/put_image.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.sphere import AzureSphereMgmtClient """ @@ -32,12 +35,12 @@ def main(): response = client.images.begin_create_or_update( resource_group_name="MyResourceGroup1", catalog_name="MyCatalog1", - image_name="default", + image_name="00000000-0000-0000-0000-000000000000", resource={"properties": {"image": "bXliYXNlNjRzdHJpbmc="}}, ).result() print(response) -# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PutImage.json +# x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutImage.json if __name__ == "__main__": main() diff --git a/sdk/sphere/azure-mgmt-sphere/sdk_packaging.toml b/sdk/sphere/azure-mgmt-sphere/sdk_packaging.toml index 1671b09ea043..e4bb3444f4df 100644 --- a/sdk/sphere/azure-mgmt-sphere/sdk_packaging.toml +++ b/sdk/sphere/azure-mgmt-sphere/sdk_packaging.toml @@ -3,7 +3,7 @@ package_name = "azure-mgmt-sphere" package_nspkg = "azure-mgmt-nspkg" package_pprint_name = "Sphere Management" package_doc_id = "" -is_stable = false +is_stable = true is_arm = true need_msrestazure = false need_azuremgmtcore = true diff --git a/sdk/sphere/azure-mgmt-sphere/setup.py b/sdk/sphere/azure-mgmt-sphere/setup.py index 499be572cf37..6d21238bb4c2 100644 --- a/sdk/sphere/azure-mgmt-sphere/setup.py +++ b/sdk/sphere/azure-mgmt-sphere/setup.py @@ -49,15 +49,15 @@ url="https://github.com/Azure/azure-sdk-for-python", keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product classifiers=[ - "Development Status :: 4 - Beta", + "Development Status :: 5 - Production/Stable", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "License :: OSI Approved :: MIT License", ], zip_safe=False, @@ -74,10 +74,9 @@ "pytyped": ["py.typed"], }, install_requires=[ - "isodate<1.0.0,>=0.6.1", - "azure-common~=1.1", - "azure-mgmt-core>=1.3.2,<2.0.0", - "typing-extensions>=4.3.0; python_version<'3.8.0'", + "isodate>=0.6.1", + "azure-common>=1.1", + "azure-mgmt-core>=1.3.2", ], - python_requires=">=3.7", + python_requires=">=3.8", )