diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/_meta.json b/sdk/servicelinker/azure-mgmt-servicelinker/_meta.json index 9dd88955eb82c..1cccc4a347c17 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/_meta.json +++ b/sdk/servicelinker/azure-mgmt-servicelinker/_meta.json @@ -1,11 +1,11 @@ { - "commit": "279924e2cefe36a86703fd85a91679f6dfc067fc", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "commit": "fdc208b15fbd1be88a9f05ac33ebe6723491d647", + "repository_url": "https://github.com/test-repo-billy/azure-rest-api-specs", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.2.7", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "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 --tag=package-2022-11-01-preview --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --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.7.1 --use=@autorest/modelerfour@4.26.2 --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 096b5822e77e9..4702d5b0fa4d8 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_configuration.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -33,14 +27,14 @@ 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 "2022-11-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-02-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: Literal["2022-11-01-preview"] = kwargs.pop("api_version", "2022-11-01-preview") + api_version: str = kwargs.pop("api_version", "2024-02-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") 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 2c170e28dbca2..4bae2292227bd 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_serialization.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: 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__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,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=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -602,7 +629,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): @@ -626,8 +653,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -636,8 +662,9 @@ def _serialize(self, target_obj, data_type=None, **kwargs): _serialized.update(_new_attr) # type: ignore _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] - except ValueError: - continue + except ValueError as err: + if isinstance(err, SerializationError): + raise except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) @@ -656,8 +683,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -715,6 +742,8 @@ def query(self, name, data, data_type, **kwargs): :param data: The data to be serialized. :param str data_type: The type to be serialized from. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -723,10 +752,8 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] - if not kwargs.get("skip_quote", False): - data = [quote(str(d), safe="") for d in data] - return str(self.serialize_iter(data, internal_data_type, **kwargs)) + do_quote = not kwargs.get("skip_quote", False) + return str(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) @@ -777,6 +804,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -863,6 +892,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. + :keyword bool do_quote: Whether to quote the serialized result of each iterable element. + Defaults to False. :rtype: list, str """ if isinstance(data, str): @@ -875,9 +906,14 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): for d in data: try: serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized.append(None) + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + if div: serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) @@ -922,7 +958,9 @@ def serialize_dict(self, attr, dict_type, **kwargs): for key, value in attr.items(): try: serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized[self.serialize_unicode(key)] = None if "xml" in serialization_ctxt: @@ -1161,7 +1199,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1242,7 +1281,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1266,7 +1305,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): @@ -1332,7 +1371,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=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1391,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = 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 @@ -1471,7 +1510,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1525,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1535,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: 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 2212b97af8870..4e42419f459ba 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 @@ -15,13 +15,7 @@ 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 +25,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 "2022-11-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-02-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,19 +44,14 @@ def __init__( self, credential: "TokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: self._config = ServiceLinkerManagementClientConfiguration(credential=credential, **kwargs) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._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: """Runs the network request through the client's chained policies. @@ -99,5 +82,5 @@ def __enter__(self) -> "ServiceLinkerManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_vendor.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_vendor.py index 9aad73fc743e7..0dafe0e287ff1 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_vendor.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_vendor.py @@ -14,14 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) 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 58920e6942de0..e5754a47ce68f 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.0b1" +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 52e9af507a221..077d2eb24c3f1 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 @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -33,14 +27,14 @@ 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 "2022-11-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-02-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: Literal["2022-11-01-preview"] = kwargs.pop("api_version", "2022-11-01-preview") + api_version: str = kwargs.pop("api_version", "2024-02-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") 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 e46ec5e97a012..a5af04219b7ff 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 @@ -15,13 +15,7 @@ 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 +25,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 "2022-11-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-02-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,19 +44,14 @@ def __init__( self, credential: "AsyncTokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: self._config = ServiceLinkerManagementClientConfiguration(credential=credential, **kwargs) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._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]: """Runs the network request through the client's chained policies. @@ -100,5 +82,5 @@ async def __aenter__(self) -> "ServiceLinkerManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) 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 80d740a2329ce..6a161b8edd91d 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 941b515504392..0000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_configuration_names_operations.py +++ /dev/null @@ -1,150 +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. -# -------------------------------------------------------------------------- -import sys -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 - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -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: Literal["2022-11-01-preview"] = 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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 e8f0e3a10d43d..0000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_connector_operations.py +++ /dev/null @@ -1,1919 +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. -# -------------------------------------------------------------------------- -import sys -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, -) - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -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: Literal["2022-11-01-preview"] = 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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: Literal["2022-11-01-preview"] = 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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: Literal["2022-11-01-preview"] = 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, (IO, 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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 model 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: Literal["2022-11-01-preview"] = 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: Literal["2022-11-01-preview"] = 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, (IO, 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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 model 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: Literal["2022-11-01-preview"] = 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: Literal["2022-11-01-preview"] = 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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: Literal["2022-11-01-preview"] = 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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: Literal["2022-11-01-preview"] = 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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: Literal["2022-11-01-preview"] = 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, (IO, 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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 model 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: Literal["2022-11-01-preview"] = 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: Literal["2022-11-01-preview"] = 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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: Literal["2022-11-01-preview"] = 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: Literal["2022-11-01-preview"] = 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, (IO, 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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 model 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: Literal["2022-11-01-preview"] = 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: Literal["2022-11-01-preview"] = 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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: Literal["2022-11-01-preview"] = 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 model 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: Literal["2022-11-01-preview"] = 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, (IO, 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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 7d971b7057a59..6c6feefc88cce 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 @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -41,10 +41,6 @@ build_validate_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,8 +66,7 @@ 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. @@ -85,10 +80,8 @@ def list(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.Linke _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ResourceList] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LinkerList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -130,7 +123,7 @@ def prepare_request(next_link=None): 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 @@ -139,8 +132,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -180,9 +174,7 @@ async def get(self, resource_uri: str, linker_name: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -196,8 +188,9 @@ async def get(self, resource_uri: str, linker_name: str, **kwargs: Any) -> _mode 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -230,16 +223,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "LinkerResource") @@ -258,8 +249,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -294,7 +286,7 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.LinkerResource]: - """Create or update Linker resource. + """Create or update linker resource. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. @@ -330,7 +322,7 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.LinkerResource]: - """Create or update Linker resource. + """Create or update linker resource. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. @@ -360,14 +352,14 @@ async def begin_create_or_update( 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. + """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 model type or a IO type. Required. + :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. @@ -388,9 +380,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -450,9 +440,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -466,8 +454,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -484,7 +473,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def begin_delete(self, resource_uri: str, linker_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Delete a Linker. + """Delete a link. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. @@ -506,9 +495,7 @@ async def begin_delete(self, resource_uri: str, linker_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -563,16 +550,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "LinkerPatch") @@ -591,8 +576,9 @@ async def _update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -625,7 +611,7 @@ async def begin_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.LinkerResource]: - """Operation to update an existing Linker. + """Operation to update an existing link. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. @@ -661,7 +647,7 @@ async def begin_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.LinkerResource]: - """Operation to update an existing Linker. + """Operation to update an existing link. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. @@ -691,14 +677,14 @@ async def begin_update( 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. + """Operation to update an existing 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 - :param parameters: Linker details. Is either a model type or a IO type. Required. + :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. @@ -719,9 +705,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -781,9 +765,7 @@ async def _validate_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -797,8 +779,9 @@ async def _validate_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -825,7 +808,7 @@ async def _validate_initial( 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. @@ -849,9 +832,7 @@ async def begin_validate( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -876,7 +857,8 @@ def get_long_running_output(pipeline_response): 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()) @@ -898,8 +880,8 @@ def get_long_running_output(pipeline_response): @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. @@ -907,8 +889,8 @@ async def list_configurations( :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 = { @@ -922,10 +904,8 @@ async def list_configurations( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ConfigurationResult] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SourceConfigurationResult] = kwargs.pop("cls", None) request = build_list_configurations_request( resource_uri=resource_uri, @@ -938,8 +918,9 @@ async def list_configurations( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -949,7 +930,7 @@ 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, {}) 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 25aa290694a2d..0000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linkers_operations.py +++ /dev/null @@ -1,854 +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. -# -------------------------------------------------------------------------- -import sys -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_dryrun_request, - build_update_dryrun_request, -) - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -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: Literal["2022-11-01-preview"] = 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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: Literal["2022-11-01-preview"] = 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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: Literal["2022-11-01-preview"] = 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, (IO, 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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 model 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: Literal["2022-11-01-preview"] = 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: Literal["2022-11-01-preview"] = 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, (IO, 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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 model 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: Literal["2022-11-01-preview"] = 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: Literal["2022-11-01-preview"] = 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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 model 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: Literal["2022-11-01-preview"] = 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, (IO, 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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" - } 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 27c38f1b97828..672ca4560ab86 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,9 +64,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { @@ -122,8 +115,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 aaa1b77d5a887..5c735956e364e 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,72 +6,46 @@ # 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 ConfluentBootstrapServer from ._models_py3 import ConfluentSchemaRegistry -from ._models_py3 import CreateOrUpdateDryrunParameters -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 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 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 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 Origin from ._service_linker_management_client_enums import SecretType from ._service_linker_management_client_enums import TargetServiceType @@ -82,71 +56,45 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "AccessKeyInfoBase", "AuthInfoBase", "AzureKeyVaultProperties", "AzureResource", "AzureResourcePropertiesBase", - "BasicErrorDryrunPrerequisiteResult", - "ConfigurationInfo", - "ConfigurationName", - "ConfigurationNameItem", - "ConfigurationNameResult", - "ConfigurationResult", "ConfluentBootstrapServer", "ConfluentSchemaRegistry", - "CreateOrUpdateDryrunParameters", - "DatabaseAadAuthInfo", - "DryrunList", - "DryrunOperationPreview", - "DryrunParameters", - "DryrunPatch", - "DryrunPrerequisiteResult", - "DryrunResource", "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", "AuthType", "AzureResourceType", "ClientType", "CreatedByType", - "DeleteOrUpdateBehavior", - "DryrunActionName", - "DryrunPrerequisiteResultType", - "DryrunPreviewOperationType", "Origin", "SecretType", "TargetServiceType", 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 e24a2dd6129e4..7ba3ffec9b53f 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 Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, List, Optional, TYPE_CHECKING, Union from .. import _serialization @@ -21,15 +21,13 @@ 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, SecretAuthInfo, ServicePrincipalCertificateAuthInfo, - ServicePrincipalSecretAuthInfo, SystemAssignedIdentityAuthInfo, UserAccountAuthInfo, - UserAssignedIdentityAuthInfo + SecretAuthInfo, ServicePrincipalCertificateAuthInfo, ServicePrincipalSecretAuthInfo, + SystemAssignedIdentityAuthInfo, UserAssignedIdentityAuthInfo 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", and "userAccount". + "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", and "secret". :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType """ @@ -43,58 +41,20 @@ class AuthInfoBase(_serialization.Model): _subtype_map = { "auth_type": { - "accessKey": "AccessKeyInfoBase", "secret": "SecretAuthInfo", "servicePrincipalCertificate": "ServicePrincipalCertificateAuthInfo", "servicePrincipalSecret": "ServicePrincipalSecretAuthInfo", "systemAssignedIdentity": "SystemAssignedIdentityAuthInfo", - "userAccount": "UserAccountAuthInfo", "userAssignedIdentity": "UserAssignedIdentityAuthInfo", } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.auth_type: Optional[str] = None -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", and "userAccount". - :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType - :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"}, - "permissions": {"key": "permissions", "type": "[str]"}, - } - - def __init__(self, *, permissions: Optional[List[Union[str, "_models.AccessKeyPermissions"]]] = None, **kwargs): - """ - :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__(**kwargs) - self.auth_type: str = "accessKey" - self.permissions = permissions - - class AzureResourcePropertiesBase(_serialization.Model): """The azure resource properties. @@ -117,7 +77,7 @@ class AzureResourcePropertiesBase(_serialization.Model): _subtype_map = {"type": {"KeyVault": "AzureKeyVaultProperties"}} - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type: Optional[str] = None @@ -143,7 +103,7 @@ class AzureKeyVaultProperties(AzureResourcePropertiesBase): "connect_as_kubernetes_csi_driver": {"key": "connectAsKubernetesCsiDriver", "type": "bool"}, } - def __init__(self, *, connect_as_kubernetes_csi_driver: Optional[bool] = None, **kwargs): + 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 @@ -157,12 +117,12 @@ 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 + AzureResource, ConfluentBootstrapServer, 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". + "ConfluentBootstrapServer", and "ConfluentSchemaRegistry". :vartype type: str or ~azure.mgmt.servicelinker.models.TargetServiceType """ @@ -179,11 +139,10 @@ class TargetServiceBase(_serialization.Model): "AzureResource": "AzureResource", "ConfluentBootstrapServer": "ConfluentBootstrapServer", "ConfluentSchemaRegistry": "ConfluentSchemaRegistry", - "SelfHostedServer": "SelfHostedServer", } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type: Optional[str] = None @@ -195,7 +154,7 @@ class AzureResource(TargetServiceBase): 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". + "ConfluentBootstrapServer", and "ConfluentSchemaRegistry". :vartype type: str or ~azure.mgmt.servicelinker.models.TargetServiceType :ivar id: The Id of azure resource. :vartype id: str @@ -218,8 +177,8 @@ def __init__( *, id: Optional[str] = None, # pylint: disable=redefined-builtin resource_properties: Optional["_models.AzureResourcePropertiesBase"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The Id of azure resource. :paramtype id: str @@ -232,276 +191,13 @@ def __init__( 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): - """ """ - 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): - """ - :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 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] - """ - - _attribute_map = { - "delete_or_update_behavior": {"key": "deleteOrUpdateBehavior", "type": "str"}, - "action": {"key": "action", "type": "str"}, - "customized_keys": {"key": "customizedKeys", "type": "{str}"}, - "additional_configurations": {"key": "additionalConfigurations", "type": "{str}"}, - } - - 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, - additional_configurations: Optional[Dict[str, str]] = None, - **kwargs - ): - """ - :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 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] - """ - super().__init__(**kwargs) - self.delete_or_update_behavior = delete_or_update_behavior - self.action = action - self.customized_keys = customized_keys - self.additional_configurations = additional_configurations - - -class ConfigurationName(_serialization.Model): - """The configuration names. - - :ivar value: - :vartype value: str - :ivar description: Description for the configuration name. - :vartype description: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__(self, *, value: Optional[str] = None, description: Optional[str] = None, **kwargs): - """ - :keyword value: - :paramtype value: str - :keyword description: Description for the configuration name. - :paramtype description: str - """ - super().__init__(**kwargs) - self.value = value - self.description = description - - -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", and - "kafka-springBoot". - :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", and "userAccount". - :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType - :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"}, - "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, - names: Optional[List["_models.ConfigurationName"]] = None, - **kwargs - ): - """ - :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", and - "kafka-springBoot". - :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", and "userAccount". - :paramtype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType - :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.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): - """ - :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): - """ - :keyword configurations: The configuration properties for source resource. - :paramtype configurations: list[~azure.mgmt.servicelinker.models.SourceConfiguration] - """ - super().__init__(**kwargs) - self.configurations = configurations - - 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". + "ConfluentBootstrapServer", and "ConfluentSchemaRegistry". :vartype type: str or ~azure.mgmt.servicelinker.models.TargetServiceType :ivar endpoint: The endpoint of service. :vartype endpoint: str @@ -516,7 +212,7 @@ class ConfluentBootstrapServer(TargetServiceBase): "endpoint": {"key": "endpoint", "type": "str"}, } - def __init__(self, *, endpoint: Optional[str] = None, **kwargs): + def __init__(self, *, endpoint: Optional[str] = None, **kwargs: Any) -> None: """ :keyword endpoint: The endpoint of service. :paramtype endpoint: str @@ -532,7 +228,7 @@ class ConfluentSchemaRegistry(TargetServiceBase): 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". + "ConfluentBootstrapServer", and "ConfluentSchemaRegistry". :vartype type: str or ~azure.mgmt.servicelinker.models.TargetServiceType :ivar endpoint: The endpoint of service. :vartype endpoint: str @@ -547,519 +243,14 @@ class ConfluentSchemaRegistry(TargetServiceBase): "endpoint": {"key": "endpoint", "type": "str"}, } - def __init__(self, *, endpoint: Optional[str] = None, **kwargs): + 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", and "kafka-springBoot". - :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 - ): - """ - :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", 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 - :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): - """ """ - 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", and "kafka-springBoot". - :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 - ): - """ - :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", 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 - :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 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): - """ - :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] - """ - - _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 - ): - """ - :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 DryrunOperationPreview(_serialization.Model): - """The preview of the operations for creation. - - :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 - """ - - _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"}, - } - - 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 - ): - """ - :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 - """ - super().__init__(**kwargs) - self.name = name - self.operation_type = operation_type - self.description = description - self.action = action - self.scope = scope - - -class DryrunPatch(_serialization.Model): - """a dryrun job to be updated. - - Variables are only populated by the server, and will be ignored when sending a request. - - :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 - """ - - _validation = { - "prerequisite_results": {"readonly": True}, - "operation_previews": {"readonly": True}, - "provisioning_state": {"readonly": 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"}, - } - - def __init__(self, *, parameters: Optional["_models.DryrunParameters"] = None, **kwargs): - """ - :keyword parameters: The parameters of the dryrun. - :paramtype parameters: ~azure.mgmt.servicelinker.models.DryrunParameters - """ - super().__init__(**kwargs) - self.parameters = parameters - self.prerequisite_results = None - self.operation_previews = None - self.provisioning_state = None - - -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}. - :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 - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = 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}. - :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 - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - - -class DryrunResource(ProxyResource): - """a dryrun job resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar 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 - """ - - _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}, - } - - _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"}, - } - - def __init__(self, *, parameters: Optional["_models.DryrunParameters"] = None, **kwargs): - """ - :keyword parameters: The parameters of the dryrun. - :paramtype parameters: ~azure.mgmt.servicelinker.models.DryrunParameters + :paramtype endpoint: str """ super().__init__(**kwargs) - self.parameters = parameters - self.prerequisite_results = None - self.operation_previews = None - self.provisioning_state = None + self.type: str = "ConfluentSchemaRegistry" + self.endpoint = endpoint class ErrorAdditionalInfo(_serialization.Model): @@ -1083,7 +274,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -1123,7 +314,7 @@ class ErrorDetail(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -1134,7 +325,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). :ivar error: The error object. :vartype error: ~azure.mgmt.servicelinker.models.ErrorDetail @@ -1144,7 +336,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.servicelinker.models.ErrorDetail @@ -1153,53 +345,6 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): 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 - ): - """ - :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. @@ -1229,14 +374,16 @@ class SecretInfoBase(_serialization.Model): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.secret_type: Optional[str] = None class KeyVaultSecretReferenceSecretInfo(SecretInfoBase): - """The secret info when type is keyVaultSecretReference. It's for scenario that user provides a secret stored in user's keyvault and source is Azure Kubernetes. The key Vault's resource id is linked to secretStore.keyVaultId. + """The secret info when type is keyVaultSecretReference. It's for scenario that user provides a + 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. @@ -1259,7 +406,7 @@ class KeyVaultSecretReferenceSecretInfo(SecretInfoBase): "version": {"key": "version", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, version: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, version: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: Name of the Key Vault secret. :paramtype name: str @@ -1273,7 +420,8 @@ def __init__(self, *, name: Optional[str] = None, version: Optional[str] = None, 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. + """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. @@ -1293,7 +441,7 @@ class KeyVaultSecretUriSecretInfo(SecretInfoBase): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: URI to the keyvault secret. :paramtype value: str @@ -1303,8 +451,36 @@ def __init__(self, *, value: Optional[str] = None, **kwargs): 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, *, next_link: Optional[str] = None, value: Optional[List["_models.LinkerResource"]] = None, **kwargs: Any + ) -> None: + """ + :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.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. @@ -1323,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 = { @@ -1342,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__( @@ -1355,10 +524,8 @@ 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 - ): + **kwargs: Any + ) -> None: """ :keyword target_service: The target service properties. :paramtype target_service: ~azure.mgmt.servicelinker.models.TargetServiceBase @@ -1373,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 @@ -1387,8 +549,74 @@ 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}. + :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}. + :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) class LinkerResource(ProxyResource): # pylint: disable=too-many-instance-attributes @@ -1404,8 +632,7 @@ class LinkerResource(ProxyResource): # pylint: disable=too-many-instance-attrib :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 @@ -1422,11 +649,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 = { @@ -1449,8 +671,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__( @@ -1462,10 +682,8 @@ 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 - ): + **kwargs: Any + ) -> None: """ :keyword target_service: The target service properties. :paramtype target_service: ~azure.mgmt.servicelinker.models.TargetServiceBase @@ -1480,13 +698,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 @@ -1494,8 +708,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): @@ -1516,7 +728,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 """ @@ -1535,7 +747,7 @@ class Operation(_serialization.Model): "action_type": {"key": "actionType", "type": "str"}, } - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: Localized display information for this particular operation. :paramtype display: ~azure.mgmt.servicelinker.models.OperationDisplay @@ -1581,7 +793,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -1591,7 +803,8 @@ def __init__(self, **kwargs): class OperationListResult(_serialization.Model): - """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link + to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -1611,150 +824,20 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = 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 - ): - """ - :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 - ): - """ - :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 - ): - """ - :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. :ivar auth_type: The authentication type. Required. Known values are: "systemAssignedIdentity", - "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret", - "accessKey", and "userAccount". + "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", and "secret". :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType :ivar name: Username or account name for secret auth. :vartype name: str @@ -1772,7 +855,9 @@ class SecretAuthInfo(AuthInfoBase): "secret_info": {"key": "secretInfo", "type": "SecretInfoBase"}, } - def __init__(self, *, name: Optional[str] = None, secret_info: Optional["_models.SecretInfoBase"] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, secret_info: Optional["_models.SecretInfoBase"] = None, **kwargs: Any + ) -> None: """ :keyword name: Username or account name for secret auth. :paramtype name: str @@ -1790,58 +875,19 @@ 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): + 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): - """ - :keyword endpoint: The endpoint of service. - :paramtype endpoint: str - """ - super().__init__(**kwargs) - self.type: str = "SelfHostedServer" - self.endpoint = endpoint class ServicePrincipalCertificateAuthInfo(AuthInfoBase): @@ -1850,8 +896,7 @@ class ServicePrincipalCertificateAuthInfo(AuthInfoBase): 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", and "userAccount". + "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", and "secret". :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType :ivar client_id: Application clientId for servicePrincipal auth. Required. :vartype client_id: str @@ -1859,12 +904,6 @@ class ServicePrincipalCertificateAuthInfo(AuthInfoBase): :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 = { @@ -1879,20 +918,9 @@ class ServicePrincipalCertificateAuthInfo(AuthInfoBase): "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, - delete_or_update_behavior: Optional[Union[str, "_models.DeleteOrUpdateBehavior"]] = None, - roles: Optional[List[str]] = None, - **kwargs - ): + def __init__(self, *, client_id: str, principal_id: str, certificate: str, **kwargs: Any) -> None: """ :keyword client_id: Application clientId for servicePrincipal auth. Required. :paramtype client_id: str @@ -1900,32 +928,21 @@ def __init__( :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__(**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. - :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", and "userAccount". + "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", and "secret". :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType :ivar client_id: ServicePrincipal application clientId for servicePrincipal auth. Required. :vartype client_id: str @@ -1933,12 +950,6 @@ class ServicePrincipalSecretAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): :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 = { @@ -1949,50 +960,26 @@ class ServicePrincipalSecretAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): } _attribute_map = { - "user_name": {"key": "userName", "type": "str"}, "auth_type": {"key": "authType", "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, - delete_or_update_behavior: Optional[Union[str, "_models.DeleteOrUpdateBehavior"]] = None, - roles: Optional[List[str]] = None, - **kwargs - ): + 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 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__(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 class SourceConfiguration(_serialization.Model): @@ -2009,7 +996,7 @@ class SourceConfiguration(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: The name of setting. :paramtype name: str @@ -2021,23 +1008,34 @@ def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, * self.value = value -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. - :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", and "userAccount". + "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", and "secret". :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType - :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 = { @@ -2045,35 +1043,13 @@ class SystemAssignedIdentityAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): } _attribute_map = { - "user_name": {"key": "userName", "type": "str"}, "auth_type": {"key": "authType", "type": "str"}, - "delete_or_update_behavior": {"key": "deleteOrUpdateBehavior", "type": "str"}, - "roles": {"key": "roles", "type": "[str]"}, } - def __init__( - self, - *, - user_name: Optional[str] = None, - delete_or_update_behavior: Optional[Union[str, "_models.DeleteOrUpdateBehavior"]] = None, - roles: Optional[List[str]] = None, - **kwargs - ): - """ - :keyword user_name: Username created in the database which is mapped to a user in AAD. - :paramtype user_name: 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__(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 class SystemData(_serialization.Model): @@ -2113,8 +1089,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -2140,89 +1116,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", and "userAccount". - :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType - :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"}, - "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, - principal_id: Optional[str] = None, - delete_or_update_behavior: Optional[Union[str, "_models.DeleteOrUpdateBehavior"]] = None, - roles: Optional[List[str]] = None, - **kwargs - ): - """ - :keyword user_name: Username created in the database which is mapped to a user in AAD. - :paramtype user_name: str - :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__(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 - - -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. - :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", and "userAccount". + "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", and "secret". :vartype auth_type: str or ~azure.mgmt.servicelinker.models.AuthType :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 = { @@ -2230,51 +1135,30 @@ class UserAssignedIdentityAuthInfo(AuthInfoBase, DatabaseAadAuthInfo): } _attribute_map = { - "user_name": {"key": "userName", "type": "str"}, "auth_type": {"key": "authType", "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, - 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 - ): + 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 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__(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 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 @@ -2287,13 +1171,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", and "userAccount". + "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] @@ -2325,10 +1208,10 @@ def __init__( target_id: Optional[str] = None, auth_type: Optional[Union[str, "_models.AuthType"]] = None, validation_detail: Optional[List["_models.ValidationResultItem"]] = None, - **kwargs - ): + **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 @@ -2341,13 +1224,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", and "userAccount". + "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] @@ -2366,7 +1248,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 @@ -2396,8 +1278,8 @@ def __init__( result: Optional[Union[str, "_models.ValidationResultStatus"]] = None, error_message: Optional[str] = None, error_code: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The validation item name. :paramtype name: str @@ -2440,7 +1322,7 @@ class ValueSecretInfo(SecretInfoBase): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: The actual value of the secret. :paramtype value: str @@ -2455,32 +1337,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 - ): + 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 ae45bc931eaa2..ba236f109bca7 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,29 +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 AuthType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -43,8 +24,6 @@ class AuthType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SERVICE_PRINCIPAL_SECRET = "servicePrincipalSecret" SERVICE_PRINCIPAL_CERTIFICATE = "servicePrincipalCertificate" SECRET = "secret" - ACCESS_KEY = "accessKey" - USER_ACCOUNT = "userAccount" class AzureResourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -78,36 +57,6 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): KEY = "Key" -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 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". @@ -132,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 80d740a2329ce..6a161b8edd91d 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 5faa1ebc6879a..0000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_configuration_names_operations.py +++ /dev/null @@ -1,177 +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. -# -------------------------------------------------------------------------- -import sys -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 - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_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: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-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: Literal["2022-11-01-preview"] = 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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 fc79258dcc265..0000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_connector_operations.py +++ /dev/null @@ -1,2343 +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. -# -------------------------------------------------------------------------- -import sys -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, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_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: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-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 = _format_url_section(_url, **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: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-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 = _format_url_section(_url, **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: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-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 = _format_url_section(_url, **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: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-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 = _format_url_section(_url, **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: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-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 = _format_url_section(_url, **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: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-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 = _format_url_section(_url, **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: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-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 = _format_url_section(_url, **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: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-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 = _format_url_section(_url, **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: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-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 = _format_url_section(_url, **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: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-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 = _format_url_section(_url, **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: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-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 = _format_url_section(_url, **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: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-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 = _format_url_section(_url, **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: Literal["2022-11-01-preview"] = 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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: Literal["2022-11-01-preview"] = 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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: Literal["2022-11-01-preview"] = 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, (IO, 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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 model 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: Literal["2022-11-01-preview"] = 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: Literal["2022-11-01-preview"] = 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, (IO, 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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 model 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: Literal["2022-11-01-preview"] = 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: Literal["2022-11-01-preview"] = 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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: Literal["2022-11-01-preview"] = 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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: Literal["2022-11-01-preview"] = 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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: Literal["2022-11-01-preview"] = 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, (IO, 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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 model 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: Literal["2022-11-01-preview"] = 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: Literal["2022-11-01-preview"] = 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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: Literal["2022-11-01-preview"] = 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: Literal["2022-11-01-preview"] = 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, (IO, 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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 model 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: Literal["2022-11-01-preview"] = 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: Literal["2022-11-01-preview"] = 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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: Literal["2022-11-01-preview"] = 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 model 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: Literal["2022-11-01-preview"] = 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, (IO, 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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 614b13d06c667..d9a4047d7dc6e 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 @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +43,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: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +52,7 @@ def build_list_request(resource_uri: str, **kwargs: Any) -> HttpRequest: "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,9 +67,7 @@ def build_get_request(resource_uri: str, linker_name: str, **kwargs: Any) -> Htt _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +77,7 @@ def build_get_request(resource_uri: str, linker_name: str, **kwargs: Any) -> Htt "linkerName": _SERIALIZER.url("linker_name", linker_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -100,9 +92,7 @@ def build_create_or_update_request(resource_uri: str, linker_name: str, **kwargs _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -113,7 +103,7 @@ def build_create_or_update_request(resource_uri: str, linker_name: str, **kwargs "linkerName": _SERIALIZER.url("linker_name", linker_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -130,9 +120,7 @@ def build_delete_request(resource_uri: str, linker_name: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -142,7 +130,7 @@ def build_delete_request(resource_uri: str, linker_name: str, **kwargs: Any) -> "linkerName": _SERIALIZER.url("linker_name", linker_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -157,9 +145,7 @@ def build_update_request(resource_uri: str, linker_name: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -170,7 +156,7 @@ def build_update_request(resource_uri: str, linker_name: str, **kwargs: Any) -> "linkerName": _SERIALIZER.url("linker_name", linker_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -187,9 +173,7 @@ def build_validate_request(resource_uri: str, linker_name: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -201,7 +185,7 @@ def build_validate_request(resource_uri: str, linker_name: str, **kwargs: Any) - "linkerName": _SERIALIZER.url("linker_name", linker_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -216,9 +200,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: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -230,7 +212,7 @@ def build_list_configurations_request(resource_uri: str, linker_name: str, **kwa "linkerName": _SERIALIZER.url("linker_name", linker_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -262,8 +244,7 @@ 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. @@ -276,10 +257,8 @@ def list(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.LinkerReso _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ResourceList] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LinkerList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -321,7 +300,7 @@ def prepare_request(next_link=None): 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 @@ -330,8 +309,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -371,9 +351,7 @@ def get(self, resource_uri: str, linker_name: str, **kwargs: Any) -> _models.Lin _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -387,8 +365,9 @@ def get(self, resource_uri: str, linker_name: str, **kwargs: Any) -> _models.Lin 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -421,16 +400,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "LinkerResource") @@ -449,8 +426,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -485,7 +463,7 @@ def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.LinkerResource]: - """Create or update Linker resource. + """Create or update linker resource. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. @@ -521,7 +499,7 @@ def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.LinkerResource]: - """Create or update Linker resource. + """Create or update linker resource. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. @@ -551,14 +529,14 @@ def begin_create_or_update( 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. + """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 model type or a IO type. Required. + :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. @@ -579,9 +557,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -640,9 +616,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -656,8 +630,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -674,7 +649,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements @distributed_trace def begin_delete(self, resource_uri: str, linker_name: str, **kwargs: Any) -> LROPoller[None]: - """Delete a Linker. + """Delete a link. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. @@ -696,9 +671,7 @@ def begin_delete(self, resource_uri: str, linker_name: str, **kwargs: Any) -> LR _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -752,16 +725,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "LinkerPatch") @@ -780,8 +751,9 @@ def _update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -814,7 +786,7 @@ def begin_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.LinkerResource]: - """Operation to update an existing Linker. + """Operation to update an existing link. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. @@ -850,7 +822,7 @@ def begin_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.LinkerResource]: - """Operation to update an existing Linker. + """Operation to update an existing link. :param resource_uri: The fully qualified Azure Resource manager identifier of the resource to be connected. Required. @@ -880,14 +852,14 @@ def begin_update( 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. + """Operation to update an existing 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 - :param parameters: Linker details. Is either a model type or a IO type. Required. + :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. @@ -908,9 +880,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -969,9 +939,7 @@ def _validate_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -985,8 +953,9 @@ def _validate_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1013,7 +982,7 @@ def _validate_initial( 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. @@ -1036,9 +1005,7 @@ def begin_validate( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -1063,7 +1030,7 @@ def get_long_running_output(pipeline_response): 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()) @@ -1083,8 +1050,10 @@ def get_long_running_output(pipeline_response): } @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. @@ -1092,8 +1061,8 @@ def list_configurations(self, resource_uri: str, linker_name: str, **kwargs: Any :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 = { @@ -1107,10 +1076,8 @@ def list_configurations(self, resource_uri: str, linker_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ConfigurationResult] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SourceConfigurationResult] = kwargs.pop("cls", None) request = build_list_configurations_request( resource_uri=resource_uri, @@ -1123,8 +1090,9 @@ def list_configurations(self, resource_uri: str, linker_name: str, **kwargs: Any 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1134,7 +1102,7 @@ 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, {}) 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 fec0c2e128d4a..0000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linkers_operations.py +++ /dev/null @@ -1,1018 +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. -# -------------------------------------------------------------------------- -import sys -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, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_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: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-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 = _format_url_section(_url, **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: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-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 = _format_url_section(_url, **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: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-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 = _format_url_section(_url, **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: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-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 = _format_url_section(_url, **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: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-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 = _format_url_section(_url, **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: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-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 = _format_url_section(_url, **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 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: Literal["2022-11-01-preview"] = 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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: Literal["2022-11-01-preview"] = 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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: Literal["2022-11-01-preview"] = 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, (IO, 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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 model 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: Literal["2022-11-01-preview"] = 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: Literal["2022-11-01-preview"] = 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, (IO, 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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 model 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: Literal["2022-11-01-preview"] = 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: Literal["2022-11-01-preview"] = 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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 model 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: Literal["2022-11-01-preview"] = 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, (IO, 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.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" - } 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 3521a31d7e2e3..96466e21d5f88 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +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: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-11-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,9 +86,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { @@ -146,8 +137,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 d981f77a84c8d..0000000000000 --- 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/2022-11-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 82d00a60727c3..0000000000000 --- 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/2022-11-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 2c046d96e7060..0000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/connector_dryrun_delete.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_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(), - ) - - response = client.connector.delete_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/2022-11-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 ae13d8533db10..0000000000000 --- 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/2022-11-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 bb8eaaca762d9..0000000000000 --- 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/2022-11-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 4467b57186755..0000000000000 --- 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/2022-11-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 aab572dfd2638..0000000000000 --- 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/2022-11-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 adb19e3adf45a..0000000000000 --- 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/2022-11-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 811175603563b..0000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_connector.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 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(), - ) - - response = client.connector.begin_delete( - 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/2022-11-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 800955ff63428..0000000000000 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_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 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(), - ) - - response = client.linkers.delete_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/2022-11-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_link.py similarity index 89% rename from sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_linker.py rename to sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_link.py index e91d30ca6f6e4..753698699e210 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_linker.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/delete_link.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-servicelinker # USAGE - python delete_linker.py + python delete_link.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, @@ -28,13 +28,12 @@ def main(): credential=DefaultAzureCredential(), ) - response = client.linker.begin_delete( + 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() - print(response) -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/DeleteLinker.json +# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2024-02-01/examples/DeleteLink.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 77cc2ee74becd..0000000000000 --- 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/2022-11-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 1477174dc2982..687889d344688 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_configurations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/get_configurations.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/GetConfigurations.json +# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2024-02-01/examples/GetConfigurations.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 dfc22faeb1e14..0000000000000 --- 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/2022-11-01-preview/examples/GetDryrun.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/link.py similarity index 93% rename from sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker.py rename to sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/link.py index b224b0466d78a..80b1becf1a228 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/link.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-servicelinker # USAGE - python linker.py + python link.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 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/Linker.json +# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2024-02-01/examples/Link.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 9e2244cbc26e3..e19ba4a5dae47 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/linker_list.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/link_list.py @@ -14,7 +14,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 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/LinkerList.json +# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2024-02-01/examples/LinkList.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 8036dc8e62fa3..0000000000000 --- 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/2022-11-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 84db1b94bec63..0000000000000 --- 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/2022-11-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 e7ad4ed8f1945..6ad06bd1a0f23 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/operations_list.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/operations_list.py @@ -33,6 +33,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/OperationsList.json +# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2024-02-01/examples/OperationsList.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 f112337044001..0000000000000 --- 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/2022-11-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_link.py similarity index 95% rename from sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_linker.py rename to sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_link.py index 89bc8bbaa5a47..72eb42be0010d 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_linker.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_link.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-servicelinker # USAGE - python patch_linker.py + python patch_link.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, @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/PatchLinker.json +# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2024-02-01/examples/PatchLink.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 706dc83da6ce3..0000000000000 --- 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/2022-11-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_link.py similarity index 92% rename from sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_linker.py rename to sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_link.py index b9933b4c0513d..9886acb132c1d 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_linker.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_link.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-servicelinker # USAGE - python put_linker.py + python put_link.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, @@ -42,13 +42,12 @@ def main(): "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/2022-11-01-preview/examples/PutLinker.json +# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2024-02-01/examples/PutLink.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_link_with_secret_store.py similarity index 84% rename from sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_connector.py rename to sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_link_with_secret_store.py index be6cd1e62bbb0..f72b2220eed75 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_connector.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_link_with_secret_store.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-servicelinker # USAGE - python put_connector.py + python put_link_with_secret_store.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, @@ -28,11 +28,9 @@ def main(): 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", + 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"}, @@ -49,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/PutConnector.json +# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2024-02-01/examples/PutLinkWithSecretStore.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/put_link_with_service_endpoint.py similarity index 65% rename from sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_connector.py rename to sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_link_with_service_endpoint.py index 7caaf1938f733..c4487fb7e4a1a 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/patch_connector.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/generated_samples/put_link_with_service_endpoint.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-servicelinker # USAGE - python patch_connector.py + python put_link_with_service_endpoint.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, @@ -28,29 +28,30 @@ def main(): credential=DefaultAzureCredential(), ) - response = client.connector.begin_update( - subscription_id="00000000-0000-0000-0000-000000000000", - resource_group_name="test-rg", - location="westus", - connector_name="connectorName", + 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": "servicePrincipalSecret", - "clientId": "name", - "principalId": "id", - "secret": "secret", + "authType": "secret", + "name": "name", + "secretInfo": { + "secretType": "keyVaultSecretUri", + "value": "https://vault-name.vault.azure.net/secrets/secret-name/00000000000000000000000000000000", + }, }, "targetService": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db", + "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/2022-11-01-preview/examples/PatchConnector.json +# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2024-02-01/examples/PutLinkWithServiceEndpoint.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 1f848782d4413..0000000000000 --- 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/2022-11-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 051101a147951..4fda0ae703ccc 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 @@ -14,7 +14,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 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2022-11-01-preview/examples/ValidateLinkerSuccess.json +# x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2024-02-01/examples/ValidateLinkSuccess.json if __name__ == "__main__": main()