From 89928125689484a884b5aea68cd5f66c34276a67 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 26 Apr 2024 09:24:23 +0000 Subject: [PATCH] CodeGen from PR 3325 in test-repo-billy/azure-rest-api-specs Merge fc81bd3dca245e96b53c39c8dd293e75de26b9bc into fac972f7bd293be3217b60d0035d68fabf1e2601 --- .../azure-mgmt-servicelinker/_meta.json | 10 +- .../mgmt/servicelinker/_configuration.py | 13 +- .../mgmt/servicelinker/_serialization.py | 90 +- .../_service_linker_management_client.py | 49 +- .../azure/mgmt/servicelinker/_version.py | 2 +- .../mgmt/servicelinker/aio/_configuration.py | 13 +- .../aio/_service_linker_management_client.py | 52 +- .../servicelinker/aio/operations/__init__.py | 6 - .../_configuration_names_operations.py | 144 -- .../aio/operations/_connector_operations.py | 1891 -------------- .../aio/operations/_linker_operations.py | 714 +---- .../aio/operations/_linkers_operations.py | 929 ------- .../aio/operations/_operations.py | 26 +- .../mgmt/servicelinker/models/__init__.py | 82 +- .../mgmt/servicelinker/models/_models_py3.py | 2192 ++-------------- ..._service_linker_management_client_enums.py | 96 - .../mgmt/servicelinker/operations/__init__.py | 6 - .../_configuration_names_operations.py | 169 -- .../operations/_connector_operations.py | 2291 ----------------- .../operations/_linker_operations.py | 820 +----- .../operations/_linkers_operations.py | 1104 -------- .../servicelinker/operations/_operations.py | 28 +- .../configuration_names_list.py | 38 - .../connector_dryrun_create.py | 58 - .../connector_dryrun_delete.py | 41 - .../generated_samples/connector_dryrun_get.py | 42 - .../connector_dryrun_list.py | 42 - .../connector_dryrun_update.py | 58 - .../generated_samples/connector_list.py | 42 - .../generated_samples/connectors.py | 42 - .../generated_samples/delete_connector.py | 41 - .../generated_samples/delete_dryrun.py | 39 - .../generated_samples/delete_linker.py | 39 - .../generate_configurations.py | 42 - .../generated_samples/get_configurations.py | 5 +- .../get_dapr_configurations.py | 40 - .../generated_samples/get_dryrun.py | 40 - .../{linker_list.py => link_list.py} | 5 +- .../generated_samples/linker.py | 40 - .../linker_generate_configurations.py | 40 - .../generated_samples/list_dryrun.py | 40 - .../generated_samples/operations_list.py | 3 +- .../generated_samples/patch_connector.py | 56 - .../generated_samples/patch_dryrun.py | 56 - .../generated_samples/patch_linker.py | 54 - .../generated_samples/put_connector.py | 54 - .../generated_samples/put_dryrun.py | 56 - .../generated_samples/put_linker.py | 54 - .../validate_connector_success.py | 42 - ...er_success.py => validate_link_success.py} | 5 +- .../azure-mgmt-servicelinker/setup.py | 6 +- 51 files changed, 511 insertions(+), 11336 deletions(-) delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_configuration_names_operations.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_connector_operations.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linkers_operations.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_configuration_names_operations.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_connector_operations.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linkers_operations.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/configuration_names_list.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_create.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_delete.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_get.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_list.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_update.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_list.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connectors.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_connector.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_dryrun.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_linker.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/generate_configurations.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_dapr_configurations.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_dryrun.py rename sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/{linker_list.py => link_list.py} (93%) delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker_generate_configurations.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/list_dryrun.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_connector.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_dryrun.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_linker.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_connector.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_dryrun.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_linker.py delete mode 100644 sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_connector_success.py rename sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/{validate_linker_success.py => validate_link_success.py} (92%) diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/_meta.json b/sdk/servicelinker/azure-mgmt-servicelinker/_meta.json index 4ed77847eac8..1523f8e7f07e 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/_meta.json +++ b/sdk/servicelinker/azure-mgmt-servicelinker/_meta.json @@ -1,11 +1,11 @@ { - "commit": "84849e5293de3a8e01cbdde13b2d7086d3fb34d6", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "commit": "d48b117e2debb28420f0c237e25a58f8746b63c0", + "repository_url": "https://github.com/test-repo-billy/azure-rest-api-specs", "autorest": "3.9.7", "use": [ - "@autorest/python@6.7.1", - "@autorest/modelerfour@4.26.2" + "@autorest/python@6.13.7", + "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/servicelinker/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/servicelinker/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.13.7 --use=@autorest/modelerfour@4.27.0 --version=3.9.7 --version-tolerant=False", "readme": "specification/servicelinker/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_configuration.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_configuration.py index 6a720fde399c..369577259f94 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_configuration.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_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 ServiceLinkerManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class ServiceLinkerManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for ServiceLinkerManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,14 +26,13 @@ class ServiceLinkerManagementClientConfiguration(Configuration): # pylint: disa :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :keyword api_version: Api Version. Default value is "2023-04-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: - super(ServiceLinkerManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-04-01-preview") + api_version: str = kwargs.pop("api_version", "2022-05-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -43,6 +41,7 @@ def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-servicelinker/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -51,9 +50,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/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_serialization.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_serialization.py index 4bae2292227b..2f781d740827 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_serialization.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_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 @@ -668,7 +661,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): 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 @@ -710,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) @@ -730,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: @@ -744,7 +738,7 @@ def query(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :keyword bool skip_quote: Whether to skip quote the serialized result. Defaults to False. - :rtype: str + :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -753,7 +747,7 @@ def query(self, name, data, data_type, **kwargs): if data_type.startswith("["): internal_data_type = data_type[1:-1] do_quote = not kwargs.get("skip_quote", False) - return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) + 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) @@ -804,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) @@ -824,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) @@ -993,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) @@ -1170,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): @@ -1209,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:]) @@ -1230,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:]) @@ -1371,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, @@ -1391,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 @@ -1444,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) @@ -1481,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) @@ -1515,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 @@ -1578,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 @@ -1652,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) @@ -1700,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: @@ -1757,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"]: @@ -1808,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: @@ -1862,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): @@ -1893,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 @@ -1910,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): @@ -1945,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 @@ -1982,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 @@ -1998,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/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_service_linker_management_client.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_service_linker_management_client.py index ade67153cd78..add129a2afbd 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_service_linker_management_client.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_service_linker_management_client.py @@ -9,19 +9,15 @@ 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 ServiceLinkerManagementClientConfiguration from ._serialization import Deserializer, Serializer -from .operations import ( - ConfigurationNamesOperations, - ConnectorOperations, - LinkerOperations, - LinkersOperations, - Operations, -) +from .operations import LinkerOperations, Operations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -31,22 +27,16 @@ class ServiceLinkerManagementClient: # pylint: disable=client-accepts-api-version-keyword """Microsoft.ServiceLinker provider. - :ivar connector: ConnectorOperations operations - :vartype connector: azure.mgmt.servicelinker.operations.ConnectorOperations :ivar linker: LinkerOperations operations :vartype linker: azure.mgmt.servicelinker.operations.LinkerOperations - :ivar linkers: LinkersOperations operations - :vartype linkers: azure.mgmt.servicelinker.operations.LinkersOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.servicelinker.operations.Operations - :ivar configuration_names: ConfigurationNamesOperations operations - :vartype configuration_names: azure.mgmt.servicelinker.operations.ConfigurationNamesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-04-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2022-05-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. @@ -56,21 +46,34 @@ def __init__( self, credential: "TokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: self._config = ServiceLinkerManagementClientConfiguration(credential=credential, **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) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.connector = ConnectorOperations(self._client, self._config, self._serialize, self._deserialize) self.linker = LinkerOperations(self._client, self._config, self._serialize, self._deserialize) - self.linkers = LinkersOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.configuration_names = ConfigurationNamesOperations( - 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 @@ -90,7 +93,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/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_version.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_version.py index 6f72e83fa148..e5754a47ce68 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_version.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.2.0b2" +VERSION = "1.0.0b1" diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_configuration.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_configuration.py index fb896e18f25e..c66cc43950b6 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_configuration.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/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 ServiceLinkerManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class ServiceLinkerManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for ServiceLinkerManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,14 +26,13 @@ class ServiceLinkerManagementClientConfiguration(Configuration): # pylint: disa :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: Api Version. Default value is "2023-04-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: - super(ServiceLinkerManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-04-01-preview") + api_version: str = kwargs.pop("api_version", "2022-05-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -43,6 +41,7 @@ def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-servicelinker/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -51,9 +50,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/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_service_linker_management_client.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_service_linker_management_client.py index b90e9bcaa431..8192ad5d37f8 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_service_linker_management_client.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_service_linker_management_client.py @@ -9,19 +9,15 @@ 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 from ._configuration import ServiceLinkerManagementClientConfiguration -from .operations import ( - ConfigurationNamesOperations, - ConnectorOperations, - LinkerOperations, - LinkersOperations, - Operations, -) +from .operations import LinkerOperations, Operations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -31,23 +27,16 @@ class ServiceLinkerManagementClient: # pylint: disable=client-accepts-api-version-keyword """Microsoft.ServiceLinker provider. - :ivar connector: ConnectorOperations operations - :vartype connector: azure.mgmt.servicelinker.aio.operations.ConnectorOperations :ivar linker: LinkerOperations operations :vartype linker: azure.mgmt.servicelinker.aio.operations.LinkerOperations - :ivar linkers: LinkersOperations operations - :vartype linkers: azure.mgmt.servicelinker.aio.operations.LinkersOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.servicelinker.aio.operations.Operations - :ivar configuration_names: ConfigurationNamesOperations operations - :vartype configuration_names: - azure.mgmt.servicelinker.aio.operations.ConfigurationNamesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-04-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2022-05-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. @@ -57,21 +46,36 @@ def __init__( self, credential: "AsyncTokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: self._config = ServiceLinkerManagementClientConfiguration(credential=credential, **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) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.connector = ConnectorOperations(self._client, self._config, self._serialize, self._deserialize) self.linker = LinkerOperations(self._client, self._config, self._serialize, self._deserialize) - self.linkers = LinkersOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.configuration_names = ConfigurationNamesOperations( - 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 @@ -91,7 +95,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/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/__init__.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/__init__.py index 80d740a2329c..6a161b8edd91 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/__init__.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/__init__.py @@ -6,22 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._connector_operations import ConnectorOperations from ._linker_operations import LinkerOperations -from ._linkers_operations import LinkersOperations from ._operations import Operations -from ._configuration_names_operations import ConfigurationNamesOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ConnectorOperations", "LinkerOperations", - "LinkersOperations", "Operations", - "ConfigurationNamesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_configuration_names_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_configuration_names_operations.py deleted file mode 100644 index 2121eb93cab3..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_configuration_names_operations.py +++ /dev/null @@ -1,144 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._configuration_names_operations import build_list_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigurationNamesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicelinker.aio.ServiceLinkerManagementClient`'s - :attr:`configuration_names` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.ConfigurationNameItem"]: - """Lists the configuration names generated by Service Connector for all target, client types, auth - types. - - :param filter: OData filter options. Default value is None. - :type filter: str - :param skip_token: OData skipToken option for pagination. Default value is None. - :type skip_token: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConfigurationNameItem or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicelinker.models.ConfigurationNameItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = 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)) - cls: ClsType[_models.ConfigurationNameResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - filter=filter, - skip_token=skip_token, - 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) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - 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 - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ConfigurationNameResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _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 [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.ServiceLinker/configurationNames"} diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_connector_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_connector_operations.py deleted file mode 100644 index 951d8682e504..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_connector_operations.py +++ /dev/null @@ -1,1891 +0,0 @@ -# pylint: disable=too-many-lines -# 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 io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._connector_operations import ( - build_create_dryrun_request, - build_create_or_update_request, - build_delete_dryrun_request, - build_delete_request, - build_generate_configurations_request, - build_get_dryrun_request, - build_get_request, - build_list_dryrun_request, - build_list_request, - build_update_dryrun_request, - build_update_request, - build_validate_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConnectorOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicelinker.aio.ServiceLinkerManagementClient`'s - :attr:`connector` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_dryrun( - self, subscription_id: str, resource_group_name: str, location: str, **kwargs: Any - ) -> AsyncIterable["_models.DryrunResource"]: - """list dryrun jobs. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DryrunResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = 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)) - cls: ClsType[_models.DryrunList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_dryrun_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - api_version=api_version, - template_url=self.list_dryrun.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - 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 - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DryrunList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _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 [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_dryrun.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns" - } - - @distributed_trace_async - async def get_dryrun( - self, subscription_id: str, resource_group_name: str, location: str, dryrun_name: str, **kwargs: Any - ) -> _models.DryrunResource: - """get a dryrun job. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DryrunResource or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.DryrunResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = 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)) - cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) - - request = build_get_dryrun_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - dryrun_name=dryrun_name, - api_version=api_version, - template_url=self.get_dryrun.metadata["url"], - 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 [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DryrunResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_dryrun.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } - - async def _create_dryrun_initial( - self, - subscription_id: str, - resource_group_name: str, - location: str, - dryrun_name: str, - parameters: Union[_models.DryrunResource, IO], - **kwargs: Any - ) -> _models.DryrunResource: - 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[_models.DryrunResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "DryrunResource") - - request = build_create_dryrun_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - dryrun_name=dryrun_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_dryrun_initial.metadata["url"], - 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 [200, 201]: - 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) - - if response.status_code == 200: - deserialized = self._deserialize("DryrunResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DryrunResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_dryrun_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } - - @overload - async def begin_create_dryrun( - self, - subscription_id: str, - resource_group_name: str, - location: str, - dryrun_name: str, - parameters: _models.DryrunResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DryrunResource]: - """create a dryrun job to do necessary check before actual creation. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunResource - :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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_dryrun( - self, - subscription_id: str, - resource_group_name: str, - location: str, - dryrun_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DryrunResource]: - """create a dryrun job to do necessary check before actual creation. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: IO - :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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_dryrun( - self, - subscription_id: str, - resource_group_name: str, - location: str, - dryrun_name: str, - parameters: Union[_models.DryrunResource, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.DryrunResource]: - """create a dryrun job to do necessary check before actual creation. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Is either a DryrunResource type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunResource 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. - :return: An instance of AsyncLROPoller that returns either DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :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[_models.DryrunResource] = 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._create_dryrun_initial( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - dryrun_name=dryrun_name, - parameters=parameters, - 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): - deserialized = self._deserialize("DryrunResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_dryrun.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } - - async def _update_dryrun_initial( - self, - subscription_id: str, - resource_group_name: str, - location: str, - dryrun_name: str, - parameters: Union[_models.DryrunPatch, IO], - **kwargs: Any - ) -> Optional[_models.DryrunResource]: - 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[Optional[_models.DryrunResource]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "DryrunPatch") - - request = build_update_dryrun_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - dryrun_name=dryrun_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_dryrun_initial.metadata["url"], - 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 [200, 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("DryrunResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_dryrun_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } - - @overload - async def begin_update_dryrun( - self, - subscription_id: str, - resource_group_name: str, - location: str, - dryrun_name: str, - parameters: _models.DryrunPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DryrunResource]: - """update a dryrun job to do necessary check before actual creation. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunPatch - :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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_dryrun( - self, - subscription_id: str, - resource_group_name: str, - location: str, - dryrun_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DryrunResource]: - """update a dryrun job to do necessary check before actual creation. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: IO - :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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_dryrun( - self, - subscription_id: str, - resource_group_name: str, - location: str, - dryrun_name: str, - parameters: Union[_models.DryrunPatch, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.DryrunResource]: - """update a dryrun job to do necessary check before actual creation. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Is either a DryrunPatch type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunPatch 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. - :return: An instance of AsyncLROPoller that returns either DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :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[_models.DryrunResource] = 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._update_dryrun_initial( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - dryrun_name=dryrun_name, - parameters=parameters, - 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): - deserialized = self._deserialize("DryrunResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update_dryrun.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } - - @distributed_trace_async - async def delete_dryrun( # pylint: disable=inconsistent-return-statements - self, subscription_id: str, resource_group_name: str, location: str, dryrun_name: str, **kwargs: Any - ) -> None: - """delete a dryrun job. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = 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)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_dryrun_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - dryrun_name=dryrun_name, - api_version=api_version, - template_url=self.delete_dryrun.metadata["url"], - 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 [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete_dryrun.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } - - @distributed_trace - def list( - self, subscription_id: str, resource_group_name: str, location: str, **kwargs: Any - ) -> AsyncIterable["_models.LinkerResource"]: - """Returns list of connector which connects to the resource, which supports to config the target - service during the resource provision. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either LinkerResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = 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)) - cls: ClsType[_models.ResourceList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - 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) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - 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 - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _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 [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors" - } - - @distributed_trace_async - async def get( - self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any - ) -> _models.LinkerResource: - """Returns Connector resource for a given name. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: LinkerResource or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.LinkerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = 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)) - cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) - - request = build_get_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - 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) - - _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 [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("LinkerResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } - - async def _create_or_update_initial( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Union[_models.LinkerResource, IO], - **kwargs: Any - ) -> _models.LinkerResource: - 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[_models.LinkerResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "LinkerResource") - - request = build_create_or_update_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - api_version=api_version, - 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) - - _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 [200, 201]: - 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) - - if response.status_code == 200: - deserialized = self._deserialize("LinkerResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("LinkerResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } - - @overload - async def begin_create_or_update( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: _models.LinkerResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.LinkerResource]: - """Create or update Connector resource. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connector details. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerResource - :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 LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.LinkerResource]: - """Create or update Connector resource. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connector details. Required. - :type parameters: IO - :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 LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Union[_models.LinkerResource, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.LinkerResource]: - """Create or update Connector resource. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connector details. Is either a LinkerResource type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerResource 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. - :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :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[_models.LinkerResource] = 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._create_or_update_initial( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - parameters=parameters, - 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): - deserialized = self._deserialize("LinkerResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - 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.ServiceLinker/locations/{location}/connectors/{connectorName}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = 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)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - 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) - - _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 [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } - - @distributed_trace_async - async def begin_delete( - self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_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: - """ - _headers = 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)) - 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._delete_initial( # type: ignore - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - api_version=api_version, - 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, {}) - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } - - async def _update_initial( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Union[_models.LinkerPatch, IO], - **kwargs: Any - ) -> _models.LinkerResource: - 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[_models.LinkerResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "LinkerPatch") - - request = build_update_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - api_version=api_version, - 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) - - _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 [200, 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) - - if response.status_code == 200: - deserialized = self._deserialize("LinkerResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("LinkerResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } - - @overload - async def begin_update( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: _models.LinkerPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.LinkerResource]: - """Operation to update an existing Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connector details. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch - :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 LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.LinkerResource]: - """Operation to update an existing Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connector details. Required. - :type parameters: IO - :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 LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Union[_models.LinkerPatch, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.LinkerResource]: - """Operation to update an existing Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connector details. Is either a LinkerPatch type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch 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. - :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :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[_models.LinkerResource] = 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._update_initial( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - parameters=parameters, - 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): - deserialized = self._deserialize("LinkerResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } - - async def _validate_initial( - self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any - ) -> Optional[_models.ValidateOperationResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = 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)) - cls: ClsType[Optional[_models.ValidateOperationResult]] = kwargs.pop("cls", None) - - request = build_validate_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - api_version=api_version, - template_url=self._validate_initial.metadata["url"], - 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 [200, 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ValidateOperationResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _validate_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/validate" - } - - @distributed_trace_async - async def begin_validate( - self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ValidateOperationResult]: - """Validate a Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_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 ValidateOperationResult or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.ValidateOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = 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)) - cls: ClsType[_models.ValidateOperationResult] = 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._validate_initial( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ValidateOperationResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - 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.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_validate.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/validate" - } - - @overload - async def generate_configurations( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Optional[_models.ConfigurationInfo] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConfigurationResult: - """Generate configurations for a Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connection Info, including format, secret store, etc. Default value is None. - :type parameters: ~azure.mgmt.servicelinker.models.ConfigurationInfo - :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: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def generate_configurations( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConfigurationResult: - """Generate configurations for a Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connection Info, including format, secret store, etc. Default value is None. - :type parameters: IO - :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: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def generate_configurations( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Optional[Union[_models.ConfigurationInfo, IO]] = None, - **kwargs: Any - ) -> _models.ConfigurationResult: - """Generate configurations for a Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connection Info, including format, secret store, etc. Is either a - ConfigurationInfo type or a IO type. Default value is None. - :type parameters: ~azure.mgmt.servicelinker.models.ConfigurationInfo 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 - :return: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - 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[_models.ConfigurationResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "ConfigurationInfo") - else: - _json = None - - request = build_generate_configurations_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.generate_configurations.metadata["url"], - 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 [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ConfigurationResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - generate_configurations.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/generateConfigurations" - } diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linker_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linker_operations.py index aa7384572e73..39cfbd710a12 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linker_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linker_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. @@ -6,8 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -32,12 +31,8 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._linker_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, build_list_configurations_request, build_list_request, - build_update_request, build_validate_request, ) @@ -66,13 +61,11 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def list(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.LinkerResource"]: - """Returns list of Linkers which connects to the resource. which supports to config both - application and target service during the resource provision. + """Returns list of Linkers which connects to the resource. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either LinkerResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicelinker.models.LinkerResource] @@ -82,7 +75,7 @@ def list(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.Linke _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.ResourceList] = kwargs.pop("cls", None) + cls: ClsType[_models.LinkerList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -95,15 +88,14 @@ def list(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.Linke def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_uri=resource_uri, 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 @@ -115,27 +107,27 @@ 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("ResourceList", pipeline_response) + deserialized = self._deserialize("LinkerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _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 @@ -148,610 +140,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers"} - - @distributed_trace_async - async def get(self, resource_uri: str, linker_name: str, **kwargs: Any) -> _models.LinkerResource: - """Returns Linker resource for a given name. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: LinkerResource or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.LinkerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = 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)) - cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) - - request = build_get_request( - resource_uri=resource_uri, - linker_name=linker_name, - 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) - - _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 [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("LinkerResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}"} - - async def _create_or_update_initial( - self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerResource, IO], **kwargs: Any - ) -> _models.LinkerResource: - 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[_models.LinkerResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "LinkerResource") - - request = build_create_or_update_request( - resource_uri=resource_uri, - linker_name=linker_name, - api_version=api_version, - 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) - - _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 [200, 201]: - 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) - - if response.status_code == 200: - deserialized = self._deserialize("LinkerResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("LinkerResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_or_update_initial.metadata = { - "url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}" - } - - @overload - async def begin_create_or_update( - self, - resource_uri: str, - linker_name: str, - parameters: _models.LinkerResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.LinkerResource]: - """Create or update Linker resource. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :param parameters: Linker details. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerResource - :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 LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_uri: str, - linker_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.LinkerResource]: - """Create or update Linker resource. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :param parameters: Linker details. Required. - :type parameters: IO - :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 LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerResource, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.LinkerResource]: - """Create or update Linker resource. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :param parameters: Linker details. Is either a LinkerResource type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerResource 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. - :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :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[_models.LinkerResource] = 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._create_or_update_initial( - resource_uri=resource_uri, - linker_name=linker_name, - parameters=parameters, - 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): - deserialized = self._deserialize("LinkerResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}"} - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_uri: str, linker_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = 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)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_uri=resource_uri, - linker_name=linker_name, - 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) - - _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 [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}"} - - @distributed_trace_async - async def begin_delete(self, resource_uri: str, linker_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Delete a Linker. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_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: - """ - _headers = 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)) - 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._delete_initial( # type: ignore - resource_uri=resource_uri, - linker_name=linker_name, - api_version=api_version, - 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, {}) - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}"} - - async def _update_initial( - self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerPatch, IO], **kwargs: Any - ) -> _models.LinkerResource: - 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[_models.LinkerResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "LinkerPatch") - - request = build_update_request( - resource_uri=resource_uri, - linker_name=linker_name, - api_version=api_version, - 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) - - _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 [200, 201]: - 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) - - if response.status_code == 200: - deserialized = self._deserialize("LinkerResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("LinkerResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _update_initial.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}"} - - @overload - async def begin_update( - self, - resource_uri: str, - linker_name: str, - parameters: _models.LinkerPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.LinkerResource]: - """Operation to update an existing Linker. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :param parameters: Linker details. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch - :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 LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_uri: str, - linker_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.LinkerResource]: - """Operation to update an existing Linker. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :param parameters: Linker details. Required. - :type parameters: IO - :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 LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerPatch, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.LinkerResource]: - """Operation to update an existing Linker. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :param parameters: Linker details. Is either a LinkerPatch type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch 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. - :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :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[_models.LinkerResource] = 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._update_initial( - resource_uri=resource_uri, - linker_name=linker_name, - parameters=parameters, - 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): - deserialized = self._deserialize("LinkerResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}"} - async def _validate_initial( self, resource_uri: str, linker_name: str, **kwargs: Any ) -> Optional[_models.ValidateOperationResult]: @@ -769,20 +157,19 @@ async def _validate_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.ValidateOperationResult]] = kwargs.pop("cls", None) - request = build_validate_request( + _request = build_validate_request( resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, - template_url=self._validate_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 @@ -797,33 +184,21 @@ async def _validate_initial( deserialized = self._deserialize("ValidateOperationResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _validate_initial.metadata = { - "url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/validateLinker" - } + return deserialized # type: ignore @distributed_trace_async async def begin_validate( self, resource_uri: str, linker_name: str, **kwargs: Any ) -> AsyncLROPoller[_models.ValidateOperationResult]: - """Validate a Linker. + """Validate a link. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str :param linker_name: The name Linker resource. Required. :type linker_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 ValidateOperationResult or the result of cls(response) :rtype: @@ -853,44 +228,42 @@ async def begin_validate( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ValidateOperationResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ValidateOperationResult].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_validate.metadata = { - "url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/validateLinker" - } + return AsyncLROPoller[_models.ValidateOperationResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace_async async def list_configurations( self, resource_uri: str, linker_name: str, **kwargs: Any - ) -> _models.ConfigurationResult: - """list source configurations for a Linker. + ) -> _models.SourceConfigurationResult: + """list source configurations for a linker. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str :param linker_name: The name Linker resource. Required. :type linker_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult + :return: SourceConfigurationResult or the result of cls(response) + :rtype: ~azure.mgmt.servicelinker.models.SourceConfigurationResult :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -905,22 +278,21 @@ async def list_configurations( _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.ConfigurationResult] = kwargs.pop("cls", None) + cls: ClsType[_models.SourceConfigurationResult] = kwargs.pop("cls", None) - request = build_list_configurations_request( + _request = build_list_configurations_request( resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, - template_url=self.list_configurations.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 @@ -930,13 +302,9 @@ async def list_configurations( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConfigurationResult", pipeline_response) + deserialized = self._deserialize("SourceConfigurationResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_configurations.metadata = { - "url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/listConfigurations" - } + return deserialized # type: ignore diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linkers_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linkers_operations.py deleted file mode 100644 index e0882cbe48c2..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linkers_operations.py +++ /dev/null @@ -1,929 +0,0 @@ -# pylint: disable=too-many-lines -# 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 io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._linkers_operations import ( - build_create_dryrun_request, - build_delete_dryrun_request, - build_generate_configurations_request, - build_get_dryrun_request, - build_list_dapr_configurations_request, - build_list_dryrun_request, - build_update_dryrun_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class LinkersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicelinker.aio.ServiceLinkerManagementClient`'s - :attr:`linkers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_dryrun(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.DryrunResource"]: - """list dryrun jobs. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DryrunResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = 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)) - cls: ClsType[_models.DryrunList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_dryrun_request( - resource_uri=resource_uri, - api_version=api_version, - template_url=self.list_dryrun.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - 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 - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DryrunList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _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 [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_dryrun.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns"} - - @distributed_trace_async - async def get_dryrun(self, resource_uri: str, dryrun_name: str, **kwargs: Any) -> _models.DryrunResource: - """get a dryrun job. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DryrunResource or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.DryrunResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = 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)) - cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) - - request = build_get_dryrun_request( - resource_uri=resource_uri, - dryrun_name=dryrun_name, - api_version=api_version, - template_url=self.get_dryrun.metadata["url"], - 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 [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DryrunResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_dryrun.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} - - async def _create_dryrun_initial( - self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunResource, IO], **kwargs: Any - ) -> _models.DryrunResource: - 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[_models.DryrunResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "DryrunResource") - - request = build_create_dryrun_request( - resource_uri=resource_uri, - dryrun_name=dryrun_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_dryrun_initial.metadata["url"], - 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 [200, 201]: - 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) - - if response.status_code == 200: - deserialized = self._deserialize("DryrunResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DryrunResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_dryrun_initial.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} - - @overload - async def begin_create_dryrun( - self, - resource_uri: str, - dryrun_name: str, - parameters: _models.DryrunResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DryrunResource]: - """create a dryrun job to do necessary check before actual creation. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunResource - :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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_dryrun( - self, - resource_uri: str, - dryrun_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DryrunResource]: - """create a dryrun job to do necessary check before actual creation. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: IO - :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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_dryrun( - self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunResource, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.DryrunResource]: - """create a dryrun job to do necessary check before actual creation. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Is either a DryrunResource type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunResource 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. - :return: An instance of AsyncLROPoller that returns either DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :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[_models.DryrunResource] = 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._create_dryrun_initial( - resource_uri=resource_uri, - dryrun_name=dryrun_name, - parameters=parameters, - 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): - deserialized = self._deserialize("DryrunResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_dryrun.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} - - async def _update_dryrun_initial( - self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunPatch, IO], **kwargs: Any - ) -> Optional[_models.DryrunResource]: - 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[Optional[_models.DryrunResource]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "DryrunPatch") - - request = build_update_dryrun_request( - resource_uri=resource_uri, - dryrun_name=dryrun_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_dryrun_initial.metadata["url"], - 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 [200, 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("DryrunResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_dryrun_initial.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} - - @overload - async def begin_update_dryrun( - self, - resource_uri: str, - dryrun_name: str, - parameters: _models.DryrunPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DryrunResource]: - """add a dryrun job to do necessary check before actual creation. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunPatch - :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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_dryrun( - self, - resource_uri: str, - dryrun_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DryrunResource]: - """add a dryrun job to do necessary check before actual creation. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: IO - :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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_dryrun( - self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunPatch, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.DryrunResource]: - """add a dryrun job to do necessary check before actual creation. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Is either a DryrunPatch type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunPatch 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. - :return: An instance of AsyncLROPoller that returns either DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :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[_models.DryrunResource] = 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._update_dryrun_initial( - resource_uri=resource_uri, - dryrun_name=dryrun_name, - parameters=parameters, - 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): - deserialized = self._deserialize("DryrunResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update_dryrun.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} - - @distributed_trace_async - async def delete_dryrun( # pylint: disable=inconsistent-return-statements - self, resource_uri: str, dryrun_name: str, **kwargs: Any - ) -> None: - """delete a dryrun job. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = 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)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_dryrun_request( - resource_uri=resource_uri, - dryrun_name=dryrun_name, - api_version=api_version, - template_url=self.delete_dryrun.metadata["url"], - 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 [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete_dryrun.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} - - @overload - async def generate_configurations( - self, - resource_uri: str, - linker_name: str, - parameters: Optional[_models.ConfigurationInfo] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConfigurationResult: - """Generate configurations for a Linker. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :param parameters: Connection Info, including format, secret store, etc. Default value is None. - :type parameters: ~azure.mgmt.servicelinker.models.ConfigurationInfo - :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: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def generate_configurations( - self, - resource_uri: str, - linker_name: str, - parameters: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConfigurationResult: - """Generate configurations for a Linker. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :param parameters: Connection Info, including format, secret store, etc. Default value is None. - :type parameters: IO - :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: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def generate_configurations( - self, - resource_uri: str, - linker_name: str, - parameters: Optional[Union[_models.ConfigurationInfo, IO]] = None, - **kwargs: Any - ) -> _models.ConfigurationResult: - """Generate configurations for a Linker. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :param parameters: Connection Info, including format, secret store, etc. Is either a - ConfigurationInfo type or a IO type. Default value is None. - :type parameters: ~azure.mgmt.servicelinker.models.ConfigurationInfo 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 - :return: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - 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[_models.ConfigurationResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "ConfigurationInfo") - else: - _json = None - - request = build_generate_configurations_request( - resource_uri=resource_uri, - linker_name=linker_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.generate_configurations.metadata["url"], - 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 [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ConfigurationResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - generate_configurations.metadata = { - "url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/generateConfigurations" - } - - @distributed_trace - def list_dapr_configurations( - self, resource_uri: str, **kwargs: Any - ) -> AsyncIterable["_models.DaprConfigurationResource"]: - """List the dapr configuration supported by Service Connector. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DaprConfigurationResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicelinker.models.DaprConfigurationResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = 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)) - cls: ClsType[_models.DaprConfigurationList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_dapr_configurations_request( - resource_uri=resource_uri, - api_version=api_version, - template_url=self.list_dapr_configurations.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - 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 - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DaprConfigurationList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _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 [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_dapr_configurations.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/daprConfigurations"} diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_operations.py index 672ca4560ab8..e8c4d1d1c2aa 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/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"]: """Lists the available ServiceLinker REST API operations. - :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.servicelinker.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.ServiceLinker/operations"} diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/__init__.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/__init__.py index 88a26589b666..5c735956e364 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/__init__.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/__init__.py @@ -6,84 +6,47 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._models_py3 import AccessKeyInfoBase from ._models_py3 import AuthInfoBase from ._models_py3 import AzureKeyVaultProperties from ._models_py3 import AzureResource from ._models_py3 import AzureResourcePropertiesBase -from ._models_py3 import BasicErrorDryrunPrerequisiteResult -from ._models_py3 import ConfigurationInfo -from ._models_py3 import ConfigurationName -from ._models_py3 import ConfigurationNameItem -from ._models_py3 import ConfigurationNameResult -from ._models_py3 import ConfigurationResult -from ._models_py3 import ConfigurationStore from ._models_py3 import ConfluentBootstrapServer from ._models_py3 import ConfluentSchemaRegistry -from ._models_py3 import CreateOrUpdateDryrunParameters -from ._models_py3 import DaprConfigurationList -from ._models_py3 import DaprConfigurationResource -from ._models_py3 import DaprMetadata -from ._models_py3 import DaprProperties -from ._models_py3 import DatabaseAadAuthInfo -from ._models_py3 import DryrunList -from ._models_py3 import DryrunOperationPreview -from ._models_py3 import DryrunParameters -from ._models_py3 import DryrunPatch -from ._models_py3 import DryrunPrerequisiteResult -from ._models_py3 import DryrunResource -from ._models_py3 import EasyAuthMicrosoftEntraIDAuthInfo from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse -from ._models_py3 import FirewallRules from ._models_py3 import KeyVaultSecretReferenceSecretInfo from ._models_py3 import KeyVaultSecretUriSecretInfo +from ._models_py3 import LinkerList from ._models_py3 import LinkerPatch -from ._models_py3 import LinkerProperties from ._models_py3 import LinkerResource from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import OperationListResult -from ._models_py3 import PermissionsMissingDryrunPrerequisiteResult from ._models_py3 import ProxyResource -from ._models_py3 import PublicNetworkSolution from ._models_py3 import Resource -from ._models_py3 import ResourceList from ._models_py3 import SecretAuthInfo from ._models_py3 import SecretInfoBase from ._models_py3 import SecretStore -from ._models_py3 import SelfHostedServer from ._models_py3 import ServicePrincipalCertificateAuthInfo from ._models_py3 import ServicePrincipalSecretAuthInfo from ._models_py3 import SourceConfiguration +from ._models_py3 import SourceConfigurationResult from ._models_py3 import SystemAssignedIdentityAuthInfo from ._models_py3 import SystemData from ._models_py3 import TargetServiceBase -from ._models_py3 import UserAccountAuthInfo from ._models_py3 import UserAssignedIdentityAuthInfo from ._models_py3 import VNetSolution from ._models_py3 import ValidateOperationResult from ._models_py3 import ValidationResultItem from ._models_py3 import ValueSecretInfo -from ._service_linker_management_client_enums import AccessKeyPermissions from ._service_linker_management_client_enums import ActionType -from ._service_linker_management_client_enums import AllowType -from ._service_linker_management_client_enums import AuthMode from ._service_linker_management_client_enums import AuthType from ._service_linker_management_client_enums import AzureResourceType from ._service_linker_management_client_enums import ClientType from ._service_linker_management_client_enums import CreatedByType -from ._service_linker_management_client_enums import DaprBindingComponentDirection -from ._service_linker_management_client_enums import DaprMetadataRequired -from ._service_linker_management_client_enums import DeleteOrUpdateBehavior -from ._service_linker_management_client_enums import DryrunActionName -from ._service_linker_management_client_enums import DryrunPrerequisiteResultType -from ._service_linker_management_client_enums import DryrunPreviewOperationType -from ._service_linker_management_client_enums import LinkerConfigurationType from ._service_linker_management_client_enums import Origin -from ._service_linker_management_client_enums import SecretSourceType from ._service_linker_management_client_enums import SecretType from ._service_linker_management_client_enums import TargetServiceType from ._service_linker_management_client_enums import VNetSolutionType @@ -93,83 +56,46 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "AccessKeyInfoBase", "AuthInfoBase", "AzureKeyVaultProperties", "AzureResource", "AzureResourcePropertiesBase", - "BasicErrorDryrunPrerequisiteResult", - "ConfigurationInfo", - "ConfigurationName", - "ConfigurationNameItem", - "ConfigurationNameResult", - "ConfigurationResult", - "ConfigurationStore", "ConfluentBootstrapServer", "ConfluentSchemaRegistry", - "CreateOrUpdateDryrunParameters", - "DaprConfigurationList", - "DaprConfigurationResource", - "DaprMetadata", - "DaprProperties", - "DatabaseAadAuthInfo", - "DryrunList", - "DryrunOperationPreview", - "DryrunParameters", - "DryrunPatch", - "DryrunPrerequisiteResult", - "DryrunResource", - "EasyAuthMicrosoftEntraIDAuthInfo", "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", - "FirewallRules", "KeyVaultSecretReferenceSecretInfo", "KeyVaultSecretUriSecretInfo", + "LinkerList", "LinkerPatch", - "LinkerProperties", "LinkerResource", "Operation", "OperationDisplay", "OperationListResult", - "PermissionsMissingDryrunPrerequisiteResult", "ProxyResource", - "PublicNetworkSolution", "Resource", - "ResourceList", "SecretAuthInfo", "SecretInfoBase", "SecretStore", - "SelfHostedServer", "ServicePrincipalCertificateAuthInfo", "ServicePrincipalSecretAuthInfo", "SourceConfiguration", + "SourceConfigurationResult", "SystemAssignedIdentityAuthInfo", "SystemData", "TargetServiceBase", - "UserAccountAuthInfo", "UserAssignedIdentityAuthInfo", "VNetSolution", "ValidateOperationResult", "ValidationResultItem", "ValueSecretInfo", - "AccessKeyPermissions", "ActionType", - "AllowType", - "AuthMode", "AuthType", "AzureResourceType", "ClientType", "CreatedByType", - "DaprBindingComponentDirection", - "DaprMetadataRequired", - "DeleteOrUpdateBehavior", - "DryrunActionName", - "DryrunPrerequisiteResultType", - "DryrunPreviewOperationType", - "LinkerConfigurationType", "Origin", - "SecretSourceType", "SecretType", "TargetServiceType", "VNetSolutionType", diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_models_py3.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_models_py3.py index 7ae228143b04..aaadc571aec2 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_models_py3.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, List, Optional, TYPE_CHECKING, Union from .. import _serialization @@ -21,21 +21,14 @@ class AuthInfoBase(_serialization.Model): """The authentication info. You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AccessKeyInfoBase, EasyAuthMicrosoftEntraIDAuthInfo, SecretAuthInfo, - ServicePrincipalCertificateAuthInfo, ServicePrincipalSecretAuthInfo, - SystemAssignedIdentityAuthInfo, UserAccountAuthInfo, UserAssignedIdentityAuthInfo + SecretAuthInfo, ServicePrincipalCertificateAuthInfo, ServicePrincipalSecretAuthInfo, + SystemAssignedIdentityAuthInfo, UserAssignedIdentityAuthInfo - 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 auth_type: The authentication type. Required. Known values are: "systemAssignedIdentity", - "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", - "accessKey", "userAccount", and "easyAuthMicrosoftEntraID". + "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", and "secret". :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType - :ivar auth_mode: Optional. Indicates how to configure authentication. If optInAllAuth, service - linker configures authentication such as enabling identity on source resource and granting RBAC - roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. Known values - are: "optInAllAuth" and "optOutAllAuth". - :vartype auth_mode: str or ~azure.mgmt.servicelinker.models.AuthMode """ _validation = { @@ -44,1397 +37,220 @@ class AuthInfoBase(_serialization.Model): _attribute_map = { "auth_type": {"key": "authType", "type": "str"}, - "auth_mode": {"key": "authMode", "type": "str"}, } _subtype_map = { "auth_type": { - "accessKey": "AccessKeyInfoBase", - "easyAuthMicrosoftEntraID": "EasyAuthMicrosoftEntraIDAuthInfo", "secret": "SecretAuthInfo", "servicePrincipalCertificate": "ServicePrincipalCertificateAuthInfo", "servicePrincipalSecret": "ServicePrincipalSecretAuthInfo", "systemAssignedIdentity": "SystemAssignedIdentityAuthInfo", - "userAccount": "UserAccountAuthInfo", "userAssignedIdentity": "UserAssignedIdentityAuthInfo", } } - def __init__(self, *, auth_mode: Optional[Union[str, "_models.AuthMode"]] = None, **kwargs: Any) -> None: - """ - :keyword auth_mode: Optional. Indicates how to configure authentication. If optInAllAuth, - service linker configures authentication such as enabling identity on source resource and - granting RBAC roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. - Known values are: "optInAllAuth" and "optOutAllAuth". - :paramtype auth_mode: str or ~azure.mgmt.servicelinker.models.AuthMode - """ - super().__init__(**kwargs) - self.auth_type: Optional[str] = None - self.auth_mode = auth_mode - - -class AccessKeyInfoBase(AuthInfoBase): - """The access key directly from target resource properties, which target service is Azure - Resource, such as Microsoft.Storage. - - All required parameters must be populated in order to send to Azure. - - :ivar auth_type: The authentication type. Required. Known values are: "systemAssignedIdentity", - "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", - "accessKey", "userAccount", and "easyAuthMicrosoftEntraID". - :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType - :ivar auth_mode: Optional. Indicates how to configure authentication. If optInAllAuth, service - linker configures authentication such as enabling identity on source resource and granting RBAC - roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. Known values - are: "optInAllAuth" and "optOutAllAuth". - :vartype auth_mode: str or ~azure.mgmt.servicelinker.models.AuthMode - :ivar permissions: Permissions of the accessKey. ``Read`` and ``Write`` are for Azure Cosmos DB - and Azure App Configuration, ``Listen``\ , ``Send`` and ``Manage`` are for Azure Event Hub and - Azure Service Bus. - :vartype permissions: list[str or ~azure.mgmt.servicelinker.models.AccessKeyPermissions] - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - "auth_mode": {"key": "authMode", "type": "str"}, - "permissions": {"key": "permissions", "type": "[str]"}, - } - - def __init__( - self, - *, - auth_mode: Optional[Union[str, "_models.AuthMode"]] = None, - permissions: Optional[List[Union[str, "_models.AccessKeyPermissions"]]] = None, - **kwargs: Any - ) -> None: - """ - :keyword auth_mode: Optional. Indicates how to configure authentication. If optInAllAuth, - service linker configures authentication such as enabling identity on source resource and - granting RBAC roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. - Known values are: "optInAllAuth" and "optOutAllAuth". - :paramtype auth_mode: str or ~azure.mgmt.servicelinker.models.AuthMode - :keyword permissions: Permissions of the accessKey. ``Read`` and ``Write`` are for Azure Cosmos - DB and Azure App Configuration, ``Listen``\ , ``Send`` and ``Manage`` are for Azure Event Hub - and Azure Service Bus. - :paramtype permissions: list[str or ~azure.mgmt.servicelinker.models.AccessKeyPermissions] - """ - super().__init__(auth_mode=auth_mode, **kwargs) - self.auth_type: str = "accessKey" - self.permissions = permissions - - -class AzureResourcePropertiesBase(_serialization.Model): - """The azure resource properties. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AzureKeyVaultProperties - - All required parameters must be populated in order to send to Azure. - - :ivar type: The azure resource type. Required. "KeyVault" - :vartype type: str or ~azure.mgmt.servicelinker.models.AzureResourceType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - _subtype_map = {"type": {"KeyVault": "AzureKeyVaultProperties"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - - -class AzureKeyVaultProperties(AzureResourcePropertiesBase): - """The resource properties when type is Azure Key Vault. - - All required parameters must be populated in order to send to Azure. - - :ivar type: The azure resource type. Required. "KeyVault" - :vartype type: str or ~azure.mgmt.servicelinker.models.AzureResourceType - :ivar connect_as_kubernetes_csi_driver: True if connect via Kubernetes CSI Driver. - :vartype connect_as_kubernetes_csi_driver: bool - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "connect_as_kubernetes_csi_driver": {"key": "connectAsKubernetesCsiDriver", "type": "bool"}, - } - - def __init__(self, *, connect_as_kubernetes_csi_driver: Optional[bool] = None, **kwargs: Any) -> None: - """ - :keyword connect_as_kubernetes_csi_driver: True if connect via Kubernetes CSI Driver. - :paramtype connect_as_kubernetes_csi_driver: bool - """ - super().__init__(**kwargs) - self.type: str = "KeyVault" - self.connect_as_kubernetes_csi_driver = connect_as_kubernetes_csi_driver - - -class TargetServiceBase(_serialization.Model): - """The target service properties. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AzureResource, ConfluentBootstrapServer, ConfluentSchemaRegistry, SelfHostedServer - - All required parameters must be populated in order to send to Azure. - - :ivar type: The target service type. Required. Known values are: "AzureResource", - "ConfluentBootstrapServer", "ConfluentSchemaRegistry", and "SelfHostedServer". - :vartype type: str or ~azure.mgmt.servicelinker.models.TargetServiceType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - _subtype_map = { - "type": { - "AzureResource": "AzureResource", - "ConfluentBootstrapServer": "ConfluentBootstrapServer", - "ConfluentSchemaRegistry": "ConfluentSchemaRegistry", - "SelfHostedServer": "SelfHostedServer", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - - -class AzureResource(TargetServiceBase): - """The azure resource info when target service type is AzureResource. - - All required parameters must be populated in order to send to Azure. - - :ivar type: The target service type. Required. Known values are: "AzureResource", - "ConfluentBootstrapServer", "ConfluentSchemaRegistry", and "SelfHostedServer". - :vartype type: str or ~azure.mgmt.servicelinker.models.TargetServiceType - :ivar id: The Id of azure resource. - :vartype id: str - :ivar resource_properties: The azure resource connection related properties. - :vartype resource_properties: ~azure.mgmt.servicelinker.models.AzureResourcePropertiesBase - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "resource_properties": {"key": "resourceProperties", "type": "AzureResourcePropertiesBase"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - resource_properties: Optional["_models.AzureResourcePropertiesBase"] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The Id of azure resource. - :paramtype id: str - :keyword resource_properties: The azure resource connection related properties. - :paramtype resource_properties: ~azure.mgmt.servicelinker.models.AzureResourcePropertiesBase - """ - super().__init__(**kwargs) - self.type: str = "AzureResource" - self.id = id - self.resource_properties = resource_properties - - -class DryrunPrerequisiteResult(_serialization.Model): - """A result of dryrun. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - BasicErrorDryrunPrerequisiteResult, PermissionsMissingDryrunPrerequisiteResult - - All required parameters must be populated in order to send to Azure. - - :ivar type: The type of dryrun result. Required. Known values are: "basicError" and - "permissionsMissing". - :vartype type: str or ~azure.mgmt.servicelinker.models.DryrunPrerequisiteResultType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - _subtype_map = { - "type": { - "basicError": "BasicErrorDryrunPrerequisiteResult", - "permissionsMissing": "PermissionsMissingDryrunPrerequisiteResult", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - - -class BasicErrorDryrunPrerequisiteResult(DryrunPrerequisiteResult): - """The represent of basic error. - - All required parameters must be populated in order to send to Azure. - - :ivar type: The type of dryrun result. Required. Known values are: "basicError" and - "permissionsMissing". - :vartype type: str or ~azure.mgmt.servicelinker.models.DryrunPrerequisiteResultType - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword code: The error code. - :paramtype code: str - :keyword message: The error message. - :paramtype message: str - """ - super().__init__(**kwargs) - self.type: str = "basicError" - self.code = code - self.message = message - - -class ConfigurationInfo(_serialization.Model): - """The configuration information, used to generate configurations or save to applications. - - :ivar delete_or_update_behavior: Indicates whether to clean up previous operation when Linker - is updating or deleting. Known values are: "Default" and "ForcedCleanup". - :vartype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior - :ivar action: Optional, indicate whether to apply configurations on source application. If - enable, generate configurations and applied to the source application. Default is enable. If - optOut, no configuration change will be made on source. Known values are: "Internal", "enable", - and "optOut". - :vartype action: str or ~azure.mgmt.servicelinker.models.ActionType - :ivar customized_keys: Optional. A dictionary of default key name and customized key name - mapping. If not specified, default key name will be used for generate configurations. - :vartype customized_keys: dict[str, str] - :ivar dapr_properties: Indicates some additional properties for dapr client type. - :vartype dapr_properties: ~azure.mgmt.servicelinker.models.DaprProperties - :ivar additional_configurations: A dictionary of additional configurations to be added. Service - will auto generate a set of basic configurations and this property is to full fill more - customized configurations. - :vartype additional_configurations: dict[str, str] - :ivar additional_connection_string_properties: A dictionary of additional properties to be - added in the end of connection string. - :vartype additional_connection_string_properties: dict[str, str] - :ivar configuration_store: An option to store configuration into different place. - :vartype configuration_store: ~azure.mgmt.servicelinker.models.ConfigurationStore - """ - - _attribute_map = { - "delete_or_update_behavior": {"key": "deleteOrUpdateBehavior", "type": "str"}, - "action": {"key": "action", "type": "str"}, - "customized_keys": {"key": "customizedKeys", "type": "{str}"}, - "dapr_properties": {"key": "daprProperties", "type": "DaprProperties"}, - "additional_configurations": {"key": "additionalConfigurations", "type": "{str}"}, - "additional_connection_string_properties": {"key": "additionalConnectionStringProperties", "type": "{str}"}, - "configuration_store": {"key": "configurationStore", "type": "ConfigurationStore"}, - } - - def __init__( - self, - *, - delete_or_update_behavior: Optional[Union[str, "_models.DeleteOrUpdateBehavior"]] = None, - action: Optional[Union[str, "_models.ActionType"]] = None, - customized_keys: Optional[Dict[str, str]] = None, - dapr_properties: Optional["_models.DaprProperties"] = None, - additional_configurations: Optional[Dict[str, str]] = None, - additional_connection_string_properties: Optional[Dict[str, str]] = None, - configuration_store: Optional["_models.ConfigurationStore"] = None, - **kwargs: Any - ) -> None: - """ - :keyword delete_or_update_behavior: Indicates whether to clean up previous operation when - Linker is updating or deleting. Known values are: "Default" and "ForcedCleanup". - :paramtype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior - :keyword action: Optional, indicate whether to apply configurations on source application. If - enable, generate configurations and applied to the source application. Default is enable. If - optOut, no configuration change will be made on source. Known values are: "Internal", "enable", - and "optOut". - :paramtype action: str or ~azure.mgmt.servicelinker.models.ActionType - :keyword customized_keys: Optional. A dictionary of default key name and customized key name - mapping. If not specified, default key name will be used for generate configurations. - :paramtype customized_keys: dict[str, str] - :keyword dapr_properties: Indicates some additional properties for dapr client type. - :paramtype dapr_properties: ~azure.mgmt.servicelinker.models.DaprProperties - :keyword additional_configurations: A dictionary of additional configurations to be added. - Service will auto generate a set of basic configurations and this property is to full fill more - customized configurations. - :paramtype additional_configurations: dict[str, str] - :keyword additional_connection_string_properties: A dictionary of additional properties to be - added in the end of connection string. - :paramtype additional_connection_string_properties: dict[str, str] - :keyword configuration_store: An option to store configuration into different place. - :paramtype configuration_store: ~azure.mgmt.servicelinker.models.ConfigurationStore - """ - super().__init__(**kwargs) - self.delete_or_update_behavior = delete_or_update_behavior - self.action = action - self.customized_keys = customized_keys - self.dapr_properties = dapr_properties - self.additional_configurations = additional_configurations - self.additional_connection_string_properties = additional_connection_string_properties - self.configuration_store = configuration_store - - -class ConfigurationName(_serialization.Model): - """The configuration names. - - :ivar value: - :vartype value: str - :ivar description: Description for the configuration name. - :vartype description: str - :ivar required: Represent the configuration is required or not. - :vartype required: bool - """ - - _attribute_map = { - "value": {"key": "value", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "required": {"key": "required", "type": "bool"}, - } - - def __init__( - self, - *, - value: Optional[str] = None, - description: Optional[str] = None, - required: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: - :paramtype value: str - :keyword description: Description for the configuration name. - :paramtype description: str - :keyword required: Represent the configuration is required or not. - :paramtype required: bool - """ - super().__init__(**kwargs) - self.value = value - self.description = description - self.required = required - - -class ConfigurationNameItem(_serialization.Model): - """ConfigurationNameItem. - - :ivar target_service: The target service provider name and resource name. - :vartype target_service: str - :ivar client_type: The client type for configuration names. Known values are: "none", "dotnet", - "java", "python", "go", "php", "ruby", "django", "nodejs", "springBoot", "kafka-springBoot", - "jms-springBoot", and "dapr". - :vartype client_type: str or ~azure.mgmt.servicelinker.models.ClientType - :ivar auth_type: The auth type. Known values are: "systemAssignedIdentity", - "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", - "accessKey", "userAccount", and "easyAuthMicrosoftEntraID". - :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType - :ivar secret_type: Indicates where the secrets in configuration from. Used when secrets are - from Keyvault. Known values are: "rawValue" and "keyVaultSecret". - :vartype secret_type: str or ~azure.mgmt.servicelinker.models.SecretSourceType - :ivar dapr_properties: Deprecated, please use #/definitions/DaprConfigurationList instead. - :vartype dapr_properties: ~azure.mgmt.servicelinker.models.DaprProperties - :ivar names: The configuration names to be set in compute service environment. - :vartype names: list[~azure.mgmt.servicelinker.models.ConfigurationName] - """ - - _attribute_map = { - "target_service": {"key": "properties.targetService", "type": "str"}, - "client_type": {"key": "properties.clientType", "type": "str"}, - "auth_type": {"key": "properties.authType", "type": "str"}, - "secret_type": {"key": "properties.secretType", "type": "str"}, - "dapr_properties": {"key": "properties.daprProperties", "type": "DaprProperties"}, - "names": {"key": "properties.names", "type": "[ConfigurationName]"}, - } - - def __init__( - self, - *, - target_service: Optional[str] = None, - client_type: Optional[Union[str, "_models.ClientType"]] = None, - auth_type: Optional[Union[str, "_models.AuthType"]] = None, - secret_type: Optional[Union[str, "_models.SecretSourceType"]] = None, - dapr_properties: Optional["_models.DaprProperties"] = None, - names: Optional[List["_models.ConfigurationName"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword target_service: The target service provider name and resource name. - :paramtype target_service: str - :keyword client_type: The client type for configuration names. Known values are: "none", - "dotnet", "java", "python", "go", "php", "ruby", "django", "nodejs", "springBoot", - "kafka-springBoot", "jms-springBoot", and "dapr". - :paramtype client_type: str or ~azure.mgmt.servicelinker.models.ClientType - :keyword auth_type: The auth type. Known values are: "systemAssignedIdentity", - "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", - "accessKey", "userAccount", and "easyAuthMicrosoftEntraID". - :paramtype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType - :keyword secret_type: Indicates where the secrets in configuration from. Used when secrets are - from Keyvault. Known values are: "rawValue" and "keyVaultSecret". - :paramtype secret_type: str or ~azure.mgmt.servicelinker.models.SecretSourceType - :keyword dapr_properties: Deprecated, please use #/definitions/DaprConfigurationList instead. - :paramtype dapr_properties: ~azure.mgmt.servicelinker.models.DaprProperties - :keyword names: The configuration names to be set in compute service environment. - :paramtype names: list[~azure.mgmt.servicelinker.models.ConfigurationName] - """ - super().__init__(**kwargs) - self.target_service = target_service - self.client_type = client_type - self.auth_type = auth_type - self.secret_type = secret_type - self.dapr_properties = dapr_properties - self.names = names - - -class ConfigurationNameResult(_serialization.Model): - """Configuration Name list which will be set based on different target resource, client type, auth - type. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Expected configuration names for each target service. - :vartype value: list[~azure.mgmt.servicelinker.models.ConfigurationNameItem] - :ivar next_link: Link to next page of resources. - :vartype next_link: str - """ - - _validation = { - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[ConfigurationNameItem]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: Optional[List["_models.ConfigurationNameItem"]] = None, **kwargs: Any) -> None: - """ - :keyword value: Expected configuration names for each target service. - :paramtype value: list[~azure.mgmt.servicelinker.models.ConfigurationNameItem] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None - - -class ConfigurationResult(_serialization.Model): - """Configurations for source resource, include appSettings, connectionString and serviceBindings. - - :ivar configurations: The configuration properties for source resource. - :vartype configurations: list[~azure.mgmt.servicelinker.models.SourceConfiguration] - """ - - _attribute_map = { - "configurations": {"key": "configurations", "type": "[SourceConfiguration]"}, - } - - def __init__(self, *, configurations: Optional[List["_models.SourceConfiguration"]] = None, **kwargs: Any) -> None: - """ - :keyword configurations: The configuration properties for source resource. - :paramtype configurations: list[~azure.mgmt.servicelinker.models.SourceConfiguration] - """ - super().__init__(**kwargs) - self.configurations = configurations - - -class ConfigurationStore(_serialization.Model): - """An option to store configuration into different place. - - :ivar app_configuration_id: The app configuration id to store configuration. - :vartype app_configuration_id: str - """ - - _attribute_map = { - "app_configuration_id": {"key": "appConfigurationId", "type": "str"}, - } - - def __init__(self, *, app_configuration_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword app_configuration_id: The app configuration id to store configuration. - :paramtype app_configuration_id: str - """ - super().__init__(**kwargs) - self.app_configuration_id = app_configuration_id - - -class ConfluentBootstrapServer(TargetServiceBase): - """The service properties when target service type is ConfluentBootstrapServer. - - All required parameters must be populated in order to send to Azure. - - :ivar type: The target service type. Required. Known values are: "AzureResource", - "ConfluentBootstrapServer", "ConfluentSchemaRegistry", and "SelfHostedServer". - :vartype type: str or ~azure.mgmt.servicelinker.models.TargetServiceType - :ivar endpoint: The endpoint of service. - :vartype endpoint: str - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "endpoint": {"key": "endpoint", "type": "str"}, - } - - def __init__(self, *, endpoint: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword endpoint: The endpoint of service. - :paramtype endpoint: str - """ - super().__init__(**kwargs) - self.type: str = "ConfluentBootstrapServer" - self.endpoint = endpoint - - -class ConfluentSchemaRegistry(TargetServiceBase): - """The service properties when target service type is ConfluentSchemaRegistry. - - All required parameters must be populated in order to send to Azure. - - :ivar type: The target service type. Required. Known values are: "AzureResource", - "ConfluentBootstrapServer", "ConfluentSchemaRegistry", and "SelfHostedServer". - :vartype type: str or ~azure.mgmt.servicelinker.models.TargetServiceType - :ivar endpoint: The endpoint of service. - :vartype endpoint: str - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "endpoint": {"key": "endpoint", "type": "str"}, - } - - def __init__(self, *, endpoint: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword endpoint: The endpoint of service. - :paramtype endpoint: str - """ - super().__init__(**kwargs) - self.type: str = "ConfluentSchemaRegistry" - self.endpoint = endpoint - - -class LinkerProperties(_serialization.Model): - """The properties of the Linker. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar target_service: The target service properties. - :vartype target_service: ~azure.mgmt.servicelinker.models.TargetServiceBase - :ivar auth_info: The authentication type. - :vartype auth_info: ~azure.mgmt.servicelinker.models.AuthInfoBase - :ivar client_type: The application client type. Known values are: "none", "dotnet", "java", - "python", "go", "php", "ruby", "django", "nodejs", "springBoot", "kafka-springBoot", - "jms-springBoot", and "dapr". - :vartype client_type: str or ~azure.mgmt.servicelinker.models.ClientType - :ivar provisioning_state: The provisioning state. - :vartype provisioning_state: str - :ivar v_net_solution: The VNet solution. - :vartype v_net_solution: ~azure.mgmt.servicelinker.models.VNetSolution - :ivar secret_store: An option to store secret value in secure place. - :vartype secret_store: ~azure.mgmt.servicelinker.models.SecretStore - :ivar scope: connection scope in source service. - :vartype scope: str - :ivar public_network_solution: The network solution. - :vartype public_network_solution: ~azure.mgmt.servicelinker.models.PublicNetworkSolution - :ivar configuration_info: The connection information consumed by applications, including - secrets, connection strings. - :vartype configuration_info: ~azure.mgmt.servicelinker.models.ConfigurationInfo - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "target_service": {"key": "targetService", "type": "TargetServiceBase"}, - "auth_info": {"key": "authInfo", "type": "AuthInfoBase"}, - "client_type": {"key": "clientType", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "v_net_solution": {"key": "vNetSolution", "type": "VNetSolution"}, - "secret_store": {"key": "secretStore", "type": "SecretStore"}, - "scope": {"key": "scope", "type": "str"}, - "public_network_solution": {"key": "publicNetworkSolution", "type": "PublicNetworkSolution"}, - "configuration_info": {"key": "configurationInfo", "type": "ConfigurationInfo"}, - } - - def __init__( - self, - *, - target_service: Optional["_models.TargetServiceBase"] = None, - auth_info: Optional["_models.AuthInfoBase"] = None, - client_type: Optional[Union[str, "_models.ClientType"]] = None, - v_net_solution: Optional["_models.VNetSolution"] = None, - secret_store: Optional["_models.SecretStore"] = None, - scope: Optional[str] = None, - public_network_solution: Optional["_models.PublicNetworkSolution"] = None, - configuration_info: Optional["_models.ConfigurationInfo"] = None, - **kwargs: Any - ) -> None: - """ - :keyword target_service: The target service properties. - :paramtype target_service: ~azure.mgmt.servicelinker.models.TargetServiceBase - :keyword auth_info: The authentication type. - :paramtype auth_info: ~azure.mgmt.servicelinker.models.AuthInfoBase - :keyword client_type: The application client type. Known values are: "none", "dotnet", "java", - "python", "go", "php", "ruby", "django", "nodejs", "springBoot", "kafka-springBoot", - "jms-springBoot", and "dapr". - :paramtype client_type: str or ~azure.mgmt.servicelinker.models.ClientType - :keyword v_net_solution: The VNet solution. - :paramtype v_net_solution: ~azure.mgmt.servicelinker.models.VNetSolution - :keyword secret_store: An option to store secret value in secure place. - :paramtype secret_store: ~azure.mgmt.servicelinker.models.SecretStore - :keyword scope: connection scope in source service. - :paramtype scope: str - :keyword public_network_solution: The network solution. - :paramtype public_network_solution: ~azure.mgmt.servicelinker.models.PublicNetworkSolution - :keyword configuration_info: The connection information consumed by applications, including - secrets, connection strings. - :paramtype configuration_info: ~azure.mgmt.servicelinker.models.ConfigurationInfo - """ - super().__init__(**kwargs) - self.target_service = target_service - self.auth_info = auth_info - self.client_type = client_type - self.provisioning_state = None - self.v_net_solution = v_net_solution - self.secret_store = secret_store - self.scope = scope - self.public_network_solution = public_network_solution - self.configuration_info = configuration_info - - -class DryrunParameters(_serialization.Model): - """The parameters of the dryrun. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - CreateOrUpdateDryrunParameters - - All required parameters must be populated in order to send to Azure. - - :ivar action_name: The name of action for you dryrun job. Required. "createOrUpdate" - :vartype action_name: str or ~azure.mgmt.servicelinker.models.DryrunActionName - """ - - _validation = { - "action_name": {"required": True}, - } - - _attribute_map = { - "action_name": {"key": "actionName", "type": "str"}, - } - - _subtype_map = {"action_name": {"createOrUpdate": "CreateOrUpdateDryrunParameters"}} - def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.action_name: Optional[str] = None - - -class CreateOrUpdateDryrunParameters(DryrunParameters, LinkerProperties): - """The dryrun parameters for creation or update a linker. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar target_service: The target service properties. - :vartype target_service: ~azure.mgmt.servicelinker.models.TargetServiceBase - :ivar auth_info: The authentication type. - :vartype auth_info: ~azure.mgmt.servicelinker.models.AuthInfoBase - :ivar client_type: The application client type. Known values are: "none", "dotnet", "java", - "python", "go", "php", "ruby", "django", "nodejs", "springBoot", "kafka-springBoot", - "jms-springBoot", and "dapr". - :vartype client_type: str or ~azure.mgmt.servicelinker.models.ClientType - :ivar provisioning_state: The provisioning state. - :vartype provisioning_state: str - :ivar v_net_solution: The VNet solution. - :vartype v_net_solution: ~azure.mgmt.servicelinker.models.VNetSolution - :ivar secret_store: An option to store secret value in secure place. - :vartype secret_store: ~azure.mgmt.servicelinker.models.SecretStore - :ivar scope: connection scope in source service. - :vartype scope: str - :ivar public_network_solution: The network solution. - :vartype public_network_solution: ~azure.mgmt.servicelinker.models.PublicNetworkSolution - :ivar configuration_info: The connection information consumed by applications, including - secrets, connection strings. - :vartype configuration_info: ~azure.mgmt.servicelinker.models.ConfigurationInfo - :ivar action_name: The name of action for you dryrun job. Required. "createOrUpdate" - :vartype action_name: str or ~azure.mgmt.servicelinker.models.DryrunActionName - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "action_name": {"required": True}, - } - - _attribute_map = { - "target_service": {"key": "targetService", "type": "TargetServiceBase"}, - "auth_info": {"key": "authInfo", "type": "AuthInfoBase"}, - "client_type": {"key": "clientType", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "v_net_solution": {"key": "vNetSolution", "type": "VNetSolution"}, - "secret_store": {"key": "secretStore", "type": "SecretStore"}, - "scope": {"key": "scope", "type": "str"}, - "public_network_solution": {"key": "publicNetworkSolution", "type": "PublicNetworkSolution"}, - "configuration_info": {"key": "configurationInfo", "type": "ConfigurationInfo"}, - "action_name": {"key": "actionName", "type": "str"}, - } - - def __init__( - self, - *, - target_service: Optional["_models.TargetServiceBase"] = None, - auth_info: Optional["_models.AuthInfoBase"] = None, - client_type: Optional[Union[str, "_models.ClientType"]] = None, - v_net_solution: Optional["_models.VNetSolution"] = None, - secret_store: Optional["_models.SecretStore"] = None, - scope: Optional[str] = None, - public_network_solution: Optional["_models.PublicNetworkSolution"] = None, - configuration_info: Optional["_models.ConfigurationInfo"] = None, - **kwargs: Any - ) -> None: - """ - :keyword target_service: The target service properties. - :paramtype target_service: ~azure.mgmt.servicelinker.models.TargetServiceBase - :keyword auth_info: The authentication type. - :paramtype auth_info: ~azure.mgmt.servicelinker.models.AuthInfoBase - :keyword client_type: The application client type. Known values are: "none", "dotnet", "java", - "python", "go", "php", "ruby", "django", "nodejs", "springBoot", "kafka-springBoot", - "jms-springBoot", and "dapr". - :paramtype client_type: str or ~azure.mgmt.servicelinker.models.ClientType - :keyword v_net_solution: The VNet solution. - :paramtype v_net_solution: ~azure.mgmt.servicelinker.models.VNetSolution - :keyword secret_store: An option to store secret value in secure place. - :paramtype secret_store: ~azure.mgmt.servicelinker.models.SecretStore - :keyword scope: connection scope in source service. - :paramtype scope: str - :keyword public_network_solution: The network solution. - :paramtype public_network_solution: ~azure.mgmt.servicelinker.models.PublicNetworkSolution - :keyword configuration_info: The connection information consumed by applications, including - secrets, connection strings. - :paramtype configuration_info: ~azure.mgmt.servicelinker.models.ConfigurationInfo - """ - super().__init__( - target_service=target_service, - auth_info=auth_info, - client_type=client_type, - v_net_solution=v_net_solution, - secret_store=secret_store, - scope=scope, - public_network_solution=public_network_solution, - configuration_info=configuration_info, - **kwargs - ) - self.target_service = target_service - self.auth_info = auth_info - self.client_type = client_type - self.provisioning_state = None - self.v_net_solution = v_net_solution - self.secret_store = secret_store - self.scope = scope - self.public_network_solution = public_network_solution - self.configuration_info = configuration_info - self.action_name: str = "createOrUpdate" - - -class DaprConfigurationList(_serialization.Model): - """Dapr configuration list supported by Service Connector. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of dapr configurations. - :vartype value: list[~azure.mgmt.servicelinker.models.DaprConfigurationResource] - :ivar next_link: Link to next page of resources. - :vartype next_link: str - """ - - _validation = { - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[DaprConfigurationResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: Optional[List["_models.DaprConfigurationResource"]] = None, **kwargs: Any) -> None: - """ - :keyword value: The list of dapr configurations. - :paramtype value: list[~azure.mgmt.servicelinker.models.DaprConfigurationResource] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None - - -class DaprConfigurationResource(_serialization.Model): - """Represent one resource of the dapr configuration list. - - :ivar target_type: Supported target resource type, extract from resource id, uppercase. - :vartype target_type: str - :ivar auth_type: The authentication type. Known values are: "systemAssignedIdentity", - "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", - "accessKey", "userAccount", and "easyAuthMicrosoftEntraID". - :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType - :ivar dapr_properties: Indicates some additional properties for dapr client type. - :vartype dapr_properties: ~azure.mgmt.servicelinker.models.DaprProperties - """ - - _attribute_map = { - "target_type": {"key": "properties.targetType", "type": "str"}, - "auth_type": {"key": "properties.authType", "type": "str"}, - "dapr_properties": {"key": "properties.daprProperties", "type": "DaprProperties"}, - } - - def __init__( - self, - *, - target_type: Optional[str] = None, - auth_type: Optional[Union[str, "_models.AuthType"]] = None, - dapr_properties: Optional["_models.DaprProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword target_type: Supported target resource type, extract from resource id, uppercase. - :paramtype target_type: str - :keyword auth_type: The authentication type. Known values are: "systemAssignedIdentity", - "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", - "accessKey", "userAccount", and "easyAuthMicrosoftEntraID". - :paramtype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType - :keyword dapr_properties: Indicates some additional properties for dapr client type. - :paramtype dapr_properties: ~azure.mgmt.servicelinker.models.DaprProperties - """ - super().__init__(**kwargs) - self.target_type = target_type - self.auth_type = auth_type - self.dapr_properties = dapr_properties - - -class DaprMetadata(_serialization.Model): - """The dapr component metadata. - - :ivar name: Metadata property name. - :vartype name: str - :ivar value: Metadata property value. - :vartype value: str - :ivar secret_ref: The secret name where dapr could get value. - :vartype secret_ref: str - :ivar description: The description of the metadata, returned from configuration api. - :vartype description: str - :ivar required: The value indicating whether the metadata is required or not. Known values are: - "true" and "false". - :vartype required: str or ~azure.mgmt.servicelinker.models.DaprMetadataRequired - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "str"}, - "secret_ref": {"key": "secretRef", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "required": {"key": "required", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - value: Optional[str] = None, - secret_ref: Optional[str] = None, - description: Optional[str] = None, - required: Optional[Union[str, "_models.DaprMetadataRequired"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Metadata property name. - :paramtype name: str - :keyword value: Metadata property value. - :paramtype value: str - :keyword secret_ref: The secret name where dapr could get value. - :paramtype secret_ref: str - :keyword description: The description of the metadata, returned from configuration api. - :paramtype description: str - :keyword required: The value indicating whether the metadata is required or not. Known values - are: "true" and "false". - :paramtype required: str or ~azure.mgmt.servicelinker.models.DaprMetadataRequired - """ - super().__init__(**kwargs) - self.name = name - self.value = value - self.secret_ref = secret_ref - self.description = description - self.required = required - - -class DaprProperties(_serialization.Model): - """Indicates some additional properties for dapr client type. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar version: The dapr component version. - :vartype version: str - :ivar component_type: The dapr component type. - :vartype component_type: str - :ivar secret_store_component: The name of a secret store dapr to retrieve secret. - :vartype secret_store_component: str - :ivar metadata: Additional dapr metadata. - :vartype metadata: list[~azure.mgmt.servicelinker.models.DaprMetadata] - :ivar scopes: The dapr component scopes. - :vartype scopes: list[str] - :ivar runtime_version: The runtime version supported by the properties. - :vartype runtime_version: str - :ivar binding_component_direction: The direction supported by the dapr binding component. Known - values are: "input" and "output". - :vartype binding_component_direction: str or - ~azure.mgmt.servicelinker.models.DaprBindingComponentDirection - """ - - _validation = { - "runtime_version": {"readonly": True}, - "binding_component_direction": {"readonly": True}, - } - - _attribute_map = { - "version": {"key": "version", "type": "str"}, - "component_type": {"key": "componentType", "type": "str"}, - "secret_store_component": {"key": "secretStoreComponent", "type": "str"}, - "metadata": {"key": "metadata", "type": "[DaprMetadata]"}, - "scopes": {"key": "scopes", "type": "[str]"}, - "runtime_version": {"key": "runtimeVersion", "type": "str"}, - "binding_component_direction": {"key": "bindingComponentDirection", "type": "str"}, - } - - def __init__( - self, - *, - version: Optional[str] = None, - component_type: Optional[str] = None, - secret_store_component: Optional[str] = None, - metadata: Optional[List["_models.DaprMetadata"]] = None, - scopes: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword version: The dapr component version. - :paramtype version: str - :keyword component_type: The dapr component type. - :paramtype component_type: str - :keyword secret_store_component: The name of a secret store dapr to retrieve secret. - :paramtype secret_store_component: str - :keyword metadata: Additional dapr metadata. - :paramtype metadata: list[~azure.mgmt.servicelinker.models.DaprMetadata] - :keyword scopes: The dapr component scopes. - :paramtype scopes: list[str] - """ - super().__init__(**kwargs) - self.version = version - self.component_type = component_type - self.secret_store_component = secret_store_component - self.metadata = metadata - self.scopes = scopes - self.runtime_version = None - self.binding_component_direction = None - - -class DatabaseAadAuthInfo(_serialization.Model): - """The extra auth info required by Database AAD authentication. - - :ivar user_name: Username created in the database which is mapped to a user in AAD. - :vartype user_name: str - """ - - _attribute_map = { - "user_name": {"key": "userName", "type": "str"}, - } - - def __init__(self, *, user_name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword user_name: Username created in the database which is mapped to a user in AAD. - :paramtype user_name: str - """ - super().__init__(**kwargs) - self.user_name = user_name - - -class DryrunList(_serialization.Model): - """The list of dryrun. - - :ivar next_link: The link used to get the next page of dryrun list. - :vartype next_link: str - :ivar value: The list of dryrun. - :vartype value: list[~azure.mgmt.servicelinker.models.DryrunResource] - """ + self.auth_type: Optional[str] = None - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[DryrunResource]"}, - } - def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.DryrunResource"]] = None, **kwargs: Any - ) -> None: - """ - :keyword next_link: The link used to get the next page of dryrun list. - :paramtype next_link: str - :keyword value: The list of dryrun. - :paramtype value: list[~azure.mgmt.servicelinker.models.DryrunResource] - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value +class AzureResourcePropertiesBase(_serialization.Model): + """The azure resource properties. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureKeyVaultProperties -class DryrunOperationPreview(_serialization.Model): - """The preview of the operations for creation. + All required parameters must be populated in order to send to server. - :ivar name: The operation name. - :vartype name: str - :ivar operation_type: The operation type. Known values are: "configConnection", - "configNetwork", and "configAuth". - :vartype operation_type: str or ~azure.mgmt.servicelinker.models.DryrunPreviewOperationType - :ivar description: The description of the operation. - :vartype description: str - :ivar action: The action defined by RBAC, refer - https://docs.microsoft.com/azure/role-based-access-control/role-definitions#actions-format. - :vartype action: str - :ivar scope: The scope of the operation, refer - https://docs.microsoft.com/azure/role-based-access-control/scope-overview. - :vartype scope: str + :ivar type: The azure resource type. Required. "KeyVault" + :vartype type: str or ~azure.mgmt.servicelinker.models.AzureResourceType """ + _validation = { + "type": {"required": True}, + } + _attribute_map = { - "name": {"key": "name", "type": "str"}, - "operation_type": {"key": "operationType", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "action": {"key": "action", "type": "str"}, - "scope": {"key": "scope", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - *, - name: Optional[str] = None, - operation_type: Optional[Union[str, "_models.DryrunPreviewOperationType"]] = None, - description: Optional[str] = None, - action: Optional[str] = None, - scope: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The operation name. - :paramtype name: str - :keyword operation_type: The operation type. Known values are: "configConnection", - "configNetwork", and "configAuth". - :paramtype operation_type: str or ~azure.mgmt.servicelinker.models.DryrunPreviewOperationType - :keyword description: The description of the operation. - :paramtype description: str - :keyword action: The action defined by RBAC, refer - https://docs.microsoft.com/azure/role-based-access-control/role-definitions#actions-format. - :paramtype action: str - :keyword scope: The scope of the operation, refer - https://docs.microsoft.com/azure/role-based-access-control/scope-overview. - :paramtype scope: str - """ + _subtype_map = {"type": {"KeyVault": "AzureKeyVaultProperties"}} + + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.name = name - self.operation_type = operation_type - self.description = description - self.action = action - self.scope = scope + self.type: Optional[str] = None -class DryrunPatch(_serialization.Model): - """a dryrun job to be updated. +class AzureKeyVaultProperties(AzureResourcePropertiesBase): + """The resource properties when type is Azure Key Vault. - 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 parameters: The parameters of the dryrun. - :vartype parameters: ~azure.mgmt.servicelinker.models.DryrunParameters - :ivar prerequisite_results: the result of the dryrun. - :vartype prerequisite_results: list[~azure.mgmt.servicelinker.models.DryrunPrerequisiteResult] - :ivar operation_previews: the preview of the operations for creation. - :vartype operation_previews: list[~azure.mgmt.servicelinker.models.DryrunOperationPreview] - :ivar provisioning_state: The provisioning state. - :vartype provisioning_state: str + :ivar type: The azure resource type. Required. "KeyVault" + :vartype type: str or ~azure.mgmt.servicelinker.models.AzureResourceType + :ivar connect_as_kubernetes_csi_driver: True if connect via Kubernetes CSI Driver. + :vartype connect_as_kubernetes_csi_driver: bool """ _validation = { - "prerequisite_results": {"readonly": True}, - "operation_previews": {"readonly": True}, - "provisioning_state": {"readonly": True}, + "type": {"required": True}, } _attribute_map = { - "parameters": {"key": "properties.parameters", "type": "DryrunParameters"}, - "prerequisite_results": {"key": "properties.prerequisiteResults", "type": "[DryrunPrerequisiteResult]"}, - "operation_previews": {"key": "properties.operationPreviews", "type": "[DryrunOperationPreview]"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "connect_as_kubernetes_csi_driver": {"key": "connectAsKubernetesCsiDriver", "type": "bool"}, } - def __init__(self, *, parameters: Optional["_models.DryrunParameters"] = None, **kwargs: Any) -> None: + def __init__(self, *, connect_as_kubernetes_csi_driver: Optional[bool] = None, **kwargs: Any) -> None: """ - :keyword parameters: The parameters of the dryrun. - :paramtype parameters: ~azure.mgmt.servicelinker.models.DryrunParameters + :keyword connect_as_kubernetes_csi_driver: True if connect via Kubernetes CSI Driver. + :paramtype connect_as_kubernetes_csi_driver: bool """ super().__init__(**kwargs) - self.parameters = parameters - self.prerequisite_results = None - self.operation_previews = None - self.provisioning_state = None + self.type: str = "KeyVault" + self.connect_as_kubernetes_csi_driver = connect_as_kubernetes_csi_driver -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. +class TargetServiceBase(_serialization.Model): + """The target service properties. - Variables are only populated by the server, and will be ignored when sending a request. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureResource, ConfluentBootstrapServer, ConfluentSchemaRegistry - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.servicelinker.models.SystemData + All required parameters must be populated in order to send to server. + + :ivar type: The target service type. Required. Known values are: "AzureResource", + "ConfluentBootstrapServer", and "ConfluentSchemaRegistry". + :vartype type: str or ~azure.mgmt.servicelinker.models.TargetServiceType """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, + "type": {"required": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, + } + + _subtype_map = { + "type": { + "AzureResource": "AzureResource", + "ConfluentBootstrapServer": "ConfluentBootstrapServer", + "ConfluentSchemaRegistry": "ConfluentSchemaRegistry", + } } def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None + self.type: Optional[str] = None -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have - tags and a location. +class AzureResource(TargetServiceBase): + """The azure resource info when target service type is AzureResource. - 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 id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar type: The target service type. Required. Known values are: "AzureResource", + "ConfluentBootstrapServer", and "ConfluentSchemaRegistry". + :vartype type: str or ~azure.mgmt.servicelinker.models.TargetServiceType + :ivar id: The Id of azure resource. :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.servicelinker.models.SystemData + :ivar resource_properties: The azure resource connection related properties. + :vartype resource_properties: ~azure.mgmt.servicelinker.models.AzureResourcePropertiesBase """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, + "type": {"required": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, + "id": {"key": "id", "type": "str"}, + "resource_properties": {"key": "resourceProperties", "type": "AzureResourcePropertiesBase"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + resource_properties: Optional["_models.AzureResourcePropertiesBase"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: The Id of azure resource. + :paramtype id: str + :keyword resource_properties: The azure resource connection related properties. + :paramtype resource_properties: ~azure.mgmt.servicelinker.models.AzureResourcePropertiesBase + """ super().__init__(**kwargs) + self.type: str = "AzureResource" + self.id = id + self.resource_properties = resource_properties -class DryrunResource(ProxyResource): - """a dryrun job resource. +class ConfluentBootstrapServer(TargetServiceBase): + """The service properties when target service type is ConfluentBootstrapServer. - 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 id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.servicelinker.models.SystemData - :ivar parameters: The parameters of the dryrun. - :vartype parameters: ~azure.mgmt.servicelinker.models.DryrunParameters - :ivar prerequisite_results: the result of the dryrun. - :vartype prerequisite_results: list[~azure.mgmt.servicelinker.models.DryrunPrerequisiteResult] - :ivar operation_previews: the preview of the operations for creation. - :vartype operation_previews: list[~azure.mgmt.servicelinker.models.DryrunOperationPreview] - :ivar provisioning_state: The provisioning state. - :vartype provisioning_state: str + :ivar type: The target service type. Required. Known values are: "AzureResource", + "ConfluentBootstrapServer", and "ConfluentSchemaRegistry". + :vartype type: str or ~azure.mgmt.servicelinker.models.TargetServiceType + :ivar endpoint: The endpoint of service. + :vartype endpoint: str """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "prerequisite_results": {"readonly": True}, - "operation_previews": {"readonly": True}, - "provisioning_state": {"readonly": True}, + "type": {"required": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "parameters": {"key": "properties.parameters", "type": "DryrunParameters"}, - "prerequisite_results": {"key": "properties.prerequisiteResults", "type": "[DryrunPrerequisiteResult]"}, - "operation_previews": {"key": "properties.operationPreviews", "type": "[DryrunOperationPreview]"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "endpoint": {"key": "endpoint", "type": "str"}, } - def __init__(self, *, parameters: Optional["_models.DryrunParameters"] = None, **kwargs: Any) -> None: + def __init__(self, *, endpoint: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword parameters: The parameters of the dryrun. - :paramtype parameters: ~azure.mgmt.servicelinker.models.DryrunParameters + :keyword endpoint: The endpoint of service. + :paramtype endpoint: str """ super().__init__(**kwargs) - self.parameters = parameters - self.prerequisite_results = None - self.operation_previews = None - self.provisioning_state = None + self.type: str = "ConfluentBootstrapServer" + self.endpoint = endpoint -class EasyAuthMicrosoftEntraIDAuthInfo(AuthInfoBase): - """The authentication info when authType is EasyAuth Microsoft Entra ID. +class ConfluentSchemaRegistry(TargetServiceBase): + """The service properties when target service type is ConfluentSchemaRegistry. - 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 auth_type: The authentication type. Required. Known values are: "systemAssignedIdentity", - "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", - "accessKey", "userAccount", and "easyAuthMicrosoftEntraID". - :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType - :ivar auth_mode: Optional. Indicates how to configure authentication. If optInAllAuth, service - linker configures authentication such as enabling identity on source resource and granting RBAC - roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. Known values - are: "optInAllAuth" and "optOutAllAuth". - :vartype auth_mode: str or ~azure.mgmt.servicelinker.models.AuthMode - :ivar client_id: Application clientId for EasyAuth Microsoft Entra ID. - :vartype client_id: str - :ivar secret: Application Secret for EasyAuth Microsoft Entra ID. - :vartype secret: str - :ivar delete_or_update_behavior: Indicates whether to clean up previous operation when Linker - is updating or deleting. Known values are: "Default" and "ForcedCleanup". - :vartype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior + :ivar type: The target service type. Required. Known values are: "AzureResource", + "ConfluentBootstrapServer", and "ConfluentSchemaRegistry". + :vartype type: str or ~azure.mgmt.servicelinker.models.TargetServiceType + :ivar endpoint: The endpoint of service. + :vartype endpoint: str """ _validation = { - "auth_type": {"required": True}, + "type": {"required": True}, } _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - "auth_mode": {"key": "authMode", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - "secret": {"key": "secret", "type": "str"}, - "delete_or_update_behavior": {"key": "deleteOrUpdateBehavior", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "endpoint": {"key": "endpoint", "type": "str"}, } - def __init__( - self, - *, - auth_mode: Optional[Union[str, "_models.AuthMode"]] = None, - client_id: Optional[str] = None, - secret: Optional[str] = None, - delete_or_update_behavior: Optional[Union[str, "_models.DeleteOrUpdateBehavior"]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, endpoint: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword auth_mode: Optional. Indicates how to configure authentication. If optInAllAuth, - service linker configures authentication such as enabling identity on source resource and - granting RBAC roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. - Known values are: "optInAllAuth" and "optOutAllAuth". - :paramtype auth_mode: str or ~azure.mgmt.servicelinker.models.AuthMode - :keyword client_id: Application clientId for EasyAuth Microsoft Entra ID. - :paramtype client_id: str - :keyword secret: Application Secret for EasyAuth Microsoft Entra ID. - :paramtype secret: str - :keyword delete_or_update_behavior: Indicates whether to clean up previous operation when - Linker is updating or deleting. Known values are: "Default" and "ForcedCleanup". - :paramtype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior + :keyword endpoint: The endpoint of service. + :paramtype endpoint: str """ - super().__init__(auth_mode=auth_mode, **kwargs) - self.auth_type: str = "easyAuthMicrosoftEntraID" - self.client_id = client_id - self.secret = secret - self.delete_or_update_behavior = delete_or_update_behavior + super().__init__(**kwargs) + self.type: str = "ConfluentSchemaRegistry" + self.endpoint = endpoint class ErrorAdditionalInfo(_serialization.Model): @@ -1529,60 +345,13 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: A self.error = error -class FirewallRules(_serialization.Model): - """Target service's firewall rules. to allow connections from source service. - - :ivar ip_ranges: This value specifies the set of IP addresses or IP address ranges in CIDR form - to be included as the allowed list of client IPs for a given database account. - :vartype ip_ranges: list[str] - :ivar azure_services: Allow Azure services to access the target service if true. Known values - are: "true" and "false". - :vartype azure_services: str or ~azure.mgmt.servicelinker.models.AllowType - :ivar caller_client_ip: Allow caller client IP to access the target service if true. the - property is used when connecting local application to target service. Known values are: "true" - and "false". - :vartype caller_client_ip: str or ~azure.mgmt.servicelinker.models.AllowType - """ - - _attribute_map = { - "ip_ranges": {"key": "ipRanges", "type": "[str]"}, - "azure_services": {"key": "azureServices", "type": "str"}, - "caller_client_ip": {"key": "callerClientIP", "type": "str"}, - } - - def __init__( - self, - *, - ip_ranges: Optional[List[str]] = None, - azure_services: Optional[Union[str, "_models.AllowType"]] = None, - caller_client_ip: Optional[Union[str, "_models.AllowType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword ip_ranges: This value specifies the set of IP addresses or IP address ranges in CIDR - form to be included as the allowed list of client IPs for a given database account. - :paramtype ip_ranges: list[str] - :keyword azure_services: Allow Azure services to access the target service if true. Known - values are: "true" and "false". - :paramtype azure_services: str or ~azure.mgmt.servicelinker.models.AllowType - :keyword caller_client_ip: Allow caller client IP to access the target service if true. the - property is used when connecting local application to target service. Known values are: "true" - and "false". - :paramtype caller_client_ip: str or ~azure.mgmt.servicelinker.models.AllowType - """ - super().__init__(**kwargs) - self.ip_ranges = ip_ranges - self.azure_services = azure_services - self.caller_client_ip = caller_client_ip - - class SecretInfoBase(_serialization.Model): """The secret info. You probably want to use the sub-classes and not this class directly. Known sub-classes are: KeyVaultSecretReferenceSecretInfo, KeyVaultSecretUriSecretInfo, ValueSecretInfo - 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 secret_type: The secret type. Required. Known values are: "rawValue", "keyVaultSecretUri", and "keyVaultSecretReference". @@ -1616,7 +385,7 @@ class KeyVaultSecretReferenceSecretInfo(SecretInfoBase): secret stored in user's keyvault and source is Azure Kubernetes. The key Vault's resource id is linked to secretStore.keyVaultId. - 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 secret_type: The secret type. Required. Known values are: "rawValue", "keyVaultSecretUri", and "keyVaultSecretReference". @@ -1654,7 +423,7 @@ class KeyVaultSecretUriSecretInfo(SecretInfoBase): """The secret info when type is keyVaultSecretUri. It's for scenario that user provides a secret stored in user's keyvault and source is Web App, Spring Cloud or Container App. - 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 secret_type: The secret type. Required. Known values are: "rawValue", "keyVaultSecretUri", and "keyVaultSecretReference". @@ -1668,22 +437,50 @@ class KeyVaultSecretUriSecretInfo(SecretInfoBase): } _attribute_map = { - "secret_type": {"key": "secretType", "type": "str"}, - "value": {"key": "value", "type": "str"}, + "secret_type": {"key": "secretType", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, *, value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: URI to the keyvault secret. + :paramtype value: str + """ + super().__init__(**kwargs) + self.secret_type: str = "keyVaultSecretUri" + self.value = value + + +class LinkerList(_serialization.Model): + """The list of Linker. + + :ivar next_link: The link used to get the next page of Linker list. + :vartype next_link: str + :ivar value: The list of Linkers. + :vartype value: list[~azure.mgmt.servicelinker.models.LinkerResource] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[LinkerResource]"}, } - def __init__(self, *, value: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, *, next_link: Optional[str] = None, value: Optional[List["_models.LinkerResource"]] = None, **kwargs: Any + ) -> None: """ - :keyword value: URI to the keyvault secret. - :paramtype value: str + :keyword next_link: The link used to get the next page of Linker list. + :paramtype next_link: str + :keyword value: The list of Linkers. + :paramtype value: list[~azure.mgmt.servicelinker.models.LinkerResource] """ super().__init__(**kwargs) - self.secret_type: str = "keyVaultSecretUri" + self.next_link = next_link self.value = value class LinkerPatch(_serialization.Model): - """A Linker to be updated. + """A linker to be updated. Variables are only populated by the server, and will be ignored when sending a request. @@ -1692,8 +489,7 @@ class LinkerPatch(_serialization.Model): :ivar auth_info: The authentication type. :vartype auth_info: ~azure.mgmt.servicelinker.models.AuthInfoBase :ivar client_type: The application client type. Known values are: "none", "dotnet", "java", - "python", "go", "php", "ruby", "django", "nodejs", "springBoot", "kafka-springBoot", - "jms-springBoot", and "dapr". + "python", "go", "php", "ruby", "django", "nodejs", "springBoot", and "kafka-springBoot". :vartype client_type: str or ~azure.mgmt.servicelinker.models.ClientType :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str @@ -1703,11 +499,6 @@ class LinkerPatch(_serialization.Model): :vartype secret_store: ~azure.mgmt.servicelinker.models.SecretStore :ivar scope: connection scope in source service. :vartype scope: str - :ivar public_network_solution: The network solution. - :vartype public_network_solution: ~azure.mgmt.servicelinker.models.PublicNetworkSolution - :ivar configuration_info: The connection information consumed by applications, including - secrets, connection strings. - :vartype configuration_info: ~azure.mgmt.servicelinker.models.ConfigurationInfo """ _validation = { @@ -1722,8 +513,6 @@ class LinkerPatch(_serialization.Model): "v_net_solution": {"key": "properties.vNetSolution", "type": "VNetSolution"}, "secret_store": {"key": "properties.secretStore", "type": "SecretStore"}, "scope": {"key": "properties.scope", "type": "str"}, - "public_network_solution": {"key": "properties.publicNetworkSolution", "type": "PublicNetworkSolution"}, - "configuration_info": {"key": "properties.configurationInfo", "type": "ConfigurationInfo"}, } def __init__( @@ -1735,8 +524,6 @@ def __init__( v_net_solution: Optional["_models.VNetSolution"] = None, secret_store: Optional["_models.SecretStore"] = None, scope: Optional[str] = None, - public_network_solution: Optional["_models.PublicNetworkSolution"] = None, - configuration_info: Optional["_models.ConfigurationInfo"] = None, **kwargs: Any ) -> None: """ @@ -1745,8 +532,7 @@ def __init__( :keyword auth_info: The authentication type. :paramtype auth_info: ~azure.mgmt.servicelinker.models.AuthInfoBase :keyword client_type: The application client type. Known values are: "none", "dotnet", "java", - "python", "go", "php", "ruby", "django", "nodejs", "springBoot", "kafka-springBoot", - "jms-springBoot", and "dapr". + "python", "go", "php", "ruby", "django", "nodejs", "springBoot", and "kafka-springBoot". :paramtype client_type: str or ~azure.mgmt.servicelinker.models.ClientType :keyword v_net_solution: The VNet solution. :paramtype v_net_solution: ~azure.mgmt.servicelinker.models.VNetSolution @@ -1754,11 +540,6 @@ def __init__( :paramtype secret_store: ~azure.mgmt.servicelinker.models.SecretStore :keyword scope: connection scope in source service. :paramtype scope: str - :keyword public_network_solution: The network solution. - :paramtype public_network_solution: ~azure.mgmt.servicelinker.models.PublicNetworkSolution - :keyword configuration_info: The connection information consumed by applications, including - secrets, connection strings. - :paramtype configuration_info: ~azure.mgmt.servicelinker.models.ConfigurationInfo """ super().__init__(**kwargs) self.target_service = target_service @@ -1768,8 +549,58 @@ def __init__( self.v_net_solution = v_net_solution self.secret_store = secret_store self.scope = scope - self.public_network_solution = public_network_solution - self.configuration_info = configuration_info + + +class Resource(_serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ class LinkerResource(ProxyResource): # pylint: disable=too-many-instance-attributes @@ -1778,23 +609,21 @@ class LinkerResource(ProxyResource): # pylint: disable=too-many-instance-attrib 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 :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. + :ivar system_data: The system data. :vartype system_data: ~azure.mgmt.servicelinker.models.SystemData :ivar target_service: The target service properties. :vartype target_service: ~azure.mgmt.servicelinker.models.TargetServiceBase :ivar auth_info: The authentication type. :vartype auth_info: ~azure.mgmt.servicelinker.models.AuthInfoBase :ivar client_type: The application client type. Known values are: "none", "dotnet", "java", - "python", "go", "php", "ruby", "django", "nodejs", "springBoot", "kafka-springBoot", - "jms-springBoot", and "dapr". + "python", "go", "php", "ruby", "django", "nodejs", "springBoot", and "kafka-springBoot". :vartype client_type: str or ~azure.mgmt.servicelinker.models.ClientType :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str @@ -1804,11 +633,6 @@ class LinkerResource(ProxyResource): # pylint: disable=too-many-instance-attrib :vartype secret_store: ~azure.mgmt.servicelinker.models.SecretStore :ivar scope: connection scope in source service. :vartype scope: str - :ivar public_network_solution: The network solution. - :vartype public_network_solution: ~azure.mgmt.servicelinker.models.PublicNetworkSolution - :ivar configuration_info: The connection information consumed by applications, including - secrets, connection strings. - :vartype configuration_info: ~azure.mgmt.servicelinker.models.ConfigurationInfo """ _validation = { @@ -1831,8 +655,6 @@ class LinkerResource(ProxyResource): # pylint: disable=too-many-instance-attrib "v_net_solution": {"key": "properties.vNetSolution", "type": "VNetSolution"}, "secret_store": {"key": "properties.secretStore", "type": "SecretStore"}, "scope": {"key": "properties.scope", "type": "str"}, - "public_network_solution": {"key": "properties.publicNetworkSolution", "type": "PublicNetworkSolution"}, - "configuration_info": {"key": "properties.configurationInfo", "type": "ConfigurationInfo"}, } def __init__( @@ -1844,8 +666,6 @@ def __init__( v_net_solution: Optional["_models.VNetSolution"] = None, secret_store: Optional["_models.SecretStore"] = None, scope: Optional[str] = None, - public_network_solution: Optional["_models.PublicNetworkSolution"] = None, - configuration_info: Optional["_models.ConfigurationInfo"] = None, **kwargs: Any ) -> None: """ @@ -1854,8 +674,7 @@ def __init__( :keyword auth_info: The authentication type. :paramtype auth_info: ~azure.mgmt.servicelinker.models.AuthInfoBase :keyword client_type: The application client type. Known values are: "none", "dotnet", "java", - "python", "go", "php", "ruby", "django", "nodejs", "springBoot", "kafka-springBoot", - "jms-springBoot", and "dapr". + "python", "go", "php", "ruby", "django", "nodejs", "springBoot", and "kafka-springBoot". :paramtype client_type: str or ~azure.mgmt.servicelinker.models.ClientType :keyword v_net_solution: The VNet solution. :paramtype v_net_solution: ~azure.mgmt.servicelinker.models.VNetSolution @@ -1863,13 +682,9 @@ def __init__( :paramtype secret_store: ~azure.mgmt.servicelinker.models.SecretStore :keyword scope: connection scope in source service. :paramtype scope: str - :keyword public_network_solution: The network solution. - :paramtype public_network_solution: ~azure.mgmt.servicelinker.models.PublicNetworkSolution - :keyword configuration_info: The connection information consumed by applications, including - secrets, connection strings. - :paramtype configuration_info: ~azure.mgmt.servicelinker.models.ConfigurationInfo """ super().__init__(**kwargs) + self.system_data = None self.target_service = target_service self.auth_info = auth_info self.client_type = client_type @@ -1877,8 +692,6 @@ def __init__( self.v_net_solution = v_net_solution self.secret_store = secret_store self.scope = scope - self.public_network_solution = public_network_solution - self.configuration_info = configuration_info class Operation(_serialization.Model): @@ -1899,7 +712,7 @@ class Operation(_serialization.Model): and "user,system". :vartype origin: str or ~azure.mgmt.servicelinker.models.Origin :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. Known values are: "Internal", "enable", and "optOut". + internal only APIs. "Internal" :vartype action_type: str or ~azure.mgmt.servicelinker.models.ActionType """ @@ -2002,149 +815,14 @@ def __init__(self, **kwargs: Any) -> None: self.next_link = None -class PermissionsMissingDryrunPrerequisiteResult(DryrunPrerequisiteResult): - """The represent of missing permissions. - - All required parameters must be populated in order to send to Azure. - - :ivar type: The type of dryrun result. Required. Known values are: "basicError" and - "permissionsMissing". - :vartype type: str or ~azure.mgmt.servicelinker.models.DryrunPrerequisiteResultType - :ivar scope: The permission scope. - :vartype scope: str - :ivar permissions: The permission list. - :vartype permissions: list[str] - :ivar recommended_role: The recommended role to resolve permissions missing. - :vartype recommended_role: str - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "scope": {"key": "scope", "type": "str"}, - "permissions": {"key": "permissions", "type": "[str]"}, - "recommended_role": {"key": "recommendedRole", "type": "str"}, - } - - def __init__( - self, - *, - scope: Optional[str] = None, - permissions: Optional[List[str]] = None, - recommended_role: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword scope: The permission scope. - :paramtype scope: str - :keyword permissions: The permission list. - :paramtype permissions: list[str] - :keyword recommended_role: The recommended role to resolve permissions missing. - :paramtype recommended_role: str - """ - super().__init__(**kwargs) - self.type: str = "permissionsMissing" - self.scope = scope - self.permissions = permissions - self.recommended_role = recommended_role - - -class PublicNetworkSolution(_serialization.Model): - """Indicates public network solution, include firewall rules. - - :ivar delete_or_update_behavior: Indicates whether to clean up previous operation(such as - firewall rules) when Linker is updating or deleting. Known values are: "Default" and - "ForcedCleanup". - :vartype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior - :ivar action: Optional. Indicates public network solution. If enable, enable public network - access of target service with best try. Default is enable. If optOut, opt out public network - access configuration. Known values are: "Internal", "enable", and "optOut". - :vartype action: str or ~azure.mgmt.servicelinker.models.ActionType - :ivar firewall_rules: Describe firewall rules of target service to make sure source application - could connect to the target. - :vartype firewall_rules: ~azure.mgmt.servicelinker.models.FirewallRules - """ - - _attribute_map = { - "delete_or_update_behavior": {"key": "deleteOrUpdateBehavior", "type": "str"}, - "action": {"key": "action", "type": "str"}, - "firewall_rules": {"key": "firewallRules", "type": "FirewallRules"}, - } - - def __init__( - self, - *, - delete_or_update_behavior: Optional[Union[str, "_models.DeleteOrUpdateBehavior"]] = None, - action: Optional[Union[str, "_models.ActionType"]] = None, - firewall_rules: Optional["_models.FirewallRules"] = None, - **kwargs: Any - ) -> None: - """ - :keyword delete_or_update_behavior: Indicates whether to clean up previous operation(such as - firewall rules) when Linker is updating or deleting. Known values are: "Default" and - "ForcedCleanup". - :paramtype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior - :keyword action: Optional. Indicates public network solution. If enable, enable public network - access of target service with best try. Default is enable. If optOut, opt out public network - access configuration. Known values are: "Internal", "enable", and "optOut". - :paramtype action: str or ~azure.mgmt.servicelinker.models.ActionType - :keyword firewall_rules: Describe firewall rules of target service to make sure source - application could connect to the target. - :paramtype firewall_rules: ~azure.mgmt.servicelinker.models.FirewallRules - """ - super().__init__(**kwargs) - self.delete_or_update_behavior = delete_or_update_behavior - self.action = action - self.firewall_rules = firewall_rules - - -class ResourceList(_serialization.Model): - """The list of Linker. - - :ivar next_link: The Linker used to get the next page of Linker list. - :vartype next_link: str - :ivar value: The list of Linkers. - :vartype value: list[~azure.mgmt.servicelinker.models.LinkerResource] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[LinkerResource]"}, - } - - def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.LinkerResource"]] = None, **kwargs: Any - ) -> None: - """ - :keyword next_link: The Linker used to get the next page of Linker list. - :paramtype next_link: str - :keyword value: The list of Linkers. - :paramtype value: list[~azure.mgmt.servicelinker.models.LinkerResource] - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value - - class SecretAuthInfo(AuthInfoBase): """The authentication info when authType is secret. - 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 auth_type: The authentication type. Required. Known values are: "systemAssignedIdentity", - "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", - "accessKey", "userAccount", and "easyAuthMicrosoftEntraID". + "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", and "secret". :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType - :ivar auth_mode: Optional. Indicates how to configure authentication. If optInAllAuth, service - linker configures authentication such as enabling identity on source resource and granting RBAC - roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. Known values - are: "optInAllAuth" and "optOutAllAuth". - :vartype auth_mode: str or ~azure.mgmt.servicelinker.models.AuthMode :ivar name: Username or account name for secret auth. :vartype name: str :ivar secret_info: Password or key vault secret for secret auth. @@ -2157,31 +835,20 @@ class SecretAuthInfo(AuthInfoBase): _attribute_map = { "auth_type": {"key": "authType", "type": "str"}, - "auth_mode": {"key": "authMode", "type": "str"}, "name": {"key": "name", "type": "str"}, "secret_info": {"key": "secretInfo", "type": "SecretInfoBase"}, } def __init__( - self, - *, - auth_mode: Optional[Union[str, "_models.AuthMode"]] = None, - name: Optional[str] = None, - secret_info: Optional["_models.SecretInfoBase"] = None, - **kwargs: Any + self, *, name: Optional[str] = None, secret_info: Optional["_models.SecretInfoBase"] = None, **kwargs: Any ) -> None: """ - :keyword auth_mode: Optional. Indicates how to configure authentication. If optInAllAuth, - service linker configures authentication such as enabling identity on source resource and - granting RBAC roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. - Known values are: "optInAllAuth" and "optOutAllAuth". - :paramtype auth_mode: str or ~azure.mgmt.servicelinker.models.AuthMode :keyword name: Username or account name for secret auth. :paramtype name: str :keyword secret_info: Password or key vault secret for secret auth. :paramtype secret_info: ~azure.mgmt.servicelinker.models.SecretInfoBase """ - super().__init__(auth_mode=auth_mode, **kwargs) + super().__init__(**kwargs) self.auth_type: str = "secret" self.name = name self.secret_info = secret_info @@ -2192,88 +859,35 @@ class SecretStore(_serialization.Model): :ivar key_vault_id: The key vault id to store secret. :vartype key_vault_id: str - :ivar key_vault_secret_name: The key vault secret name to store secret, only valid when storing - one secret. - :vartype key_vault_secret_name: str """ _attribute_map = { "key_vault_id": {"key": "keyVaultId", "type": "str"}, - "key_vault_secret_name": {"key": "keyVaultSecretName", "type": "str"}, } - def __init__( - self, *, key_vault_id: Optional[str] = None, key_vault_secret_name: Optional[str] = None, **kwargs: Any - ) -> None: + def __init__(self, *, key_vault_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword key_vault_id: The key vault id to store secret. :paramtype key_vault_id: str - :keyword key_vault_secret_name: The key vault secret name to store secret, only valid when - storing one secret. - :paramtype key_vault_secret_name: str """ super().__init__(**kwargs) self.key_vault_id = key_vault_id - self.key_vault_secret_name = key_vault_secret_name - - -class SelfHostedServer(TargetServiceBase): - """The service properties when target service type is SelfHostedServer. - - All required parameters must be populated in order to send to Azure. - - :ivar type: The target service type. Required. Known values are: "AzureResource", - "ConfluentBootstrapServer", "ConfluentSchemaRegistry", and "SelfHostedServer". - :vartype type: str or ~azure.mgmt.servicelinker.models.TargetServiceType - :ivar endpoint: The endpoint of service. - :vartype endpoint: str - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "endpoint": {"key": "endpoint", "type": "str"}, - } - - def __init__(self, *, endpoint: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword endpoint: The endpoint of service. - :paramtype endpoint: str - """ - super().__init__(**kwargs) - self.type: str = "SelfHostedServer" - self.endpoint = endpoint class ServicePrincipalCertificateAuthInfo(AuthInfoBase): """The authentication info when authType is servicePrincipal certificate. - 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 auth_type: The authentication type. Required. Known values are: "systemAssignedIdentity", - "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", - "accessKey", "userAccount", and "easyAuthMicrosoftEntraID". + "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", and "secret". :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType - :ivar auth_mode: Optional. Indicates how to configure authentication. If optInAllAuth, service - linker configures authentication such as enabling identity on source resource and granting RBAC - roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. Known values - are: "optInAllAuth" and "optOutAllAuth". - :vartype auth_mode: str or ~azure.mgmt.servicelinker.models.AuthMode :ivar client_id: Application clientId for servicePrincipal auth. Required. :vartype client_id: str :ivar principal_id: Principal Id for servicePrincipal auth. Required. :vartype principal_id: str :ivar certificate: ServicePrincipal certificate for servicePrincipal auth. Required. :vartype certificate: str - :ivar delete_or_update_behavior: Indicates whether to clean up previous operation when Linker - is updating or deleting. Known values are: "Default" and "ForcedCleanup". - :vartype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior - :ivar roles: Optional, this value specifies the Azure roles to be assigned. Automatically. - :vartype roles: list[str] """ _validation = { @@ -2285,81 +899,41 @@ class ServicePrincipalCertificateAuthInfo(AuthInfoBase): _attribute_map = { "auth_type": {"key": "authType", "type": "str"}, - "auth_mode": {"key": "authMode", "type": "str"}, "client_id": {"key": "clientId", "type": "str"}, "principal_id": {"key": "principalId", "type": "str"}, "certificate": {"key": "certificate", "type": "str"}, - "delete_or_update_behavior": {"key": "deleteOrUpdateBehavior", "type": "str"}, - "roles": {"key": "roles", "type": "[str]"}, } - def __init__( - self, - *, - client_id: str, - principal_id: str, - certificate: str, - auth_mode: Optional[Union[str, "_models.AuthMode"]] = None, - delete_or_update_behavior: Optional[Union[str, "_models.DeleteOrUpdateBehavior"]] = None, - roles: Optional[List[str]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, client_id: str, principal_id: str, certificate: str, **kwargs: Any) -> None: """ - :keyword auth_mode: Optional. Indicates how to configure authentication. If optInAllAuth, - service linker configures authentication such as enabling identity on source resource and - granting RBAC roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. - Known values are: "optInAllAuth" and "optOutAllAuth". - :paramtype auth_mode: str or ~azure.mgmt.servicelinker.models.AuthMode :keyword client_id: Application clientId for servicePrincipal auth. Required. :paramtype client_id: str :keyword principal_id: Principal Id for servicePrincipal auth. Required. :paramtype principal_id: str :keyword certificate: ServicePrincipal certificate for servicePrincipal auth. Required. :paramtype certificate: str - :keyword delete_or_update_behavior: Indicates whether to clean up previous operation when - Linker is updating or deleting. Known values are: "Default" and "ForcedCleanup". - :paramtype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior - :keyword roles: Optional, this value specifies the Azure roles to be assigned. Automatically. - :paramtype roles: list[str] """ - super().__init__(auth_mode=auth_mode, **kwargs) + super().__init__(**kwargs) self.auth_type: str = "servicePrincipalCertificate" self.client_id = client_id self.principal_id = principal_id self.certificate = certificate - self.delete_or_update_behavior = delete_or_update_behavior - self.roles = roles -class ServicePrincipalSecretAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): +class ServicePrincipalSecretAuthInfo(AuthInfoBase): """The authentication info when authType is servicePrincipal secret. - 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 user_name: Username created in the database which is mapped to a user in AAD. - :vartype user_name: str :ivar auth_type: The authentication type. Required. Known values are: "systemAssignedIdentity", - "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", - "accessKey", "userAccount", and "easyAuthMicrosoftEntraID". + "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", and "secret". :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType - :ivar auth_mode: Optional. Indicates how to configure authentication. If optInAllAuth, service - linker configures authentication such as enabling identity on source resource and granting RBAC - roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. Known values - are: "optInAllAuth" and "optOutAllAuth". - :vartype auth_mode: str or ~azure.mgmt.servicelinker.models.AuthMode :ivar client_id: ServicePrincipal application clientId for servicePrincipal auth. Required. :vartype client_id: str :ivar principal_id: Principal Id for servicePrincipal auth. Required. :vartype principal_id: str :ivar secret: Secret for servicePrincipal auth. Required. :vartype secret: str - :ivar delete_or_update_behavior: Indicates whether to clean up previous operation when Linker - is updating or deleting. Known values are: "Default" and "ForcedCleanup". - :vartype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior - :ivar roles: Optional, this value specifies the Azure roles to be assigned. Automatically. - :vartype roles: list[str] """ _validation = { @@ -2370,140 +944,82 @@ class ServicePrincipalSecretAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): } _attribute_map = { - "user_name": {"key": "userName", "type": "str"}, "auth_type": {"key": "authType", "type": "str"}, - "auth_mode": {"key": "authMode", "type": "str"}, "client_id": {"key": "clientId", "type": "str"}, "principal_id": {"key": "principalId", "type": "str"}, "secret": {"key": "secret", "type": "str"}, - "delete_or_update_behavior": {"key": "deleteOrUpdateBehavior", "type": "str"}, - "roles": {"key": "roles", "type": "[str]"}, } - def __init__( - self, - *, - client_id: str, - principal_id: str, - secret: str, - user_name: Optional[str] = None, - auth_mode: Optional[Union[str, "_models.AuthMode"]] = None, - delete_or_update_behavior: Optional[Union[str, "_models.DeleteOrUpdateBehavior"]] = None, - roles: Optional[List[str]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, client_id: str, principal_id: str, secret: str, **kwargs: Any) -> None: """ - :keyword user_name: Username created in the database which is mapped to a user in AAD. - :paramtype user_name: str - :keyword auth_mode: Optional. Indicates how to configure authentication. If optInAllAuth, - service linker configures authentication such as enabling identity on source resource and - granting RBAC roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. - Known values are: "optInAllAuth" and "optOutAllAuth". - :paramtype auth_mode: str or ~azure.mgmt.servicelinker.models.AuthMode :keyword client_id: ServicePrincipal application clientId for servicePrincipal auth. Required. :paramtype client_id: str :keyword principal_id: Principal Id for servicePrincipal auth. Required. :paramtype principal_id: str :keyword secret: Secret for servicePrincipal auth. Required. :paramtype secret: str - :keyword delete_or_update_behavior: Indicates whether to clean up previous operation when - Linker is updating or deleting. Known values are: "Default" and "ForcedCleanup". - :paramtype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior - :keyword roles: Optional, this value specifies the Azure roles to be assigned. Automatically. - :paramtype roles: list[str] """ - super().__init__(auth_mode=auth_mode, user_name=user_name, **kwargs) - self.user_name = user_name + super().__init__(**kwargs) self.auth_type: str = "servicePrincipalSecret" self.client_id = client_id self.principal_id = principal_id self.secret = secret - self.delete_or_update_behavior = delete_or_update_behavior - self.roles = roles - self.auth_mode = auth_mode class SourceConfiguration(_serialization.Model): """A configuration item for source resource. - Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: The name of setting. :vartype name: str :ivar value: The value of setting. :vartype value: str - :ivar config_type: The type of setting. Known values are: "Default" and "KeyVaultSecret". - :vartype config_type: str or ~azure.mgmt.servicelinker.models.LinkerConfigurationType - :ivar key_vault_reference_identity: The identity for key vault reference, system or - user-assigned managed identity ID. - :vartype key_vault_reference_identity: str - :ivar description: Descriptive information for the configuration. - :vartype description: str """ - _validation = { - "config_type": {"readonly": True}, - } - _attribute_map = { "name": {"key": "name", "type": "str"}, "value": {"key": "value", "type": "str"}, - "config_type": {"key": "configType", "type": "str"}, - "key_vault_reference_identity": {"key": "keyVaultReferenceIdentity", "type": "str"}, - "description": {"key": "description", "type": "str"}, } - def __init__( - self, - *, - name: Optional[str] = None, - value: Optional[str] = None, - key_vault_reference_identity: Optional[str] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: The name of setting. :paramtype name: str :keyword value: The value of setting. :paramtype value: str - :keyword key_vault_reference_identity: The identity for key vault reference, system or - user-assigned managed identity ID. - :paramtype key_vault_reference_identity: str - :keyword description: Descriptive information for the configuration. - :paramtype description: str """ super().__init__(**kwargs) self.name = name self.value = value - self.config_type = None - self.key_vault_reference_identity = key_vault_reference_identity - self.description = description -class SystemAssignedIdentityAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): +class SourceConfigurationResult(_serialization.Model): + """Configurations for source resource, include appSettings, connectionString and serviceBindings. + + :ivar configurations: The configuration properties for source resource. + :vartype configurations: list[~azure.mgmt.servicelinker.models.SourceConfiguration] + """ + + _attribute_map = { + "configurations": {"key": "configurations", "type": "[SourceConfiguration]"}, + } + + def __init__(self, *, configurations: Optional[List["_models.SourceConfiguration"]] = None, **kwargs: Any) -> None: + """ + :keyword configurations: The configuration properties for source resource. + :paramtype configurations: list[~azure.mgmt.servicelinker.models.SourceConfiguration] + """ + super().__init__(**kwargs) + self.configurations = configurations + + +class SystemAssignedIdentityAuthInfo(AuthInfoBase): """The authentication info when authType is systemAssignedIdentity. - 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 user_name: Username created in the database which is mapped to a user in AAD. - :vartype user_name: str :ivar auth_type: The authentication type. Required. Known values are: "systemAssignedIdentity", - "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", - "accessKey", "userAccount", and "easyAuthMicrosoftEntraID". + "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", and "secret". :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType - :ivar auth_mode: Optional. Indicates how to configure authentication. If optInAllAuth, service - linker configures authentication such as enabling identity on source resource and granting RBAC - roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. Known values - are: "optInAllAuth" and "optOutAllAuth". - :vartype auth_mode: str or ~azure.mgmt.servicelinker.models.AuthMode - :ivar delete_or_update_behavior: Indicates whether to clean up previous operation when Linker - is updating or deleting. Known values are: "Default" and "ForcedCleanup". - :vartype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior - :ivar roles: Optional, this value specifies the Azure role to be assigned. - :vartype roles: list[str] """ _validation = { @@ -2511,43 +1027,13 @@ class SystemAssignedIdentityAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): } _attribute_map = { - "user_name": {"key": "userName", "type": "str"}, "auth_type": {"key": "authType", "type": "str"}, - "auth_mode": {"key": "authMode", "type": "str"}, - "delete_or_update_behavior": {"key": "deleteOrUpdateBehavior", "type": "str"}, - "roles": {"key": "roles", "type": "[str]"}, } - def __init__( - self, - *, - user_name: Optional[str] = None, - auth_mode: Optional[Union[str, "_models.AuthMode"]] = None, - delete_or_update_behavior: Optional[Union[str, "_models.DeleteOrUpdateBehavior"]] = None, - roles: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword user_name: Username created in the database which is mapped to a user in AAD. - :paramtype user_name: str - :keyword auth_mode: Optional. Indicates how to configure authentication. If optInAllAuth, - service linker configures authentication such as enabling identity on source resource and - granting RBAC roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. - Known values are: "optInAllAuth" and "optOutAllAuth". - :paramtype auth_mode: str or ~azure.mgmt.servicelinker.models.AuthMode - :keyword delete_or_update_behavior: Indicates whether to clean up previous operation when - Linker is updating or deleting. Known values are: "Default" and "ForcedCleanup". - :paramtype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior - :keyword roles: Optional, this value specifies the Azure role to be assigned. - :paramtype roles: list[str] - """ - super().__init__(auth_mode=auth_mode, user_name=user_name, **kwargs) - self.user_name = user_name + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) self.auth_type: str = "systemAssignedIdentity" - self.delete_or_update_behavior = delete_or_update_behavior - self.roles = roles - self.auth_mode = auth_mode class SystemData(_serialization.Model): @@ -2614,107 +1100,18 @@ def __init__( self.last_modified_at = last_modified_at -class UserAccountAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): - """The authentication info when authType is user account. - - All required parameters must be populated in order to send to Azure. - - :ivar user_name: Username created in the database which is mapped to a user in AAD. - :vartype user_name: str - :ivar auth_type: The authentication type. Required. Known values are: "systemAssignedIdentity", - "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", - "accessKey", "userAccount", and "easyAuthMicrosoftEntraID". - :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType - :ivar auth_mode: Optional. Indicates how to configure authentication. If optInAllAuth, service - linker configures authentication such as enabling identity on source resource and granting RBAC - roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. Known values - are: "optInAllAuth" and "optOutAllAuth". - :vartype auth_mode: str or ~azure.mgmt.servicelinker.models.AuthMode - :ivar principal_id: Principal Id for user account. - :vartype principal_id: str - :ivar delete_or_update_behavior: Indicates whether to clean up previous operation when Linker - is updating or deleting. Known values are: "Default" and "ForcedCleanup". - :vartype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior - :ivar roles: Optional, this value specifies the Azure roles to be assigned. Automatically. - :vartype roles: list[str] - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "user_name": {"key": "userName", "type": "str"}, - "auth_type": {"key": "authType", "type": "str"}, - "auth_mode": {"key": "authMode", "type": "str"}, - "principal_id": {"key": "principalId", "type": "str"}, - "delete_or_update_behavior": {"key": "deleteOrUpdateBehavior", "type": "str"}, - "roles": {"key": "roles", "type": "[str]"}, - } - - def __init__( - self, - *, - user_name: Optional[str] = None, - auth_mode: Optional[Union[str, "_models.AuthMode"]] = None, - principal_id: Optional[str] = None, - delete_or_update_behavior: Optional[Union[str, "_models.DeleteOrUpdateBehavior"]] = None, - roles: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword user_name: Username created in the database which is mapped to a user in AAD. - :paramtype user_name: str - :keyword auth_mode: Optional. Indicates how to configure authentication. If optInAllAuth, - service linker configures authentication such as enabling identity on source resource and - granting RBAC roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. - Known values are: "optInAllAuth" and "optOutAllAuth". - :paramtype auth_mode: str or ~azure.mgmt.servicelinker.models.AuthMode - :keyword principal_id: Principal Id for user account. - :paramtype principal_id: str - :keyword delete_or_update_behavior: Indicates whether to clean up previous operation when - Linker is updating or deleting. Known values are: "Default" and "ForcedCleanup". - :paramtype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior - :keyword roles: Optional, this value specifies the Azure roles to be assigned. Automatically. - :paramtype roles: list[str] - """ - super().__init__(auth_mode=auth_mode, user_name=user_name, **kwargs) - self.user_name = user_name - self.auth_type: str = "userAccount" - self.principal_id = principal_id - self.delete_or_update_behavior = delete_or_update_behavior - self.roles = roles - self.auth_mode = auth_mode - - -class UserAssignedIdentityAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): +class UserAssignedIdentityAuthInfo(AuthInfoBase): """The authentication info when authType is userAssignedIdentity. - 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 user_name: Username created in the database which is mapped to a user in AAD. - :vartype user_name: str :ivar auth_type: The authentication type. Required. Known values are: "systemAssignedIdentity", - "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", - "accessKey", "userAccount", and "easyAuthMicrosoftEntraID". + "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", and "secret". :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType - :ivar auth_mode: Optional. Indicates how to configure authentication. If optInAllAuth, service - linker configures authentication such as enabling identity on source resource and granting RBAC - roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. Known values - are: "optInAllAuth" and "optOutAllAuth". - :vartype auth_mode: str or ~azure.mgmt.servicelinker.models.AuthMode :ivar client_id: Client Id for userAssignedIdentity. :vartype client_id: str :ivar subscription_id: Subscription id for userAssignedIdentity. :vartype subscription_id: str - :ivar delete_or_update_behavior: Indicates whether to clean up previous operation when Linker - is updating or deleting. Known values are: "Default" and "ForcedCleanup". - :vartype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior - :ivar roles: Optional, this value specifies the Azure role to be assigned. - :vartype roles: list[str] """ _validation = { @@ -2722,59 +1119,30 @@ class UserAssignedIdentityAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): } _attribute_map = { - "user_name": {"key": "userName", "type": "str"}, "auth_type": {"key": "authType", "type": "str"}, - "auth_mode": {"key": "authMode", "type": "str"}, "client_id": {"key": "clientId", "type": "str"}, "subscription_id": {"key": "subscriptionId", "type": "str"}, - "delete_or_update_behavior": {"key": "deleteOrUpdateBehavior", "type": "str"}, - "roles": {"key": "roles", "type": "[str]"}, } def __init__( - self, - *, - user_name: Optional[str] = None, - auth_mode: Optional[Union[str, "_models.AuthMode"]] = None, - client_id: Optional[str] = None, - subscription_id: Optional[str] = None, - delete_or_update_behavior: Optional[Union[str, "_models.DeleteOrUpdateBehavior"]] = None, - roles: Optional[List[str]] = None, - **kwargs: Any + self, *, client_id: Optional[str] = None, subscription_id: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword user_name: Username created in the database which is mapped to a user in AAD. - :paramtype user_name: str - :keyword auth_mode: Optional. Indicates how to configure authentication. If optInAllAuth, - service linker configures authentication such as enabling identity on source resource and - granting RBAC roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. - Known values are: "optInAllAuth" and "optOutAllAuth". - :paramtype auth_mode: str or ~azure.mgmt.servicelinker.models.AuthMode :keyword client_id: Client Id for userAssignedIdentity. :paramtype client_id: str :keyword subscription_id: Subscription id for userAssignedIdentity. :paramtype subscription_id: str - :keyword delete_or_update_behavior: Indicates whether to clean up previous operation when - Linker is updating or deleting. Known values are: "Default" and "ForcedCleanup". - :paramtype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior - :keyword roles: Optional, this value specifies the Azure role to be assigned. - :paramtype roles: list[str] """ - super().__init__(auth_mode=auth_mode, user_name=user_name, **kwargs) - self.user_name = user_name + super().__init__(**kwargs) self.auth_type: str = "userAssignedIdentity" self.client_id = client_id self.subscription_id = subscription_id - self.delete_or_update_behavior = delete_or_update_behavior - self.roles = roles - self.auth_mode = auth_mode class ValidateOperationResult(_serialization.Model): - """The validation operation result for a Linker. + """The validation operation result for a linker. - :ivar resource_id: Validated Linker id. + :ivar resource_id: Validated linker id. :vartype resource_id: str :ivar status: Validation operation status. :vartype status: str @@ -2787,13 +1155,12 @@ class ValidateOperationResult(_serialization.Model): :vartype report_start_time_utc: ~datetime.datetime :ivar report_end_time_utc: The end time of the validation report. :vartype report_end_time_utc: ~datetime.datetime - :ivar source_id: The resource id of the Linker source application. + :ivar source_id: The resource id of the linker source application. :vartype source_id: str :ivar target_id: The resource Id of target service. :vartype target_id: str :ivar auth_type: The authentication type. Known values are: "systemAssignedIdentity", - "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", - "accessKey", "userAccount", and "easyAuthMicrosoftEntraID". + "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", and "secret". :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType :ivar validation_detail: The detail of validation result. :vartype validation_detail: list[~azure.mgmt.servicelinker.models.ValidationResultItem] @@ -2828,7 +1195,7 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword resource_id: Validated Linker id. + :keyword resource_id: Validated linker id. :paramtype resource_id: str :keyword status: Validation operation status. :paramtype status: str @@ -2841,13 +1208,12 @@ def __init__( :paramtype report_start_time_utc: ~datetime.datetime :keyword report_end_time_utc: The end time of the validation report. :paramtype report_end_time_utc: ~datetime.datetime - :keyword source_id: The resource id of the Linker source application. + :keyword source_id: The resource id of the linker source application. :paramtype source_id: str :keyword target_id: The resource Id of target service. :paramtype target_id: str :keyword auth_type: The authentication type. Known values are: "systemAssignedIdentity", - "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", - "accessKey", "userAccount", and "easyAuthMicrosoftEntraID". + "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", and "secret". :paramtype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType :keyword validation_detail: The detail of validation result. :paramtype validation_detail: list[~azure.mgmt.servicelinker.models.ValidationResultItem] @@ -2866,7 +1232,7 @@ def __init__( class ValidationResultItem(_serialization.Model): - """The validation item for a Linker. + """The validation item for a linker. :ivar name: The validation item name. :vartype name: str @@ -2922,7 +1288,7 @@ def __init__( class ValueSecretInfo(SecretInfoBase): """The secret info when type is rawValue. It's for scenarios that user input the secret. - 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 secret_type: The secret type. Required. Known values are: "rawValue", "keyVaultSecretUri", and "keyVaultSecretReference". @@ -2955,32 +1321,16 @@ class VNetSolution(_serialization.Model): :ivar type: Type of VNet solution. Known values are: "serviceEndpoint" and "privateLink". :vartype type: str or ~azure.mgmt.servicelinker.models.VNetSolutionType - :ivar delete_or_update_behavior: Indicates whether to clean up previous operation when Linker - is updating or deleting. Known values are: "Default" and "ForcedCleanup". - :vartype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior """ _attribute_map = { "type": {"key": "type", "type": "str"}, - "delete_or_update_behavior": {"key": "deleteOrUpdateBehavior", "type": "str"}, } - def __init__( - self, - *, - type: Optional[Union[str, "_models.VNetSolutionType"]] = None, - delete_or_update_behavior: Optional[Union[str, "_models.DeleteOrUpdateBehavior"]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, type: Optional[Union[str, "_models.VNetSolutionType"]] = None, **kwargs: Any) -> None: """ :keyword type: Type of VNet solution. Known values are: "serviceEndpoint" and "privateLink". :paramtype type: str or ~azure.mgmt.servicelinker.models.VNetSolutionType - :keyword delete_or_update_behavior: Indicates whether to clean up previous operation when - Linker is updating or deleting. Known values are: "Default" and "ForcedCleanup". - :paramtype delete_or_update_behavior: str or - ~azure.mgmt.servicelinker.models.DeleteOrUpdateBehavior """ super().__init__(**kwargs) self.type = type - self.delete_or_update_behavior = delete_or_update_behavior diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_service_linker_management_client_enums.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_service_linker_management_client_enums.py index dac839a12e95..ba236f109bca 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_service_linker_management_client_enums.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_service_linker_management_client_enums.py @@ -10,38 +10,10 @@ from azure.core import CaseInsensitiveEnumMeta -class AccessKeyPermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """AccessKeyPermissions.""" - - READ = "Read" - WRITE = "Write" - LISTEN = "Listen" - SEND = "Send" - MANAGE = "Manage" - - class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" INTERNAL = "Internal" - ENABLE = "enable" - OPT_OUT = "optOut" - - -class AllowType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Whether to allow firewall rules.""" - - TRUE = "true" - FALSE = "false" - - -class AuthMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Indicates how to apply the authentication configuration operations.""" - - OPT_IN_ALL_AUTH = "optInAllAuth" - """Default authentication configuration according to the authentication type.""" - OPT_OUT_ALL_AUTH = "optOutAllAuth" - """Skip all authentication configuration such as enabling managed identity and granting RBAC roles""" class AuthType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -52,9 +24,6 @@ class AuthType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SERVICE_PRINCIPAL_SECRET = "servicePrincipalSecret" SERVICE_PRINCIPAL_CERTIFICATE = "servicePrincipalCertificate" SECRET = "secret" - ACCESS_KEY = "accessKey" - USER_ACCOUNT = "userAccount" - EASY_AUTH_MICROSOFT_ENTRA_ID = "easyAuthMicrosoftEntraID" class AzureResourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -77,8 +46,6 @@ class ClientType(str, Enum, metaclass=CaseInsensitiveEnumMeta): NODEJS = "nodejs" SPRING_BOOT = "springBoot" KAFKA_SPRING_BOOT = "kafka-springBoot" - JMS_SPRING_BOOT = "jms-springBoot" - DAPR = "dapr" class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -90,61 +57,6 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): KEY = "Key" -class DaprBindingComponentDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The direction supported by the dapr binding component.""" - - INPUT = "input" - OUTPUT = "output" - - -class DaprMetadataRequired(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The value indicating whether the metadata is required or not.""" - - TRUE = "true" - FALSE = "false" - - -class DeleteOrUpdateBehavior(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The cleanup behavior to indicate whether clean up operation when resource is deleted or - updated. - """ - - DEFAULT = "Default" - FORCED_CLEANUP = "ForcedCleanup" - - -class DryrunActionName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The name of action for you dryrun job.""" - - CREATE_OR_UPDATE = "createOrUpdate" - - -class DryrunPrerequisiteResultType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of dryrun result.""" - - BASIC_ERROR = "basicError" - PERMISSIONS_MISSING = "permissionsMissing" - - -class DryrunPreviewOperationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The operation type.""" - - CONFIG_CONNECTION = "configConnection" - CONFIG_NETWORK = "configNetwork" - CONFIG_AUTH = "configAuth" - - -class LinkerConfigurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of configuration to determine whether the configuration can be modified after creation. - KeyvaultSecret means the configuration references a key vault secret, such as App Service/ACA - key vault reference. Default means the configuration is real value, such as user name, raw - secret, etc. - """ - - DEFAULT = "Default" - KEY_VAULT_SECRET = "KeyVaultSecret" - - class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system". @@ -155,13 +67,6 @@ class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): USER_SYSTEM = "user,system" -class SecretSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of secret source.""" - - RAW_VALUE = "rawValue" - KEY_VAULT_SECRET = "keyVaultSecret" - - class SecretType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The secret type.""" @@ -176,7 +81,6 @@ class TargetServiceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): AZURE_RESOURCE = "AzureResource" CONFLUENT_BOOTSTRAP_SERVER = "ConfluentBootstrapServer" CONFLUENT_SCHEMA_REGISTRY = "ConfluentSchemaRegistry" - SELF_HOSTED_SERVER = "SelfHostedServer" class ValidationResultStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/__init__.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/__init__.py index 80d740a2329c..6a161b8edd91 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/__init__.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/__init__.py @@ -6,22 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._connector_operations import ConnectorOperations from ._linker_operations import LinkerOperations -from ._linkers_operations import LinkersOperations from ._operations import Operations -from ._configuration_names_operations import ConfigurationNamesOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ConnectorOperations", "LinkerOperations", - "LinkersOperations", "Operations", - "ConfigurationNamesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_configuration_names_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_configuration_names_operations.py deleted file mode 100644 index 1de85a3f646d..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_configuration_names_operations.py +++ /dev/null @@ -1,169 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(*, filter: Optional[str] = None, skip_token: Optional[str] = None, **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", "2023-04-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.ServiceLinker/configurationNames") - - # 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 skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigurationNamesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicelinker.ServiceLinkerManagementClient`'s - :attr:`configuration_names` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.ConfigurationNameItem"]: - """Lists the configuration names generated by Service Connector for all target, client types, auth - types. - - :param filter: OData filter options. Default value is None. - :type filter: str - :param skip_token: OData skipToken option for pagination. Default value is None. - :type skip_token: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConfigurationNameItem or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicelinker.models.ConfigurationNameItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = 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)) - cls: ClsType[_models.ConfigurationNameResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - filter=filter, - skip_token=skip_token, - 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) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - 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 - - def extract_data(pipeline_response): - deserialized = self._deserialize("ConfigurationNameResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _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 [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.ServiceLinker/configurationNames"} diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_connector_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_connector_operations.py deleted file mode 100644 index 0bd59922ca38..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_connector_operations.py +++ /dev/null @@ -1,2291 +0,0 @@ -# pylint: disable=too-many-lines -# 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 io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_dryrun_request( - subscription_id: str, resource_group_name: str, location: 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", "2023-04-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns", - ) # 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 - ), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_dryrun_request( - subscription_id: str, resource_group_name: str, location: str, dryrun_name: 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", "2023-04-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}", - ) # 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 - ), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "dryrunName": _SERIALIZER.url("dryrun_name", dryrun_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_dryrun_request( - subscription_id: str, resource_group_name: str, location: str, dryrun_name: 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", "2023-04-01-preview")) - 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.ServiceLinker/locations/{location}/dryruns/{dryrunName}", - ) # 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 - ), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "dryrunName": _SERIALIZER.url("dryrun_name", dryrun_name, "str"), - } - - _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="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_dryrun_request( - subscription_id: str, resource_group_name: str, location: str, dryrun_name: 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", "2023-04-01-preview")) - 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.ServiceLinker/locations/{location}/dryruns/{dryrunName}", - ) # 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 - ), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "dryrunName": _SERIALIZER.url("dryrun_name", dryrun_name, "str"), - } - - _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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_dryrun_request( - subscription_id: str, resource_group_name: str, location: str, dryrun_name: 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", "2023-04-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}", - ) # 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 - ), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "dryrunName": _SERIALIZER.url("dryrun_name", dryrun_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(subscription_id: str, resource_group_name: str, location: 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", "2023-04-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors", - ) # 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 - ), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - subscription_id: str, resource_group_name: str, location: str, connector_name: 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", "2023-04-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}", - ) # 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 - ), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - subscription_id: str, resource_group_name: str, location: str, connector_name: 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", "2023-04-01-preview")) - 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.ServiceLinker/locations/{location}/connectors/{connectorName}", - ) # 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 - ), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), - } - - _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="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - subscription_id: str, resource_group_name: str, location: str, connector_name: 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", "2023-04-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}", - ) # 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 - ), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - subscription_id: str, resource_group_name: str, location: str, connector_name: 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", "2023-04-01-preview")) - 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.ServiceLinker/locations/{location}/connectors/{connectorName}", - ) # 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 - ), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), - } - - _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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request( - subscription_id: str, resource_group_name: str, location: str, connector_name: 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", "2023-04-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/validate", - ) # 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 - ), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_configurations_request( - subscription_id: str, resource_group_name: str, location: str, connector_name: 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", "2023-04-01-preview")) - 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.ServiceLinker/locations/{location}/connectors/{connectorName}/generateConfigurations", - ) # 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 - ), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), - } - - _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 ConnectorOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicelinker.ServiceLinkerManagementClient`'s - :attr:`connector` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_dryrun( - self, subscription_id: str, resource_group_name: str, location: str, **kwargs: Any - ) -> Iterable["_models.DryrunResource"]: - """list dryrun jobs. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DryrunResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = 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)) - cls: ClsType[_models.DryrunList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_dryrun_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - api_version=api_version, - template_url=self.list_dryrun.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - 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 - - def extract_data(pipeline_response): - deserialized = self._deserialize("DryrunList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _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 [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_dryrun.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns" - } - - @distributed_trace - def get_dryrun( - self, subscription_id: str, resource_group_name: str, location: str, dryrun_name: str, **kwargs: Any - ) -> _models.DryrunResource: - """get a dryrun job. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DryrunResource or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.DryrunResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = 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)) - cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) - - request = build_get_dryrun_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - dryrun_name=dryrun_name, - api_version=api_version, - template_url=self.get_dryrun.metadata["url"], - 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 [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DryrunResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_dryrun.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } - - def _create_dryrun_initial( - self, - subscription_id: str, - resource_group_name: str, - location: str, - dryrun_name: str, - parameters: Union[_models.DryrunResource, IO], - **kwargs: Any - ) -> _models.DryrunResource: - 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[_models.DryrunResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "DryrunResource") - - request = build_create_dryrun_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - dryrun_name=dryrun_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_dryrun_initial.metadata["url"], - 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 [200, 201]: - 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) - - if response.status_code == 200: - deserialized = self._deserialize("DryrunResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DryrunResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_dryrun_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } - - @overload - def begin_create_dryrun( - self, - subscription_id: str, - resource_group_name: str, - location: str, - dryrun_name: str, - parameters: _models.DryrunResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DryrunResource]: - """create a dryrun job to do necessary check before actual creation. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunResource - :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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_dryrun( - self, - subscription_id: str, - resource_group_name: str, - location: str, - dryrun_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DryrunResource]: - """create a dryrun job to do necessary check before actual creation. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: IO - :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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_dryrun( - self, - subscription_id: str, - resource_group_name: str, - location: str, - dryrun_name: str, - parameters: Union[_models.DryrunResource, IO], - **kwargs: Any - ) -> LROPoller[_models.DryrunResource]: - """create a dryrun job to do necessary check before actual creation. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Is either a DryrunResource type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunResource 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. - :return: An instance of LROPoller that returns either DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :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[_models.DryrunResource] = 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._create_dryrun_initial( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - dryrun_name=dryrun_name, - parameters=parameters, - 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): - deserialized = self._deserialize("DryrunResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_dryrun.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } - - def _update_dryrun_initial( - self, - subscription_id: str, - resource_group_name: str, - location: str, - dryrun_name: str, - parameters: Union[_models.DryrunPatch, IO], - **kwargs: Any - ) -> Optional[_models.DryrunResource]: - 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[Optional[_models.DryrunResource]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "DryrunPatch") - - request = build_update_dryrun_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - dryrun_name=dryrun_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_dryrun_initial.metadata["url"], - 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 [200, 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("DryrunResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_dryrun_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } - - @overload - def begin_update_dryrun( - self, - subscription_id: str, - resource_group_name: str, - location: str, - dryrun_name: str, - parameters: _models.DryrunPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DryrunResource]: - """update a dryrun job to do necessary check before actual creation. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunPatch - :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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_dryrun( - self, - subscription_id: str, - resource_group_name: str, - location: str, - dryrun_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DryrunResource]: - """update a dryrun job to do necessary check before actual creation. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: IO - :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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_dryrun( - self, - subscription_id: str, - resource_group_name: str, - location: str, - dryrun_name: str, - parameters: Union[_models.DryrunPatch, IO], - **kwargs: Any - ) -> LROPoller[_models.DryrunResource]: - """update a dryrun job to do necessary check before actual creation. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Is either a DryrunPatch type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunPatch 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. - :return: An instance of LROPoller that returns either DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :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[_models.DryrunResource] = 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._update_dryrun_initial( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - dryrun_name=dryrun_name, - parameters=parameters, - 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): - deserialized = self._deserialize("DryrunResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update_dryrun.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } - - @distributed_trace - def delete_dryrun( # pylint: disable=inconsistent-return-statements - self, subscription_id: str, resource_group_name: str, location: str, dryrun_name: str, **kwargs: Any - ) -> None: - """delete a dryrun job. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = 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)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_dryrun_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - dryrun_name=dryrun_name, - api_version=api_version, - template_url=self.delete_dryrun.metadata["url"], - 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 [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete_dryrun.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}" - } - - @distributed_trace - def list( - self, subscription_id: str, resource_group_name: str, location: str, **kwargs: Any - ) -> Iterable["_models.LinkerResource"]: - """Returns list of connector which connects to the resource, which supports to config the target - service during the resource provision. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either LinkerResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = 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)) - cls: ClsType[_models.ResourceList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - 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) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - 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 - - def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _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 [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors" - } - - @distributed_trace - def get( - self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any - ) -> _models.LinkerResource: - """Returns Connector resource for a given name. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: LinkerResource or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.LinkerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = 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)) - cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) - - request = build_get_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - 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) - - _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 [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("LinkerResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } - - def _create_or_update_initial( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Union[_models.LinkerResource, IO], - **kwargs: Any - ) -> _models.LinkerResource: - 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[_models.LinkerResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "LinkerResource") - - request = build_create_or_update_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - api_version=api_version, - 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) - - _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 [200, 201]: - 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) - - if response.status_code == 200: - deserialized = self._deserialize("LinkerResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("LinkerResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } - - @overload - def begin_create_or_update( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: _models.LinkerResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.LinkerResource]: - """Create or update Connector resource. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connector details. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerResource - :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 LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.LinkerResource]: - """Create or update Connector resource. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connector details. Required. - :type parameters: IO - :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 LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Union[_models.LinkerResource, IO], - **kwargs: Any - ) -> LROPoller[_models.LinkerResource]: - """Create or update Connector resource. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connector details. Is either a LinkerResource type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerResource 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. - :return: An instance of LROPoller that returns either LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :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[_models.LinkerResource] = 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._create_or_update_initial( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - parameters=parameters, - 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): - deserialized = self._deserialize("LinkerResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - 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.ServiceLinker/locations/{location}/connectors/{connectorName}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = 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)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - 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) - - _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 [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } - - @distributed_trace - def begin_delete( - self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete a Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_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: - """ - _headers = 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)) - 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._delete_initial( # type: ignore - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - api_version=api_version, - 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, {}) - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } - - def _update_initial( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Union[_models.LinkerPatch, IO], - **kwargs: Any - ) -> _models.LinkerResource: - 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[_models.LinkerResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "LinkerPatch") - - request = build_update_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - api_version=api_version, - 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) - - _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 [200, 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) - - if response.status_code == 200: - deserialized = self._deserialize("LinkerResource", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("LinkerResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } - - @overload - def begin_update( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: _models.LinkerPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.LinkerResource]: - """Operation to update an existing Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connector details. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch - :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 LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.LinkerResource]: - """Operation to update an existing Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connector details. Required. - :type parameters: IO - :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 LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Union[_models.LinkerPatch, IO], - **kwargs: Any - ) -> LROPoller[_models.LinkerResource]: - """Operation to update an existing Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connector details. Is either a LinkerPatch type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch 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. - :return: An instance of LROPoller that returns either LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :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[_models.LinkerResource] = 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._update_initial( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - parameters=parameters, - 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): - deserialized = self._deserialize("LinkerResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}" - } - - def _validate_initial( - self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any - ) -> Optional[_models.ValidateOperationResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = 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)) - cls: ClsType[Optional[_models.ValidateOperationResult]] = kwargs.pop("cls", None) - - request = build_validate_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - api_version=api_version, - template_url=self._validate_initial.metadata["url"], - 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 [200, 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ValidateOperationResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _validate_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/validate" - } - - @distributed_trace - def begin_validate( - self, subscription_id: str, resource_group_name: str, location: str, connector_name: str, **kwargs: Any - ) -> LROPoller[_models.ValidateOperationResult]: - """Validate a Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_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 ValidateOperationResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.ValidateOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = 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)) - cls: ClsType[_models.ValidateOperationResult] = 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._validate_initial( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ValidateOperationResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - 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.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_validate.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/validate" - } - - @overload - def generate_configurations( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Optional[_models.ConfigurationInfo] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConfigurationResult: - """Generate configurations for a Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connection Info, including format, secret store, etc. Default value is None. - :type parameters: ~azure.mgmt.servicelinker.models.ConfigurationInfo - :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: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def generate_configurations( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConfigurationResult: - """Generate configurations for a Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connection Info, including format, secret store, etc. Default value is None. - :type parameters: IO - :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: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def generate_configurations( - self, - subscription_id: str, - resource_group_name: str, - location: str, - connector_name: str, - parameters: Optional[Union[_models.ConfigurationInfo, IO]] = None, - **kwargs: Any - ) -> _models.ConfigurationResult: - """Generate configurations for a Connector. - - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of Azure region. Required. - :type location: str - :param connector_name: The name of resource. Required. - :type connector_name: str - :param parameters: Connection Info, including format, secret store, etc. Is either a - ConfigurationInfo type or a IO type. Default value is None. - :type parameters: ~azure.mgmt.servicelinker.models.ConfigurationInfo 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 - :return: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - 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[_models.ConfigurationResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "ConfigurationInfo") - else: - _json = None - - request = build_generate_configurations_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - location=location, - connector_name=connector_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.generate_configurations.metadata["url"], - 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 [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ConfigurationResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - generate_configurations.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/generateConfigurations" - } diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linker_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linker_operations.py index 0d940a434140..10d7bc9e972a 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linker_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linker_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. @@ -6,8 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast import urllib.parse from azure.core.exceptions import ( @@ -43,7 +42,7 @@ def build_list_request(resource_uri: 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", "2023-04-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,117 +62,11 @@ def build_list_request(resource_uri: str, **kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request(resource_uri: str, linker_name: 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", "2023-04-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - "linkerName": _SERIALIZER.url("linker_name", linker_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request(resource_uri: str, linker_name: 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", "2023-04-01-preview")) - 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", "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - "linkerName": _SERIALIZER.url("linker_name", linker_name, "str"), - } - - _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="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request(resource_uri: str, linker_name: 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", "2023-04-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - "linkerName": _SERIALIZER.url("linker_name", linker_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request(resource_uri: str, linker_name: 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", "2023-04-01-preview")) - 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", "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - "linkerName": _SERIALIZER.url("linker_name", linker_name, "str"), - } - - _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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - def build_validate_request(resource_uri: str, linker_name: 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", "2023-04-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -200,7 +93,7 @@ def build_list_configurations_request(resource_uri: str, linker_name: str, **kwa _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", "2023-04-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -244,13 +137,11 @@ def __init__(self, *args, **kwargs): @distributed_trace def list(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.LinkerResource"]: - """Returns list of Linkers which connects to the resource. which supports to config both - application and target service during the resource provision. + """Returns list of Linkers which connects to the resource. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either LinkerResource or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicelinker.models.LinkerResource] :raises ~azure.core.exceptions.HttpResponseError: @@ -259,7 +150,7 @@ def list(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.LinkerReso _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.ResourceList] = kwargs.pop("cls", None) + cls: ClsType[_models.LinkerList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -272,15 +163,14 @@ def list(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.LinkerReso def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_uri=resource_uri, 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 @@ -292,27 +182,27 @@ 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("ResourceList", pipeline_response) + deserialized = self._deserialize("LinkerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _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 @@ -325,607 +215,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers"} - - @distributed_trace - def get(self, resource_uri: str, linker_name: str, **kwargs: Any) -> _models.LinkerResource: - """Returns Linker resource for a given name. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: LinkerResource or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.LinkerResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = 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)) - cls: ClsType[_models.LinkerResource] = kwargs.pop("cls", None) - - request = build_get_request( - resource_uri=resource_uri, - linker_name=linker_name, - 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) - - _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 [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("LinkerResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}"} - - def _create_or_update_initial( - self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerResource, IO], **kwargs: Any - ) -> _models.LinkerResource: - 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[_models.LinkerResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "LinkerResource") - - request = build_create_or_update_request( - resource_uri=resource_uri, - linker_name=linker_name, - api_version=api_version, - 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) - - _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 [200, 201]: - 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) - - if response.status_code == 200: - deserialized = self._deserialize("LinkerResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("LinkerResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_or_update_initial.metadata = { - "url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}" - } - - @overload - def begin_create_or_update( - self, - resource_uri: str, - linker_name: str, - parameters: _models.LinkerResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.LinkerResource]: - """Create or update Linker resource. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :param parameters: Linker details. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerResource - :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 LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_uri: str, - linker_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.LinkerResource]: - """Create or update Linker resource. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :param parameters: Linker details. Required. - :type parameters: IO - :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 LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerResource, IO], **kwargs: Any - ) -> LROPoller[_models.LinkerResource]: - """Create or update Linker resource. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :param parameters: Linker details. Is either a LinkerResource type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerResource 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. - :return: An instance of LROPoller that returns either LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :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[_models.LinkerResource] = 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._create_or_update_initial( - resource_uri=resource_uri, - linker_name=linker_name, - parameters=parameters, - 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): - deserialized = self._deserialize("LinkerResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}"} - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_uri: str, linker_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = 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)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_uri=resource_uri, - linker_name=linker_name, - 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) - - _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 [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}"} - - @distributed_trace - def begin_delete(self, resource_uri: str, linker_name: str, **kwargs: Any) -> LROPoller[None]: - """Delete a Linker. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_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: - """ - _headers = 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)) - 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._delete_initial( # type: ignore - resource_uri=resource_uri, - linker_name=linker_name, - api_version=api_version, - 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, {}) - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}"} - - def _update_initial( - self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerPatch, IO], **kwargs: Any - ) -> _models.LinkerResource: - 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[_models.LinkerResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "LinkerPatch") - - request = build_update_request( - resource_uri=resource_uri, - linker_name=linker_name, - api_version=api_version, - 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) - - _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 [200, 201]: - 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) - - if response.status_code == 200: - deserialized = self._deserialize("LinkerResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("LinkerResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _update_initial.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}"} - - @overload - def begin_update( - self, - resource_uri: str, - linker_name: str, - parameters: _models.LinkerPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.LinkerResource]: - """Operation to update an existing Linker. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :param parameters: Linker details. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch - :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 LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_uri: str, - linker_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.LinkerResource]: - """Operation to update an existing Linker. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :param parameters: Linker details. Required. - :type parameters: IO - :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 LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, resource_uri: str, linker_name: str, parameters: Union[_models.LinkerPatch, IO], **kwargs: Any - ) -> LROPoller[_models.LinkerResource]: - """Operation to update an existing Linker. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :param parameters: Linker details. Is either a LinkerPatch type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.LinkerPatch 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. - :return: An instance of LROPoller that returns either LinkerResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.LinkerResource] - :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[_models.LinkerResource] = 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._update_initial( - resource_uri=resource_uri, - linker_name=linker_name, - parameters=parameters, - 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): - deserialized = self._deserialize("LinkerResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}"} - def _validate_initial( self, resource_uri: str, linker_name: str, **kwargs: Any ) -> Optional[_models.ValidateOperationResult]: @@ -943,20 +232,19 @@ def _validate_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.ValidateOperationResult]] = kwargs.pop("cls", None) - request = build_validate_request( + _request = build_validate_request( resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, - template_url=self._validate_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 @@ -971,33 +259,21 @@ def _validate_initial( deserialized = self._deserialize("ValidateOperationResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _validate_initial.metadata = { - "url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/validateLinker" - } + return deserialized # type: ignore @distributed_trace def begin_validate( self, resource_uri: str, linker_name: str, **kwargs: Any ) -> LROPoller[_models.ValidateOperationResult]: - """Validate a Linker. + """Validate a link. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str :param linker_name: The name Linker resource. Required. :type linker_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 ValidateOperationResult or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.ValidateOperationResult] @@ -1026,42 +302,41 @@ def begin_validate( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ValidateOperationResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ValidateOperationResult].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_validate.metadata = { - "url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/validateLinker" - } + return LROPoller[_models.ValidateOperationResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace - def list_configurations(self, resource_uri: str, linker_name: str, **kwargs: Any) -> _models.ConfigurationResult: - """list source configurations for a Linker. + def list_configurations( + self, resource_uri: str, linker_name: str, **kwargs: Any + ) -> _models.SourceConfigurationResult: + """list source configurations for a linker. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. :type resource_uri: str :param linker_name: The name Linker resource. Required. :type linker_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult + :return: SourceConfigurationResult or the result of cls(response) + :rtype: ~azure.mgmt.servicelinker.models.SourceConfigurationResult :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -1076,22 +351,21 @@ def list_configurations(self, resource_uri: str, linker_name: str, **kwargs: Any _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.ConfigurationResult] = kwargs.pop("cls", None) + cls: ClsType[_models.SourceConfigurationResult] = kwargs.pop("cls", None) - request = build_list_configurations_request( + _request = build_list_configurations_request( resource_uri=resource_uri, linker_name=linker_name, api_version=api_version, - template_url=self.list_configurations.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 @@ -1101,13 +375,9 @@ def list_configurations(self, resource_uri: str, linker_name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConfigurationResult", pipeline_response) + deserialized = self._deserialize("SourceConfigurationResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_configurations.metadata = { - "url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/listConfigurations" - } + return deserialized # type: ignore diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linkers_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linkers_operations.py deleted file mode 100644 index e8f0a14de846..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linkers_operations.py +++ /dev/null @@ -1,1104 +0,0 @@ -# pylint: disable=too-many-lines -# 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 io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_dryrun_request(resource_uri: 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", "2023-04-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_dryrun_request(resource_uri: str, dryrun_name: 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", "2023-04-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - "dryrunName": _SERIALIZER.url("dryrun_name", dryrun_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_dryrun_request(resource_uri: str, dryrun_name: 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", "2023-04-01-preview")) - 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", "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - "dryrunName": _SERIALIZER.url("dryrun_name", dryrun_name, "str"), - } - - _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="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_dryrun_request(resource_uri: str, dryrun_name: 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", "2023-04-01-preview")) - 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", "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - "dryrunName": _SERIALIZER.url("dryrun_name", dryrun_name, "str"), - } - - _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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_dryrun_request(resource_uri: str, dryrun_name: 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", "2023-04-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - "dryrunName": _SERIALIZER.url("dryrun_name", dryrun_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_configurations_request(resource_uri: str, linker_name: 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", "2023-04-01-preview")) - 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", "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/generateConfigurations" - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - "linkerName": _SERIALIZER.url("linker_name", linker_name, "str"), - } - - _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) - - -def build_list_dapr_configurations_request(resource_uri: 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", "2023-04-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.ServiceLinker/daprConfigurations") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class LinkersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicelinker.ServiceLinkerManagementClient`'s - :attr:`linkers` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_dryrun(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.DryrunResource"]: - """list dryrun jobs. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DryrunResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = 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)) - cls: ClsType[_models.DryrunList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_dryrun_request( - resource_uri=resource_uri, - api_version=api_version, - template_url=self.list_dryrun.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - 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 - - def extract_data(pipeline_response): - deserialized = self._deserialize("DryrunList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _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 [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_dryrun.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns"} - - @distributed_trace - def get_dryrun(self, resource_uri: str, dryrun_name: str, **kwargs: Any) -> _models.DryrunResource: - """get a dryrun job. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DryrunResource or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.DryrunResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = 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)) - cls: ClsType[_models.DryrunResource] = kwargs.pop("cls", None) - - request = build_get_dryrun_request( - resource_uri=resource_uri, - dryrun_name=dryrun_name, - api_version=api_version, - template_url=self.get_dryrun.metadata["url"], - 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 [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DryrunResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_dryrun.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} - - def _create_dryrun_initial( - self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunResource, IO], **kwargs: Any - ) -> _models.DryrunResource: - 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[_models.DryrunResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "DryrunResource") - - request = build_create_dryrun_request( - resource_uri=resource_uri, - dryrun_name=dryrun_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_dryrun_initial.metadata["url"], - 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 [200, 201]: - 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) - - if response.status_code == 200: - deserialized = self._deserialize("DryrunResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DryrunResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_dryrun_initial.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} - - @overload - def begin_create_dryrun( - self, - resource_uri: str, - dryrun_name: str, - parameters: _models.DryrunResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DryrunResource]: - """create a dryrun job to do necessary check before actual creation. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunResource - :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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_dryrun( - self, - resource_uri: str, - dryrun_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DryrunResource]: - """create a dryrun job to do necessary check before actual creation. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: IO - :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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_dryrun( - self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunResource, IO], **kwargs: Any - ) -> LROPoller[_models.DryrunResource]: - """create a dryrun job to do necessary check before actual creation. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Is either a DryrunResource type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunResource 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. - :return: An instance of LROPoller that returns either DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :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[_models.DryrunResource] = 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._create_dryrun_initial( - resource_uri=resource_uri, - dryrun_name=dryrun_name, - parameters=parameters, - 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): - deserialized = self._deserialize("DryrunResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_dryrun.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} - - def _update_dryrun_initial( - self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunPatch, IO], **kwargs: Any - ) -> Optional[_models.DryrunResource]: - 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[Optional[_models.DryrunResource]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "DryrunPatch") - - request = build_update_dryrun_request( - resource_uri=resource_uri, - dryrun_name=dryrun_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_dryrun_initial.metadata["url"], - 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 [200, 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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("DryrunResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_dryrun_initial.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} - - @overload - def begin_update_dryrun( - self, - resource_uri: str, - dryrun_name: str, - parameters: _models.DryrunPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DryrunResource]: - """add a dryrun job to do necessary check before actual creation. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunPatch - :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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_dryrun( - self, - resource_uri: str, - dryrun_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DryrunResource]: - """add a dryrun job to do necessary check before actual creation. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Required. - :type parameters: IO - :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 DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update_dryrun( - self, resource_uri: str, dryrun_name: str, parameters: Union[_models.DryrunPatch, IO], **kwargs: Any - ) -> LROPoller[_models.DryrunResource]: - """add a dryrun job to do necessary check before actual creation. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :param parameters: dryrun resource. Is either a DryrunPatch type or a IO type. Required. - :type parameters: ~azure.mgmt.servicelinker.models.DryrunPatch 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. - :return: An instance of LROPoller that returns either DryrunResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicelinker.models.DryrunResource] - :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[_models.DryrunResource] = 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._update_dryrun_initial( - resource_uri=resource_uri, - dryrun_name=dryrun_name, - parameters=parameters, - 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): - deserialized = self._deserialize("DryrunResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update_dryrun.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} - - @distributed_trace - def delete_dryrun( # pylint: disable=inconsistent-return-statements - self, resource_uri: str, dryrun_name: str, **kwargs: Any - ) -> None: - """delete a dryrun job. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param dryrun_name: The name of dryrun. Required. - :type dryrun_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = 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)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_dryrun_request( - resource_uri=resource_uri, - dryrun_name=dryrun_name, - api_version=api_version, - template_url=self.delete_dryrun.metadata["url"], - 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 [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete_dryrun.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"} - - @overload - def generate_configurations( - self, - resource_uri: str, - linker_name: str, - parameters: Optional[_models.ConfigurationInfo] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConfigurationResult: - """Generate configurations for a Linker. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :param parameters: Connection Info, including format, secret store, etc. Default value is None. - :type parameters: ~azure.mgmt.servicelinker.models.ConfigurationInfo - :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: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def generate_configurations( - self, - resource_uri: str, - linker_name: str, - parameters: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConfigurationResult: - """Generate configurations for a Linker. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :param parameters: Connection Info, including format, secret store, etc. Default value is None. - :type parameters: IO - :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: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def generate_configurations( - self, - resource_uri: str, - linker_name: str, - parameters: Optional[Union[_models.ConfigurationInfo, IO]] = None, - **kwargs: Any - ) -> _models.ConfigurationResult: - """Generate configurations for a Linker. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :param linker_name: The name Linker resource. Required. - :type linker_name: str - :param parameters: Connection Info, including format, secret store, etc. Is either a - ConfigurationInfo type or a IO type. Default value is None. - :type parameters: ~azure.mgmt.servicelinker.models.ConfigurationInfo 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 - :return: ConfigurationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicelinker.models.ConfigurationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - 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[_models.ConfigurationResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "ConfigurationInfo") - else: - _json = None - - request = build_generate_configurations_request( - resource_uri=resource_uri, - linker_name=linker_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.generate_configurations.metadata["url"], - 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 [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ConfigurationResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - generate_configurations.metadata = { - "url": "/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/generateConfigurations" - } - - @distributed_trace - def list_dapr_configurations( - self, resource_uri: str, **kwargs: Any - ) -> Iterable["_models.DaprConfigurationResource"]: - """List the dapr configuration supported by Service Connector. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to - be connected. Required. - :type resource_uri: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DaprConfigurationResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicelinker.models.DaprConfigurationResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = 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)) - cls: ClsType[_models.DaprConfigurationList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_dapr_configurations_request( - resource_uri=resource_uri, - api_version=api_version, - template_url=self.list_dapr_configurations.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - 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 - - def extract_data(pipeline_response): - deserialized = self._deserialize("DaprConfigurationList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _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 [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_dapr_configurations.metadata = {"url": "/{resourceUri}/providers/Microsoft.ServiceLinker/daprConfigurations"} diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_operations.py index 501a3a17324c..c5e1e8ec12ba 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/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", "2023-04-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-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"]: """Lists the available ServiceLinker REST API operations. - :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.servicelinker.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.ServiceLinker/operations"} diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/configuration_names_list.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/configuration_names_list.py deleted file mode 100644 index 18b07075b19e..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/configuration_names_list.py +++ /dev/null @@ -1,38 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python configuration_names_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - 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 = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.configuration_names.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/ConfigurationNamesList.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_create.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_create.py deleted file mode 100644 index e7b1deb07625..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_create.py +++ /dev/null @@ -1,58 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python connector_dryrun_create.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 = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.connector.begin_create_dryrun( - subscription_id="00000000-0000-0000-0000-000000000000", - resource_group_name="test-rg", - location="westus", - dryrun_name="dryrunName", - parameters={ - "properties": { - "parameters": { - "actionName": "createOrUpdate", - "authInfo": { - "authType": "secret", - "name": "name", - "secretInfo": {"secretType": "rawValue", "value": "secret"}, - }, - "targetService": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db", - "type": "AzureResource", - }, - } - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/ConnectorDryrunCreate.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_delete.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_delete.py deleted file mode 100644 index 78364a23cd36..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_delete.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python connector_dryrun_delete.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 = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - client.connector.delete_dryrun( - subscription_id="00000000-0000-0000-0000-000000000000", - resource_group_name="test-rg", - location="westus", - dryrun_name="dryrunName", - ) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/ConnectorDryrunDelete.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_get.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_get.py deleted file mode 100644 index 8fdc973509c4..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_get.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python connector_dryrun_get.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 = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.connector.get_dryrun( - subscription_id="00000000-0000-0000-0000-000000000000", - resource_group_name="test-rg", - location="westus", - dryrun_name="dryrunName", - ) - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/ConnectorDryrunGet.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_list.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_list.py deleted file mode 100644 index ca39bef4454d..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_list.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python connector_dryrun_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - 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 = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.connector.list_dryrun( - subscription_id="00000000-0000-0000-0000-000000000000", - resource_group_name="test-rg", - location="westus", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/ConnectorDryrunList.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_update.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_update.py deleted file mode 100644 index 1ada6f82ebf5..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_update.py +++ /dev/null @@ -1,58 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python connector_dryrun_update.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 = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.connector.begin_update_dryrun( - subscription_id="00000000-0000-0000-0000-000000000000", - resource_group_name="test-rg", - location="westus", - dryrun_name="dryrunName", - parameters={ - "properties": { - "parameters": { - "actionName": "createOrUpdate", - "authInfo": { - "authType": "secret", - "name": "name", - "secretInfo": {"secretType": "rawValue", "value": "secret"}, - }, - "targetService": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db", - "type": "AzureResource", - }, - } - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/ConnectorDryrunUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_list.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_list.py deleted file mode 100644 index 948b5188d330..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_list.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python connector_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - 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 = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.connector.list( - subscription_id="00000000-0000-0000-0000-000000000000", - resource_group_name="test-rg", - location="westus", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/ConnectorList.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connectors.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connectors.py deleted file mode 100644 index bbfa71d15593..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connectors.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python connectors.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 = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.connector.get( - subscription_id="00000000-0000-0000-0000-000000000000", - resource_group_name="test-rg", - location="westus", - connector_name="connectorName", - ) - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/Connectors.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_connector.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_connector.py deleted file mode 100644 index aeec7f5aadf2..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_connector.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python delete_connector.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 = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - client.connector.begin_delete( - subscription_id="00000000-0000-0000-0000-000000000000", - resource_group_name="test-rg", - location="westus", - connector_name="connectorName", - ).result() - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/DeleteConnector.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_dryrun.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_dryrun.py deleted file mode 100644 index 802f49a1b93f..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_dryrun.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python delete_dryrun.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 = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - client.linkers.delete_dryrun( - resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - dryrun_name="dryrunName", - ) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/DeleteDryrun.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_linker.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_linker.py deleted file mode 100644 index 481d5b2369bc..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_linker.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python delete_linker.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 = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - client.linker.begin_delete( - resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - linker_name="linkName", - ).result() - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/DeleteLinker.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/generate_configurations.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/generate_configurations.py deleted file mode 100644 index bec2a04b9fb6..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/generate_configurations.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python generate_configurations.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 = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.connector.generate_configurations( - subscription_id="00000000-0000-0000-0000-000000000000", - resource_group_name="test-rg", - location="westus", - connector_name="connectorName", - ) - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/GenerateConfigurations.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_configurations.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_configurations.py index cd568016859b..4d89c5e03981 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_configurations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_configurations.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.servicelinker import ServiceLinkerManagementClient """ @@ -29,12 +30,12 @@ def main(): ) response = client.linker.list_configurations( - resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.App/containerApps/test-app", + resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", linker_name="linkName", ) print(response) -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/GetConfigurations.json +# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/GetConfigurations.json if __name__ == "__main__": main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_dapr_configurations.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_dapr_configurations.py deleted file mode 100644 index 27b3f7042e14..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_dapr_configurations.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python get_dapr_configurations.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 = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.linkers.list_dapr_configurations( - resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/GetDaprConfigurations.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_dryrun.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_dryrun.py deleted file mode 100644 index b6f4c545bd08..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_dryrun.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python get_dryrun.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 = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.linkers.get_dryrun( - resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - dryrun_name="dryrunName", - ) - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/GetDryrun.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker_list.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/link_list.py similarity index 93% rename from sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker_list.py rename to sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/link_list.py index bdb2e3910a05..3713bfa8a680 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker_list.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/link_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.servicelinker import ServiceLinkerManagementClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-servicelinker # USAGE - python linker_list.py + python link_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/LinkerList.json +# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/LinkList.json if __name__ == "__main__": main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker.py deleted file mode 100644 index 17af45e5f777..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python linker.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 = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.linker.get( - resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - linker_name="linkName", - ) - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/Linker.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker_generate_configurations.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker_generate_configurations.py deleted file mode 100644 index 72e5867916b7..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker_generate_configurations.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python linker_generate_configurations.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 = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.linkers.generate_configurations( - resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - linker_name="linkName", - ) - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/LinkerGenerateConfigurations.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/list_dryrun.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/list_dryrun.py deleted file mode 100644 index b08bd47c3b00..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/list_dryrun.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python list_dryrun.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 = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.linkers.list_dryrun( - resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/ListDryrun.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/operations_list.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/operations_list.py index 886ff5129dc4..2540fb6fb10e 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/operations_list.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/operations_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.servicelinker import ServiceLinkerManagementClient """ @@ -33,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/OperationsList.json +# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/OperationsList.json if __name__ == "__main__": main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_connector.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_connector.py deleted file mode 100644 index 0390b71a75bb..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_connector.py +++ /dev/null @@ -1,56 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python patch_connector.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 = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.connector.begin_update( - subscription_id="00000000-0000-0000-0000-000000000000", - resource_group_name="test-rg", - location="westus", - connector_name="connectorName", - parameters={ - "properties": { - "authInfo": { - "authType": "servicePrincipalSecret", - "clientId": "name", - "principalId": "id", - "secret": "secret", - }, - "targetService": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db", - "type": "AzureResource", - }, - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/PatchConnector.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_dryrun.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_dryrun.py deleted file mode 100644 index 268679c3fa45..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_dryrun.py +++ /dev/null @@ -1,56 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python patch_dryrun.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 = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.linkers.begin_update_dryrun( - resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - dryrun_name="dryrunName", - parameters={ - "properties": { - "parameters": { - "actionName": "createOrUpdate", - "authInfo": { - "authType": "secret", - "name": "name", - "secretInfo": {"secretType": "rawValue", "value": "secret"}, - }, - "targetService": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db", - "type": "AzureResource", - }, - } - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/PatchDryrun.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_linker.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_linker.py deleted file mode 100644 index fc86f70ac479..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_linker.py +++ /dev/null @@ -1,54 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python patch_linker.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 = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.linker.begin_update( - resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - linker_name="linkName", - parameters={ - "properties": { - "authInfo": { - "authType": "servicePrincipalSecret", - "clientId": "name", - "principalId": "id", - "secret": "secret", - }, - "targetService": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db", - "type": "AzureResource", - }, - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/PatchLinker.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_connector.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_connector.py deleted file mode 100644 index 797ad53c067f..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_connector.py +++ /dev/null @@ -1,54 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python put_connector.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 = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.connector.begin_create_or_update( - subscription_id="00000000-0000-0000-0000-000000000000", - resource_group_name="test-rg", - location="westus", - connector_name="connectorName", - parameters={ - "properties": { - "authInfo": {"authType": "secret"}, - "secretStore": { - "keyVaultId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.KeyVault/vaults/test-kv" - }, - "targetService": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db", - "type": "AzureResource", - }, - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/PutConnector.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_dryrun.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_dryrun.py deleted file mode 100644 index dd63b35c1b95..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_dryrun.py +++ /dev/null @@ -1,56 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python put_dryrun.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 = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.linkers.begin_create_dryrun( - resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - dryrun_name="dryrunName", - parameters={ - "properties": { - "parameters": { - "actionName": "createOrUpdate", - "authInfo": { - "authType": "secret", - "name": "name", - "secretInfo": {"secretType": "rawValue", "value": "secret"}, - }, - "targetService": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db", - "type": "AzureResource", - }, - } - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/PutDryrun.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_linker.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_linker.py deleted file mode 100644 index 2e0d51c400f7..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_linker.py +++ /dev/null @@ -1,54 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python put_linker.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 = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.linker.begin_create_or_update( - resource_uri="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app", - linker_name="linkName", - parameters={ - "properties": { - "authInfo": { - "authType": "secret", - "name": "name", - "secretInfo": {"secretType": "rawValue", "value": "secret"}, - }, - "targetService": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DBforPostgreSQL/servers/test-pg/databases/test-db", - "type": "AzureResource", - }, - "vNetSolution": {"type": "serviceEndpoint"}, - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/PutLinker.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_connector_success.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_connector_success.py deleted file mode 100644 index 7c52662c44d2..000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_connector_success.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.servicelinker import ServiceLinkerManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-servicelinker -# USAGE - python validate_connector_success.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 = ServiceLinkerManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.connector.begin_validate( - subscription_id="00000000-0000-0000-0000-000000000000", - resource_group_name="test-rg", - location="westus", - connector_name="connectorName", - ).result() - print(response) - - -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/ValidateConnectorSuccess.json -if __name__ == "__main__": - main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_linker_success.py b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_link_success.py similarity index 92% rename from sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_linker_success.py rename to sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_link_success.py index 4c0053398e65..ea6128d4d159 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_linker_success.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/validate_link_success.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.servicelinker import ServiceLinkerManagementClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-servicelinker # USAGE - python validate_linker_success.py + python validate_link_success.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, @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/ValidateLinkerSuccess.json +# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/ValidateLinkSuccess.json if __name__ == "__main__": main() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/setup.py b/sdk/servicelinker/azure-mgmt-servicelinker/setup.py index 2b410cf24d40..d59453bb65bc 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/setup.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/setup.py @@ -74,9 +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", + "isodate>=0.6.1", + "azure-common>=1.1", + "azure-mgmt-core>=1.3.2", ], python_requires=">=3.8", )