diff --git a/sdk/chaos/azure-mgmt-chaos/_meta.json b/sdk/chaos/azure-mgmt-chaos/_meta.json index 541aeb069cf3..0a568d4a1f6a 100644 --- a/sdk/chaos/azure-mgmt-chaos/_meta.json +++ b/sdk/chaos/azure-mgmt-chaos/_meta.json @@ -1,11 +1,11 @@ { - "commit": "2647ee494ecbe4668bdf16486207fecd67843e57", + "commit": "80b90858fc5c283feefd8b7760304adf4b972f73", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.7", + "@autorest/python@6.4.8", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/chaos/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/chaos/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.4.8 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/chaos/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_chaos_management_client.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_chaos_management_client.py index cefe4d4c2215..e43d5ab0241f 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_chaos_management_client.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_chaos_management_client.py @@ -50,7 +50,7 @@ class ChaosManagementClient: # pylint: disable=client-accepts-api-version-keywo :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-10-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-04-15-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -65,7 +65,7 @@ def __init__( self._config = ChaosManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **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) @@ -109,5 +109,5 @@ def __enter__(self) -> "ChaosManagementClient": 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/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_configuration.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_configuration.py index 12032398ec08..7eee35c4a03d 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_configuration.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_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 @@ -35,14 +29,14 @@ class ChaosManagementClientConfiguration(Configuration): # pylint: disable=too- :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: GUID that represents an Azure subscription ID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-10-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-04-15-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ChaosManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-10-01-preview"] = kwargs.pop("api_version", "2022-10-01-preview") + api_version: str = kwargs.pop("api_version", "2023-04-15-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_serialization.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_serialization.py index 2c170e28dbca..842ae727fbbc 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_serialization.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_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 @@ -656,8 +682,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: @@ -777,6 +803,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) @@ -1161,7 +1189,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 +1271,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 +1295,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 +1361,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 +1381,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 +1500,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 +1515,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 +1525,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/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_vendor.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_vendor.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_version.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_version.py index 28e175fcb7b7..9cf33092d41b 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_version.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b6" +VERSION = "1.0.0b5" diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/_chaos_management_client.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/_chaos_management_client.py index 0d910d1c300a..dd22e0db0248 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/_chaos_management_client.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/_chaos_management_client.py @@ -50,7 +50,7 @@ class ChaosManagementClient: # pylint: disable=client-accepts-api-version-keywo :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-10-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-04-15-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -65,7 +65,7 @@ def __init__( self._config = ChaosManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **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) @@ -109,5 +109,5 @@ async def __aenter__(self) -> "ChaosManagementClient": 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/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/_configuration.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/_configuration.py index d5006e7ab993..8a7f7c0ea16e 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/_configuration.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/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 @@ -35,14 +29,14 @@ class ChaosManagementClientConfiguration(Configuration): # pylint: disable=too- :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: GUID that represents an Azure subscription ID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-10-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-04-15-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(ChaosManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-10-01-preview"] = kwargs.pop("api_version", "2022-10-01-preview") + api_version: str = kwargs.pop("api_version", "2023-04-15-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_capabilities_operations.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_capabilities_operations.py index 1f9ed6225f15..39e697659166 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_capabilities_operations.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_capabilities_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, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -36,10 +35,6 @@ 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]] @@ -98,9 +93,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.CapabilityListResult] = kwargs.pop("cls", None) error_map = { @@ -158,8 +151,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 @@ -218,9 +212,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.Capability] = kwargs.pop("cls", None) request = build_get_request( @@ -239,8 +231,9 @@ async def get( 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 @@ -303,9 +296,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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( @@ -324,8 +315,9 @@ async def delete( # 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 @@ -449,8 +441,8 @@ async def create_or_update( :type target_name: str :param capability_name: String that represents a Capability resource name. Required. :type capability_name: str - :param capability: Capability resource to be created or updated. Is either a model type or a IO - type. Required. + :param capability: Capability resource to be created or updated. Is either a Capability type or + a IO type. Required. :type capability: ~azure.mgmt.chaos.models.Capability or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -471,9 +463,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.Capability] = kwargs.pop("cls", None) @@ -504,8 +494,9 @@ async def create_or_update( 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 diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_capability_types_operations.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_capability_types_operations.py index 2cbc84d27bdd..1a47b0f8e4e5 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_capability_types_operations.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_capability_types_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 @@ -31,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._capability_types_operations import build_get_request, build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,9 +78,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.CapabilityTypeListResult] = kwargs.pop("cls", None) error_map = { @@ -140,8 +133,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 @@ -186,9 +180,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.CapabilityType] = kwargs.pop("cls", None) request = build_get_request( @@ -204,8 +196,9 @@ async def get( 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 diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_experiments_operations.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_experiments_operations.py index ee09c2c61be9..6694fde1601a 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_experiments_operations.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_experiments_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, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -41,12 +40,9 @@ build_list_execution_details_request, build_list_request, build_start_request, + build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -91,9 +87,7 @@ def list_all( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.ExperimentListResult] = kwargs.pop("cls", None) error_map = { @@ -147,8 +141,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 @@ -190,9 +185,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.ExperimentListResult] = kwargs.pop("cls", None) error_map = { @@ -247,8 +240,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 @@ -291,9 +285,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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( @@ -308,8 +300,9 @@ async def delete( # 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 @@ -350,9 +343,7 @@ async def get(self, resource_group_name: str, experiment_name: str, **kwargs: An _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.Experiment] = kwargs.pop("cls", None) request = build_get_request( @@ -367,8 +358,9 @@ async def get(self, resource_group_name: str, experiment_name: str, **kwargs: An 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 @@ -453,8 +445,8 @@ async def create_or_update( :type resource_group_name: str :param experiment_name: String that represents a Experiment resource name. Required. :type experiment_name: str - :param experiment: Experiment resource to be created or updated. Is either a model type or a IO - type. Required. + :param experiment: Experiment resource to be created or updated. Is either a Experiment type or + a IO type. Required. :type experiment: ~azure.mgmt.chaos.models.Experiment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -475,9 +467,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.Experiment] = kwargs.pop("cls", None) @@ -504,8 +494,9 @@ async def create_or_update( 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 @@ -526,6 +517,146 @@ async def create_or_update( "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}" } + @overload + async def update( + self, + resource_group_name: str, + experiment_name: str, + experiment: _models.ExperimentUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Experiment: + """The operation to update an experiment. + + :param resource_group_name: String that represents an Azure resource group. Required. + :type resource_group_name: str + :param experiment_name: String that represents a Experiment resource name. Required. + :type experiment_name: str + :param experiment: Parameters supplied to the Update experiment operation. Required. + :type experiment: ~azure.mgmt.chaos.models.ExperimentUpdate + :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: Experiment or the result of cls(response) + :rtype: ~azure.mgmt.chaos.models.Experiment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + experiment_name: str, + experiment: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Experiment: + """The operation to update an experiment. + + :param resource_group_name: String that represents an Azure resource group. Required. + :type resource_group_name: str + :param experiment_name: String that represents a Experiment resource name. Required. + :type experiment_name: str + :param experiment: Parameters supplied to the Update experiment operation. Required. + :type experiment: 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: Experiment or the result of cls(response) + :rtype: ~azure.mgmt.chaos.models.Experiment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + experiment_name: str, + experiment: Union[_models.ExperimentUpdate, IO], + **kwargs: Any + ) -> _models.Experiment: + """The operation to update an experiment. + + :param resource_group_name: String that represents an Azure resource group. Required. + :type resource_group_name: str + :param experiment_name: String that represents a Experiment resource name. Required. + :type experiment_name: str + :param experiment: Parameters supplied to the Update experiment operation. Is either a + ExperimentUpdate type or a IO type. Required. + :type experiment: ~azure.mgmt.chaos.models.ExperimentUpdate 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: Experiment or the result of cls(response) + :rtype: ~azure.mgmt.chaos.models.Experiment + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Experiment] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(experiment, (IO, bytes)): + _content = experiment + else: + _json = self._serialize.body(experiment, "ExperimentUpdate") + + request = build_update_request( + resource_group_name=resource_group_name, + experiment_name=experiment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Experiment", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}" + } + @distributed_trace_async async def cancel( self, resource_group_name: str, experiment_name: str, **kwargs: Any @@ -552,9 +683,7 @@ async def cancel( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.ExperimentCancelOperationResult] = kwargs.pop("cls", None) request = build_cancel_request( @@ -569,8 +698,9 @@ async def cancel( 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 @@ -617,9 +747,7 @@ async def start( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.ExperimentStartOperationResult] = kwargs.pop("cls", None) request = build_start_request( @@ -634,8 +762,9 @@ async def start( 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 @@ -674,9 +803,7 @@ def list_all_statuses( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.ExperimentStatusListResult] = kwargs.pop("cls", None) error_map = { @@ -730,8 +857,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 @@ -776,9 +904,7 @@ async def get_status( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.ExperimentStatus] = kwargs.pop("cls", None) request = build_get_status_request( @@ -794,8 +920,9 @@ async def get_status( 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 @@ -836,9 +963,7 @@ def list_execution_details( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.ExperimentExecutionDetailsListResult] = kwargs.pop("cls", None) error_map = { @@ -892,8 +1017,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 @@ -938,9 +1064,7 @@ async def get_execution_details( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.ExperimentExecutionDetails] = kwargs.pop("cls", None) request = build_get_execution_details_request( @@ -956,8 +1080,9 @@ async def get_execution_details( 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 diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_operations.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_operations.py index 5dd3600a4b76..43c0057dce22 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_operations.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/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_all_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_all(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_target_types_operations.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_target_types_operations.py index 6ca20dfb950a..c518a3f6cf31 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_target_types_operations.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_target_types_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 @@ -31,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._target_types_operations import build_get_request, build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,9 +72,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.TargetTypeListResult] = kwargs.pop("cls", None) error_map = { @@ -133,8 +126,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 @@ -175,9 +169,7 @@ async def get(self, location_name: str, target_type_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.TargetType] = kwargs.pop("cls", None) request = build_get_request( @@ -192,8 +184,9 @@ async def get(self, location_name: str, target_type_name: str, **kwargs: Any) -> 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 diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_targets_operations.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_targets_operations.py index c9b706784b13..3ae8f9939bdc 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_targets_operations.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_targets_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, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -36,10 +35,6 @@ build_list_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -95,9 +90,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.TargetListResult] = kwargs.pop("cls", None) error_map = { @@ -154,8 +147,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 @@ -211,9 +205,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.Target] = kwargs.pop("cls", None) request = build_get_request( @@ -231,8 +223,9 @@ async def get( 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 @@ -292,9 +285,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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( @@ -312,8 +303,9 @@ async def delete( # 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 @@ -428,7 +420,7 @@ async def create_or_update( :type parent_resource_name: str :param target_name: String that represents a Target resource name. Required. :type target_name: str - :param target: Target resource to be created or updated. Is either a model type or a IO type. + :param target: Target resource to be created or updated. Is either a Target type or a IO type. Required. :type target: ~azure.mgmt.chaos.models.Target or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -450,9 +442,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.Target] = kwargs.pop("cls", None) @@ -482,8 +472,9 @@ async def create_or_update( 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 diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/models/__init__.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/models/__init__.py index 1956585ce37e..27cc462a1574 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/models/__init__.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/models/__init__.py @@ -32,11 +32,14 @@ from ._models_py3 import ExperimentStartOperationResult from ._models_py3 import ExperimentStatus from ._models_py3 import ExperimentStatusListResult +from ._models_py3 import ExperimentUpdate from ._models_py3 import Filter from ._models_py3 import KeyValuePair +from ._models_py3 import ListSelector from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import OperationListResult +from ._models_py3 import QuerySelector from ._models_py3 import Resource from ._models_py3 import ResourceIdentity from ._models_py3 import Selector @@ -51,6 +54,7 @@ from ._models_py3 import TargetType from ._models_py3 import TargetTypeListResult from ._models_py3 import TrackedResource +from ._models_py3 import UserAssignedIdentity from ._chaos_management_client_enums import ActionType from ._chaos_management_client_enums import CreatedByType @@ -58,6 +62,7 @@ from ._chaos_management_client_enums import Origin from ._chaos_management_client_enums import ResourceIdentityType from ._chaos_management_client_enums import SelectorType +from ._chaos_management_client_enums import TargetReferenceType from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk @@ -89,11 +94,14 @@ "ExperimentStartOperationResult", "ExperimentStatus", "ExperimentStatusListResult", + "ExperimentUpdate", "Filter", "KeyValuePair", + "ListSelector", "Operation", "OperationDisplay", "OperationListResult", + "QuerySelector", "Resource", "ResourceIdentity", "Selector", @@ -108,12 +116,14 @@ "TargetType", "TargetTypeListResult", "TrackedResource", + "UserAssignedIdentity", "ActionType", "CreatedByType", "FilterType", "Origin", "ResourceIdentityType", "SelectorType", + "TargetReferenceType", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/models/_chaos_management_client_enums.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/models/_chaos_management_client_enums.py index c2c4299f69ea..211ebcf4e38c 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/models/_chaos_management_client_enums.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/models/_chaos_management_client_enums.py @@ -46,12 +46,17 @@ class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): NONE = "None" SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" class SelectorType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enum of the selector type.""" - PERCENT = "Percent" - RANDOM = "Random" - TAG = "Tag" LIST = "List" + QUERY = "Query" + + +class TargetReferenceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum of the Target reference type.""" + + CHAOS_TARGET = "ChaosTarget" diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/models/_models_py3.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/models/_models_py3.py index 177bbcebfc75..aab50b9d4793 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/models/_models_py3.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/models/_models_py3.py @@ -43,7 +43,7 @@ class Action(_serialization.Model): _subtype_map = {"type": {"continuous": "ContinuousAction", "delay": "DelayAction", "discrete": "DiscreteAction"}} - def __init__(self, *, name: str, **kwargs): + def __init__(self, *, name: str, **kwargs: Any) -> None: """ :keyword name: String that represents a Capability URN. Required. :paramtype name: str @@ -91,7 +91,7 @@ class ActionStatus(_serialization.Model): "targets": {"key": "targets", "type": "[ExperimentExecutionActionTargetDetailsProperties]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.action_name = None @@ -123,7 +123,7 @@ class Branch(_serialization.Model): "actions": {"key": "actions", "type": "[Action]"}, } - def __init__(self, *, name: str, actions: List["_models.Action"], **kwargs): + def __init__(self, *, name: str, actions: List["_models.Action"], **kwargs: Any) -> None: """ :keyword name: String of the branch name. Required. :paramtype name: str @@ -164,7 +164,7 @@ class BranchStatus(_serialization.Model): "actions": {"key": "actions", "type": "[ActionStatus]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.branch_name = None @@ -200,7 +200,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -259,7 +259,7 @@ class Capability(Resource): "urn": {"key": "properties.urn", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.system_data = None @@ -291,7 +291,7 @@ class CapabilityListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -329,6 +329,10 @@ class CapabilityType(Resource): # pylint: disable=too-many-instance-attributes :vartype urn: str :ivar kind: String of the kind of this Capability Type. :vartype kind: str + :ivar azure_rbac_actions: Control plane actions necessary to execute capability type. + :vartype azure_rbac_actions: list[str] + :ivar azure_rbac_data_actions: Data plane actions necessary to execute capability type. + :vartype azure_rbac_data_actions: list[str] :ivar runtime_properties: Runtime properties of this Capability Type. :vartype runtime_properties: ~azure.mgmt.chaos.models.CapabilityTypePropertiesRuntimeProperties """ @@ -360,6 +364,8 @@ class CapabilityType(Resource): # pylint: disable=too-many-instance-attributes "parameters_schema": {"key": "properties.parametersSchema", "type": "str"}, "urn": {"key": "properties.urn", "type": "str"}, "kind": {"key": "properties.kind", "type": "str"}, + "azure_rbac_actions": {"key": "properties.azureRBACActions", "type": "[str]"}, + "azure_rbac_data_actions": {"key": "properties.azureRBACDataActions", "type": "[str]"}, "runtime_properties": { "key": "properties.runtimeProperties", "type": "CapabilityTypePropertiesRuntimeProperties", @@ -370,12 +376,18 @@ def __init__( self, *, location: Optional[str] = None, + azure_rbac_actions: Optional[List[str]] = None, + azure_rbac_data_actions: Optional[List[str]] = None, runtime_properties: Optional["_models.CapabilityTypePropertiesRuntimeProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Location of the Capability Type resource. :paramtype location: str + :keyword azure_rbac_actions: Control plane actions necessary to execute capability type. + :paramtype azure_rbac_actions: list[str] + :keyword azure_rbac_data_actions: Data plane actions necessary to execute capability type. + :paramtype azure_rbac_data_actions: list[str] :keyword runtime_properties: Runtime properties of this Capability Type. :paramtype runtime_properties: ~azure.mgmt.chaos.models.CapabilityTypePropertiesRuntimeProperties @@ -390,6 +402,8 @@ def __init__( self.parameters_schema = None self.urn = None self.kind = None + self.azure_rbac_actions = azure_rbac_actions + self.azure_rbac_data_actions = azure_rbac_data_actions self.runtime_properties = runtime_properties @@ -414,7 +428,7 @@ class CapabilityTypeListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -438,7 +452,7 @@ class CapabilityTypePropertiesRuntimeProperties(_serialization.Model): "kind": {"key": "kind", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.kind = None @@ -484,8 +498,8 @@ def __init__( duration: datetime.timedelta, parameters: List["_models.KeyValuePair"], selector_id: str, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: String that represents a Capability URN. Required. :paramtype name: str @@ -528,7 +542,7 @@ class DelayAction(Action): "duration": {"key": "duration", "type": "duration"}, } - def __init__(self, *, name: str, duration: datetime.timedelta, **kwargs): + def __init__(self, *, name: str, duration: datetime.timedelta, **kwargs: Any) -> None: """ :keyword name: String that represents a Capability URN. Required. :paramtype name: str @@ -569,7 +583,7 @@ class DiscreteAction(Action): "selector_id": {"key": "selectorId", "type": "str"}, } - def __init__(self, *, name: str, parameters: List["_models.KeyValuePair"], selector_id: str, **kwargs): + def __init__(self, *, name: str, parameters: List["_models.KeyValuePair"], selector_id: str, **kwargs: Any) -> None: """ :keyword name: String that represents a Capability URN. Required. :paramtype name: str @@ -605,7 +619,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 @@ -645,7 +659,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 @@ -656,7 +670,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.chaos.models.ErrorDetail @@ -666,7 +681,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.chaos.models.ErrorDetail @@ -676,7 +691,8 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. Variables are only populated by the server, and will be ignored when sending a request. @@ -711,7 +727,7 @@ class TrackedResource(Resource): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -787,8 +803,8 @@ def __init__( tags: Optional[Dict[str, str]] = None, identity: Optional["_models.ResourceIdentity"] = None, start_on_creation: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -833,7 +849,7 @@ class ExperimentCancelOperationResult(_serialization.Model): "status_url": {"key": "statusUrl", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -861,7 +877,7 @@ class ExperimentExecutionActionTargetDetailsError(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -901,7 +917,7 @@ class ExperimentExecutionActionTargetDetailsProperties(_serialization.Model): "error": {"key": "error", "type": "ExperimentExecutionActionTargetDetailsError"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.status = None @@ -972,7 +988,7 @@ class ExperimentExecutionDetails(_serialization.Model): # pylint: disable=too-m }, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -1009,7 +1025,7 @@ class ExperimentExecutionDetailsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -1033,7 +1049,7 @@ class ExperimentExecutionDetailsPropertiesRunInformation(_serialization.Model): "steps": {"key": "steps", "type": "[StepStatus]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.steps = None @@ -1060,7 +1076,7 @@ class ExperimentListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -1088,7 +1104,7 @@ class ExperimentStartOperationResult(_serialization.Model): "status_url": {"key": "statusUrl", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -1132,7 +1148,7 @@ class ExperimentStatus(_serialization.Model): "end_date_utc": {"key": "properties.endDateUtc", "type": "iso-8601"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -1164,13 +1180,33 @@ class ExperimentStatusListResult(_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 ExperimentUpdate(_serialization.Model): + """Describes an experiment update. + + :ivar identity: The identity of the experiment resource. + :vartype identity: ~azure.mgmt.chaos.models.ResourceIdentity + """ + + _attribute_map = { + "identity": {"key": "identity", "type": "ResourceIdentity"}, + } + + def __init__(self, *, identity: Optional["_models.ResourceIdentity"] = None, **kwargs: Any) -> None: + """ + :keyword identity: The identity of the experiment resource. + :paramtype identity: ~azure.mgmt.chaos.models.ResourceIdentity + """ + super().__init__(**kwargs) + self.identity = identity + + class Filter(_serialization.Model): """Model that represents available filter types that can be applied to a targets list. @@ -1194,7 +1230,7 @@ class Filter(_serialization.Model): _subtype_map = {"type": {"Simple": "SimpleFilter"}} - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type: Optional[str] = None @@ -1221,7 +1257,7 @@ class KeyValuePair(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, key: str, value: str, **kwargs): + def __init__(self, *, key: str, value: str, **kwargs: Any) -> None: """ :keyword key: The name of the setting for the action. Required. :paramtype key: str @@ -1233,6 +1269,124 @@ def __init__(self, *, key: str, value: str, **kwargs): self.value = value +class Selector(_serialization.Model): + """Model that represents a selector in the Experiment resource. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ListSelector, QuerySelector + + All required parameters must be populated in order to send to Azure. + + :ivar additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, any] + :ivar type: Enum of the selector type. Required. Known values are: "List" and "Query". + :vartype type: str or ~azure.mgmt.chaos.models.SelectorType + :ivar id: String of the selector ID. Required. + :vartype id: str + :ivar filter: Model that represents available filter types that can be applied to a targets + list. + :vartype filter: ~azure.mgmt.chaos.models.Filter + """ + + _validation = { + "type": {"required": True}, + "id": {"required": True, "min_length": 1}, + } + + _attribute_map = { + "additional_properties": {"key": "", "type": "{object}"}, + "type": {"key": "type", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "filter": {"key": "filter", "type": "Filter"}, + } + + _subtype_map = {"type": {"List": "ListSelector", "Query": "QuerySelector"}} + + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + additional_properties: Optional[Dict[str, Any]] = None, + filter: Optional["_models.Filter"] = None, # pylint: disable=redefined-builtin + **kwargs: Any + ) -> None: + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword id: String of the selector ID. Required. + :paramtype id: str + :keyword filter: Model that represents available filter types that can be applied to a targets + list. + :paramtype filter: ~azure.mgmt.chaos.models.Filter + """ + super().__init__(**kwargs) + self.additional_properties = additional_properties + self.type: Optional[str] = None + self.id = id + self.filter = filter + + +class ListSelector(Selector): + """Model that represents a list selector. + + All required parameters must be populated in order to send to Azure. + + :ivar additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, any] + :ivar type: Enum of the selector type. Required. Known values are: "List" and "Query". + :vartype type: str or ~azure.mgmt.chaos.models.SelectorType + :ivar id: String of the selector ID. Required. + :vartype id: str + :ivar filter: Model that represents available filter types that can be applied to a targets + list. + :vartype filter: ~azure.mgmt.chaos.models.Filter + :ivar targets: List of Target references. Required. + :vartype targets: list[~azure.mgmt.chaos.models.TargetReference] + """ + + _validation = { + "type": {"required": True}, + "id": {"required": True, "min_length": 1}, + "targets": {"required": True, "min_items": 1}, + } + + _attribute_map = { + "additional_properties": {"key": "", "type": "{object}"}, + "type": {"key": "type", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "filter": {"key": "filter", "type": "Filter"}, + "targets": {"key": "targets", "type": "[TargetReference]"}, + } + + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + targets: List["_models.TargetReference"], + additional_properties: Optional[Dict[str, Any]] = None, + filter: Optional["_models.Filter"] = None, # pylint: disable=redefined-builtin + **kwargs: Any + ) -> None: + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword id: String of the selector ID. Required. + :paramtype id: str + :keyword filter: Model that represents available filter types that can be applied to a targets + list. + :paramtype filter: ~azure.mgmt.chaos.models.Filter + :keyword targets: List of Target references. Required. + :paramtype targets: list[~azure.mgmt.chaos.models.TargetReference] + """ + super().__init__(additional_properties=additional_properties, id=id, filter=filter, **kwargs) + self.type: str = "List" + self.targets = targets + + class Operation(_serialization.Model): """Details of a REST API operation, returned from the Resource Provider Operations API. @@ -1270,7 +1424,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.chaos.models.OperationDisplay @@ -1316,7 +1470,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 @@ -1326,7 +1480,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. @@ -1346,23 +1501,96 @@ 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 QuerySelector(Selector): + """Model that represents a query selector. + + All required parameters must be populated in order to send to Azure. + + :ivar additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, any] + :ivar type: Enum of the selector type. Required. Known values are: "List" and "Query". + :vartype type: str or ~azure.mgmt.chaos.models.SelectorType + :ivar id: String of the selector ID. Required. + :vartype id: str + :ivar filter: Model that represents available filter types that can be applied to a targets + list. + :vartype filter: ~azure.mgmt.chaos.models.Filter + :ivar query_string: Azure Resource Graph (ARG) Query Language query for target resources. + Required. + :vartype query_string: str + :ivar subscription_ids: Subscription id list to scope resource query. Required. + :vartype subscription_ids: list[str] + """ + + _validation = { + "type": {"required": True}, + "id": {"required": True, "min_length": 1}, + "query_string": {"required": True}, + "subscription_ids": {"required": True, "min_items": 1}, + } + + _attribute_map = { + "additional_properties": {"key": "", "type": "{object}"}, + "type": {"key": "type", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "filter": {"key": "filter", "type": "Filter"}, + "query_string": {"key": "queryString", "type": "str"}, + "subscription_ids": {"key": "subscriptionIds", "type": "[str]"}, + } + + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + query_string: str, + subscription_ids: List[str], + additional_properties: Optional[Dict[str, Any]] = None, + filter: Optional["_models.Filter"] = None, # pylint: disable=redefined-builtin + **kwargs: Any + ) -> None: + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword id: String of the selector ID. Required. + :paramtype id: str + :keyword filter: Model that represents available filter types that can be applied to a targets + list. + :paramtype filter: ~azure.mgmt.chaos.models.Filter + :keyword query_string: Azure Resource Graph (ARG) Query Language query for target resources. + Required. + :paramtype query_string: str + :keyword subscription_ids: Subscription id list to scope resource query. Required. + :paramtype subscription_ids: list[str] + """ + super().__init__(additional_properties=additional_properties, id=id, filter=filter, **kwargs) + self.type: str = "Query" + self.query_string = query_string + self.subscription_ids = subscription_ids + + class ResourceIdentity(_serialization.Model): - """The managed identity of a resource. + """The identity of a resource. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar type: String of the resource identity type. Required. Known values are: "None" and - "SystemAssigned". + :ivar type: String of the resource identity type. Required. Known values are: "None", + "SystemAssigned", and "UserAssigned". :vartype type: str or ~azure.mgmt.chaos.models.ResourceIdentityType + :ivar user_assigned_identities: The list of user identities associated with the Experiment. The + user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :vartype user_assigned_identities: dict[str, ~azure.mgmt.chaos.models.UserAssignedIdentity] :ivar principal_id: GUID that represents the principal ID of this resource identity. :vartype principal_id: str :ivar tenant_id: GUID that represents the tenant ID of this resource identity. @@ -1383,78 +1611,32 @@ class ResourceIdentity(_serialization.Model): _attribute_map = { "type": {"key": "type", "type": "str"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, "principal_id": {"key": "principalId", "type": "str"}, "tenant_id": {"key": "tenantId", "type": "str"}, } - def __init__(self, *, type: Union[str, "_models.ResourceIdentityType"], **kwargs): - """ - :keyword type: String of the resource identity type. Required. Known values are: "None" and - "SystemAssigned". - :paramtype type: str or ~azure.mgmt.chaos.models.ResourceIdentityType - """ - super().__init__(**kwargs) - self.type = type - self.principal_id = None - self.tenant_id = None - - -class Selector(_serialization.Model): - """Model that represents a selector in the Experiment resource. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Enum of the selector type. Required. Known values are: "Percent", "Random", "Tag", - and "List". - :vartype type: str or ~azure.mgmt.chaos.models.SelectorType - :ivar id: String of the selector ID. Required. - :vartype id: str - :ivar targets: List of Target references. Required. - :vartype targets: list[~azure.mgmt.chaos.models.TargetReference] - :ivar filter: Model that represents available filter types that can be applied to a targets - list. - :vartype filter: ~azure.mgmt.chaos.models.Filter - """ - - _validation = { - "type": {"required": True}, - "id": {"required": True, "min_length": 1}, - "targets": {"required": True, "min_items": 1}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "targets": {"key": "targets", "type": "[TargetReference]"}, - "filter": {"key": "filter", "type": "Filter"}, - } - def __init__( self, *, - type: Union[str, "_models.SelectorType"], - id: str, # pylint: disable=redefined-builtin - targets: List["_models.TargetReference"], - filter: Optional["_models.Filter"] = None, # pylint: disable=redefined-builtin - **kwargs - ): + type: Union[str, "_models.ResourceIdentityType"], + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + **kwargs: Any + ) -> None: """ - :keyword type: Enum of the selector type. Required. Known values are: "Percent", "Random", - "Tag", and "List". - :paramtype type: str or ~azure.mgmt.chaos.models.SelectorType - :keyword id: String of the selector ID. Required. - :paramtype id: str - :keyword targets: List of Target references. Required. - :paramtype targets: list[~azure.mgmt.chaos.models.TargetReference] - :keyword filter: Model that represents available filter types that can be applied to a targets - list. - :paramtype filter: ~azure.mgmt.chaos.models.Filter + :keyword type: String of the resource identity type. Required. Known values are: "None", + "SystemAssigned", and "UserAssigned". + :paramtype type: str or ~azure.mgmt.chaos.models.ResourceIdentityType + :keyword user_assigned_identities: The list of user identities associated with the Experiment. + The user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :paramtype user_assigned_identities: dict[str, ~azure.mgmt.chaos.models.UserAssignedIdentity] """ super().__init__(**kwargs) self.type = type - self.id = id - self.targets = targets - self.filter = filter + self.user_assigned_identities = user_assigned_identities + self.principal_id = None + self.tenant_id = None class SimpleFilter(Filter): @@ -1478,7 +1660,7 @@ class SimpleFilter(Filter): "parameters": {"key": "parameters", "type": "SimpleFilterParameters"}, } - def __init__(self, *, parameters: Optional["_models.SimpleFilterParameters"] = None, **kwargs): + def __init__(self, *, parameters: Optional["_models.SimpleFilterParameters"] = None, **kwargs: Any) -> None: """ :keyword parameters: Model that represents the Simple filter parameters. :paramtype parameters: ~azure.mgmt.chaos.models.SimpleFilterParameters @@ -1499,7 +1681,7 @@ class SimpleFilterParameters(_serialization.Model): "zones": {"key": "zones", "type": "[str]"}, } - def __init__(self, *, zones: Optional[List[str]] = None, **kwargs): + def __init__(self, *, zones: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword zones: List of Azure availability zones to filter targets by. :paramtype zones: list[str] @@ -1529,7 +1711,7 @@ class Step(_serialization.Model): "branches": {"key": "branches", "type": "[Branch]"}, } - def __init__(self, *, name: str, branches: List["_models.Branch"], **kwargs): + def __init__(self, *, name: str, branches: List["_models.Branch"], **kwargs: Any) -> None: """ :keyword name: String of the step name. Required. :paramtype name: str @@ -1570,7 +1752,7 @@ class StepStatus(_serialization.Model): "branches": {"key": "branches", "type": "[BranchStatus]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.step_name = None @@ -1616,8 +1798,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 @@ -1683,7 +1865,7 @@ class Target(Resource): "properties": {"key": "properties", "type": "{object}"}, } - def __init__(self, *, properties: Dict[str, Any], location: Optional[str] = None, **kwargs): + def __init__(self, *, properties: Dict[str, Any], location: Optional[str] = None, **kwargs: Any) -> None: """ :keyword location: Location of the target resource. :paramtype location: str @@ -1717,7 +1899,7 @@ class TargetListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -1727,18 +1909,16 @@ def __init__(self, **kwargs): class TargetReference(_serialization.Model): """Model that represents a reference to a Target in the selector. - 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 type: Enum of the Target reference type. Required. Default value is "ChaosTarget". - :vartype type: str + :ivar type: Enum of the Target reference type. Required. "ChaosTarget" + :vartype type: str or ~azure.mgmt.chaos.models.TargetReferenceType :ivar id: String of the resource ID of a Target resource. Required. :vartype id: str """ _validation = { - "type": {"required": True, "constant": True}, + "type": {"required": True}, "id": { "required": True, "pattern": r"^\/[Ss][Uu][Bb][Ss][Cc][Rr][Ii][Pp][Tt][Ii][Oo][Nn][Ss]\/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}\/[Rr][Ee][Ss][Oo][Uu][Rr][Cc][Ee][Gg][Rr][Oo][Uu][Pp][Ss]\/[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]\/[Pp][Rr][Oo][Vv][Ii][Dd][Ee][Rr][Ss]\/[a-zA-Z0-9]+\.[a-zA-Z0-9]+\/[a-zA-Z0-9_\-\.]+\/[a-zA-Z0-9_\-\.]+\/[Pp][Rr][Oo][Vv][Ii][Dd][Ee][Rr][Ss]\/[Mm][Ii][Cc][Rr][Oo][Ss][Oo][Ff][Tt]\.[Cc][Hh][Aa][Oo][Ss]\/[Tt][Aa][Rr][Gg][Ee][Tt][Ss]\/[a-zA-Z0-9_\-\.]+$", @@ -1750,14 +1930,21 @@ class TargetReference(_serialization.Model): "id": {"key": "id", "type": "str"}, } - type = "ChaosTarget" - - def __init__(self, *, id: str, **kwargs): # pylint: disable=redefined-builtin + def __init__( + self, + *, + type: Union[str, "_models.TargetReferenceType"], + id: str, # pylint: disable=redefined-builtin + **kwargs: Any + ) -> None: """ + :keyword type: Enum of the Target reference type. Required. "ChaosTarget" + :paramtype type: str or ~azure.mgmt.chaos.models.TargetReferenceType :keyword id: String of the resource ID of a Target resource. Required. :paramtype id: str """ super().__init__(**kwargs) + self.type = type self.id = id @@ -1811,7 +1998,7 @@ class TargetType(Resource): "resource_types": {"key": "properties.resourceTypes", "type": "[str]"}, } - def __init__(self, *, location: Optional[str] = None, **kwargs): + def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None: """ :keyword location: Location of the Target Type resource. :paramtype location: str @@ -1846,8 +2033,36 @@ class TargetTypeListResult(_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 UserAssignedIdentity(_serialization.Model): + """User assigned identity properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of the assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the assigned identity. + :vartype client_id: str + """ + + _validation = { + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.principal_id = None + self.client_id = None diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_capabilities_operations.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_capabilities_operations.py index ec63dd87541a..b9a0e283f272 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_capabilities_operations.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_capabilities_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, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ 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]] @@ -55,9 +50,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-10-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,9 +108,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-10-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -174,9 +165,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-10-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -233,9 +222,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-10-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -336,9 +323,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.CapabilityListResult] = kwargs.pop("cls", None) error_map = { @@ -396,8 +381,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 @@ -456,9 +442,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.Capability] = kwargs.pop("cls", None) request = build_get_request( @@ -477,8 +461,9 @@ def get( 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 @@ -541,9 +526,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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( @@ -562,8 +545,9 @@ def delete( # 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 @@ -687,8 +671,8 @@ def create_or_update( :type target_name: str :param capability_name: String that represents a Capability resource name. Required. :type capability_name: str - :param capability: Capability resource to be created or updated. Is either a model type or a IO - type. Required. + :param capability: Capability resource to be created or updated. Is either a Capability type or + a IO type. Required. :type capability: ~azure.mgmt.chaos.models.Capability or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -709,9 +693,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.Capability] = kwargs.pop("cls", None) @@ -742,8 +724,9 @@ def create_or_update( 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 diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_capability_types_operations.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_capability_types_operations.py index 035935961d7f..54d1bae29f33 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_capability_types_operations.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_capability_types_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, _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]] @@ -52,9 +47,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-10-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94,9 +87,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-10-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -173,9 +164,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.CapabilityTypeListResult] = kwargs.pop("cls", None) error_map = { @@ -230,8 +219,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 @@ -276,9 +266,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.CapabilityType] = kwargs.pop("cls", None) request = build_get_request( @@ -294,8 +282,9 @@ def get( 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 diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_experiments_operations.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_experiments_operations.py index dd34ee85ea61..b86d162b8d35 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_experiments_operations.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_experiments_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, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ 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]] @@ -51,9 +46,7 @@ def build_list_all_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-10-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,9 +88,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-10-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -140,9 +131,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-10-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -182,9 +171,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-10-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -224,9 +211,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-10-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -263,15 +248,56 @@ def build_create_or_update_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) +def build_update_request( + resource_group_name: str, experiment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-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.Chaos/experiments/{experimentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url( + "subscription_id", + subscription_id, + "str", + pattern=r"^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$", + ), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", pattern=r"^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$" + ), + "experimentName": _SERIALIZER.url( + "experiment_name", experiment_name, "str", min_length=1, pattern=r"^[^<>%&:?#/\\]+$" + ), + } + + _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_cancel_request( resource_group_name: str, experiment_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-10-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -311,9 +337,7 @@ def build_start_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-10-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -353,9 +377,7 @@ def build_list_all_statuses_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-10-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -395,9 +417,7 @@ def build_get_status_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-10-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -443,9 +463,7 @@ def build_list_execution_details_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-10-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -485,9 +503,7 @@ def build_get_execution_details_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-10-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -567,9 +583,7 @@ def list_all( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.ExperimentListResult] = kwargs.pop("cls", None) error_map = { @@ -623,8 +637,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 @@ -666,9 +681,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.ExperimentListResult] = kwargs.pop("cls", None) error_map = { @@ -723,8 +736,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 @@ -767,9 +781,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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( @@ -784,8 +796,9 @@ def delete( # 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 @@ -826,9 +839,7 @@ def get(self, resource_group_name: str, experiment_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.Experiment] = kwargs.pop("cls", None) request = build_get_request( @@ -843,8 +854,9 @@ def get(self, resource_group_name: str, experiment_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 @@ -929,8 +941,8 @@ def create_or_update( :type resource_group_name: str :param experiment_name: String that represents a Experiment resource name. Required. :type experiment_name: str - :param experiment: Experiment resource to be created or updated. Is either a model type or a IO - type. Required. + :param experiment: Experiment resource to be created or updated. Is either a Experiment type or + a IO type. Required. :type experiment: ~azure.mgmt.chaos.models.Experiment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -951,9 +963,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.Experiment] = kwargs.pop("cls", None) @@ -980,8 +990,9 @@ def create_or_update( 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 @@ -1002,6 +1013,146 @@ def create_or_update( "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}" } + @overload + def update( + self, + resource_group_name: str, + experiment_name: str, + experiment: _models.ExperimentUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Experiment: + """The operation to update an experiment. + + :param resource_group_name: String that represents an Azure resource group. Required. + :type resource_group_name: str + :param experiment_name: String that represents a Experiment resource name. Required. + :type experiment_name: str + :param experiment: Parameters supplied to the Update experiment operation. Required. + :type experiment: ~azure.mgmt.chaos.models.ExperimentUpdate + :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: Experiment or the result of cls(response) + :rtype: ~azure.mgmt.chaos.models.Experiment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + experiment_name: str, + experiment: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Experiment: + """The operation to update an experiment. + + :param resource_group_name: String that represents an Azure resource group. Required. + :type resource_group_name: str + :param experiment_name: String that represents a Experiment resource name. Required. + :type experiment_name: str + :param experiment: Parameters supplied to the Update experiment operation. Required. + :type experiment: 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: Experiment or the result of cls(response) + :rtype: ~azure.mgmt.chaos.models.Experiment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + experiment_name: str, + experiment: Union[_models.ExperimentUpdate, IO], + **kwargs: Any + ) -> _models.Experiment: + """The operation to update an experiment. + + :param resource_group_name: String that represents an Azure resource group. Required. + :type resource_group_name: str + :param experiment_name: String that represents a Experiment resource name. Required. + :type experiment_name: str + :param experiment: Parameters supplied to the Update experiment operation. Is either a + ExperimentUpdate type or a IO type. Required. + :type experiment: ~azure.mgmt.chaos.models.ExperimentUpdate 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: Experiment or the result of cls(response) + :rtype: ~azure.mgmt.chaos.models.Experiment + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Experiment] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(experiment, (IO, bytes)): + _content = experiment + else: + _json = self._serialize.body(experiment, "ExperimentUpdate") + + request = build_update_request( + resource_group_name=resource_group_name, + experiment_name=experiment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Experiment", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}" + } + @distributed_trace def cancel( self, resource_group_name: str, experiment_name: str, **kwargs: Any @@ -1028,9 +1179,7 @@ def cancel( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.ExperimentCancelOperationResult] = kwargs.pop("cls", None) request = build_cancel_request( @@ -1045,8 +1194,9 @@ def cancel( 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 @@ -1093,9 +1243,7 @@ def start( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.ExperimentStartOperationResult] = kwargs.pop("cls", None) request = build_start_request( @@ -1110,8 +1258,9 @@ def start( 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 @@ -1150,9 +1299,7 @@ def list_all_statuses( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.ExperimentStatusListResult] = kwargs.pop("cls", None) error_map = { @@ -1206,8 +1353,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 @@ -1252,9 +1400,7 @@ def get_status( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.ExperimentStatus] = kwargs.pop("cls", None) request = build_get_status_request( @@ -1270,8 +1416,9 @@ def get_status( 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 @@ -1311,9 +1458,7 @@ def list_execution_details( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.ExperimentExecutionDetailsListResult] = kwargs.pop("cls", None) error_map = { @@ -1367,8 +1512,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 @@ -1413,9 +1559,7 @@ def get_execution_details( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.ExperimentExecutionDetails] = kwargs.pop("cls", None) request = build_get_execution_details_request( @@ -1431,8 +1575,9 @@ def get_execution_details( 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 diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_operations.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_operations.py index 39f1fafbdb38..e0239ed80506 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_operations.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/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_all_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-10-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,9 +86,7 @@ def list_all(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_target_types_operations.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_target_types_operations.py index 288c30dd7beb..68f1f863ecc6 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_target_types_operations.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_target_types_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, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +42,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-10-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,9 +78,7 @@ def build_get_request(location_name: str, target_type_name: str, subscription_id _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-10-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -155,9 +146,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.TargetTypeListResult] = kwargs.pop("cls", None) error_map = { @@ -211,8 +200,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 @@ -253,9 +243,7 @@ def get(self, location_name: str, target_type_name: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.TargetType] = kwargs.pop("cls", None) request = build_get_request( @@ -270,8 +258,9 @@ def get(self, location_name: str, target_type_name: str, **kwargs: Any) -> _mode 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 diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_targets_operations.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_targets_operations.py index c14e5cd4817d..ba0d3c69cadc 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_targets_operations.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_targets_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, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ 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]] @@ -54,9 +49,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-10-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,9 +105,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-10-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -167,9 +158,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-10-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -222,9 +211,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-10-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -319,9 +306,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.TargetListResult] = kwargs.pop("cls", None) error_map = { @@ -378,8 +363,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 @@ -435,9 +421,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.Target] = kwargs.pop("cls", None) request = build_get_request( @@ -455,8 +439,9 @@ def get( 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 @@ -516,9 +501,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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( @@ -536,8 +519,9 @@ def delete( # 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 @@ -652,7 +636,7 @@ def create_or_update( :type parent_resource_name: str :param target_name: String that represents a Target resource name. Required. :type target_name: str - :param target: Target resource to be created or updated. Is either a model type or a IO type. + :param target: Target resource to be created or updated. Is either a Target type or a IO type. Required. :type target: ~azure.mgmt.chaos.models.Target or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -674,9 +658,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-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.Target] = kwargs.pop("cls", None) @@ -706,8 +688,9 @@ def create_or_update( 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 diff --git a/sdk/chaos/azure-mgmt-chaos/generated_samples/cancel_aexperiment.py b/sdk/chaos/azure-mgmt-chaos/generated_samples/cancel_aexperiment.py index deabeff9f647..1a24840da0e3 100644 --- a/sdk/chaos/azure-mgmt-chaos/generated_samples/cancel_aexperiment.py +++ b/sdk/chaos/azure-mgmt-chaos/generated_samples/cancel_aexperiment.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-10-01-preview/examples/CancelAExperiment.json +# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/CancelAExperiment.json if __name__ == "__main__": main() diff --git a/sdk/chaos/azure-mgmt-chaos/generated_samples/create_or_update_acapability.py b/sdk/chaos/azure-mgmt-chaos/generated_samples/create_or_update_acapability.py index 0984f7145098..e3f9d8546889 100644 --- a/sdk/chaos/azure-mgmt-chaos/generated_samples/create_or_update_acapability.py +++ b/sdk/chaos/azure-mgmt-chaos/generated_samples/create_or_update_acapability.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-10-01-preview/examples/CreateOrUpdateACapability.json +# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/CreateOrUpdateACapability.json if __name__ == "__main__": main() diff --git a/sdk/chaos/azure-mgmt-chaos/generated_samples/create_or_update_aexperiment.py b/sdk/chaos/azure-mgmt-chaos/generated_samples/create_or_update_aexperiment.py index dd3a19ccdfbf..8814a73aaabd 100644 --- a/sdk/chaos/azure-mgmt-chaos/generated_samples/create_or_update_aexperiment.py +++ b/sdk/chaos/azure-mgmt-chaos/generated_samples/create_or_update_aexperiment.py @@ -73,6 +73,6 @@ def main(): print(response) -# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-10-01-preview/examples/CreateOrUpdateAExperiment.json +# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/CreateOrUpdateAExperiment.json if __name__ == "__main__": main() diff --git a/sdk/chaos/azure-mgmt-chaos/generated_samples/create_or_update_atarget.py b/sdk/chaos/azure-mgmt-chaos/generated_samples/create_or_update_atarget.py index 45266488b90f..e6b6b856a418 100644 --- a/sdk/chaos/azure-mgmt-chaos/generated_samples/create_or_update_atarget.py +++ b/sdk/chaos/azure-mgmt-chaos/generated_samples/create_or_update_atarget.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-10-01-preview/examples/CreateOrUpdateATarget.json +# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/CreateOrUpdateATarget.json if __name__ == "__main__": main() diff --git a/sdk/chaos/azure-mgmt-chaos/generated_samples/delete_acapability.py b/sdk/chaos/azure-mgmt-chaos/generated_samples/delete_acapability.py index 51d7949f874d..16d06f6937b3 100644 --- a/sdk/chaos/azure-mgmt-chaos/generated_samples/delete_acapability.py +++ b/sdk/chaos/azure-mgmt-chaos/generated_samples/delete_acapability.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-10-01-preview/examples/DeleteACapability.json +# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/DeleteACapability.json if __name__ == "__main__": main() diff --git a/sdk/chaos/azure-mgmt-chaos/generated_samples/delete_aexperiment.py b/sdk/chaos/azure-mgmt-chaos/generated_samples/delete_aexperiment.py index 14b2fd497db9..f51bed6f44a0 100644 --- a/sdk/chaos/azure-mgmt-chaos/generated_samples/delete_aexperiment.py +++ b/sdk/chaos/azure-mgmt-chaos/generated_samples/delete_aexperiment.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-10-01-preview/examples/DeleteAExperiment.json +# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/DeleteAExperiment.json if __name__ == "__main__": main() diff --git a/sdk/chaos/azure-mgmt-chaos/generated_samples/delete_atarget.py b/sdk/chaos/azure-mgmt-chaos/generated_samples/delete_atarget.py index 8fad73cbc6b6..819ad22dc8fd 100644 --- a/sdk/chaos/azure-mgmt-chaos/generated_samples/delete_atarget.py +++ b/sdk/chaos/azure-mgmt-chaos/generated_samples/delete_atarget.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-10-01-preview/examples/DeleteATarget.json +# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/DeleteATarget.json if __name__ == "__main__": main() diff --git a/sdk/chaos/azure-mgmt-chaos/generated_samples/get_acapability.py b/sdk/chaos/azure-mgmt-chaos/generated_samples/get_acapability.py index 74474d1ef30b..67524b44cf20 100644 --- a/sdk/chaos/azure-mgmt-chaos/generated_samples/get_acapability.py +++ b/sdk/chaos/azure-mgmt-chaos/generated_samples/get_acapability.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-10-01-preview/examples/GetACapability.json +# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetACapability.json if __name__ == "__main__": main() diff --git a/sdk/chaos/azure-mgmt-chaos/generated_samples/get_acapability_type.py b/sdk/chaos/azure-mgmt-chaos/generated_samples/get_acapability_type.py index b4d07b19c335..44d279f8b9b5 100644 --- a/sdk/chaos/azure-mgmt-chaos/generated_samples/get_acapability_type.py +++ b/sdk/chaos/azure-mgmt-chaos/generated_samples/get_acapability_type.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-10-01-preview/examples/GetACapabilityType.json +# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetACapabilityType.json if __name__ == "__main__": main() diff --git a/sdk/chaos/azure-mgmt-chaos/generated_samples/get_aexperiment.py b/sdk/chaos/azure-mgmt-chaos/generated_samples/get_aexperiment.py index a7859b22fe88..9bde49e494b8 100644 --- a/sdk/chaos/azure-mgmt-chaos/generated_samples/get_aexperiment.py +++ b/sdk/chaos/azure-mgmt-chaos/generated_samples/get_aexperiment.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-10-01-preview/examples/GetAExperiment.json +# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetAExperiment.json if __name__ == "__main__": main() diff --git a/sdk/chaos/azure-mgmt-chaos/generated_samples/get_aexperiment_execution_details.py b/sdk/chaos/azure-mgmt-chaos/generated_samples/get_aexperiment_execution_details.py index fd08ea640f0a..01f59c47e05c 100644 --- a/sdk/chaos/azure-mgmt-chaos/generated_samples/get_aexperiment_execution_details.py +++ b/sdk/chaos/azure-mgmt-chaos/generated_samples/get_aexperiment_execution_details.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-10-01-preview/examples/GetAExperimentExecutionDetails.json +# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetAExperimentExecutionDetails.json if __name__ == "__main__": main() diff --git a/sdk/chaos/azure-mgmt-chaos/generated_samples/get_aexperiment_status.py b/sdk/chaos/azure-mgmt-chaos/generated_samples/get_aexperiment_status.py index c98a980dd77c..f91455706470 100644 --- a/sdk/chaos/azure-mgmt-chaos/generated_samples/get_aexperiment_status.py +++ b/sdk/chaos/azure-mgmt-chaos/generated_samples/get_aexperiment_status.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-10-01-preview/examples/GetAExperimentStatus.json +# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetAExperimentStatus.json if __name__ == "__main__": main() diff --git a/sdk/chaos/azure-mgmt-chaos/generated_samples/get_atarget.py b/sdk/chaos/azure-mgmt-chaos/generated_samples/get_atarget.py index b323a150ebcc..0ebd6adc92a9 100644 --- a/sdk/chaos/azure-mgmt-chaos/generated_samples/get_atarget.py +++ b/sdk/chaos/azure-mgmt-chaos/generated_samples/get_atarget.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-10-01-preview/examples/GetATarget.json +# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetATarget.json if __name__ == "__main__": main() diff --git a/sdk/chaos/azure-mgmt-chaos/generated_samples/get_atarget_type.py b/sdk/chaos/azure-mgmt-chaos/generated_samples/get_atarget_type.py index 2953f7c39d66..60f88b7330dc 100644 --- a/sdk/chaos/azure-mgmt-chaos/generated_samples/get_atarget_type.py +++ b/sdk/chaos/azure-mgmt-chaos/generated_samples/get_atarget_type.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-10-01-preview/examples/GetATargetType.json +# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetATargetType.json if __name__ == "__main__": main() diff --git a/sdk/chaos/azure-mgmt-chaos/generated_samples/list_capabilities.py b/sdk/chaos/azure-mgmt-chaos/generated_samples/list_capabilities.py index 2ce306676501..7ec0b454ef0f 100644 --- a/sdk/chaos/azure-mgmt-chaos/generated_samples/list_capabilities.py +++ b/sdk/chaos/azure-mgmt-chaos/generated_samples/list_capabilities.py @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-10-01-preview/examples/ListCapabilities.json +# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/ListCapabilities.json if __name__ == "__main__": main() diff --git a/sdk/chaos/azure-mgmt-chaos/generated_samples/list_capability_types.py b/sdk/chaos/azure-mgmt-chaos/generated_samples/list_capability_types.py index 411da1801b9a..95d924ba272e 100644 --- a/sdk/chaos/azure-mgmt-chaos/generated_samples/list_capability_types.py +++ b/sdk/chaos/azure-mgmt-chaos/generated_samples/list_capability_types.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-10-01-preview/examples/ListCapabilityTypes.json +# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/ListCapabilityTypes.json if __name__ == "__main__": main() diff --git a/sdk/chaos/azure-mgmt-chaos/generated_samples/list_experiment_executions_details.py b/sdk/chaos/azure-mgmt-chaos/generated_samples/list_experiment_executions_details.py index b8e93d354955..942fe7a83d46 100644 --- a/sdk/chaos/azure-mgmt-chaos/generated_samples/list_experiment_executions_details.py +++ b/sdk/chaos/azure-mgmt-chaos/generated_samples/list_experiment_executions_details.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-10-01-preview/examples/ListExperimentExecutionsDetails.json +# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/ListExperimentExecutionsDetails.json if __name__ == "__main__": main() diff --git a/sdk/chaos/azure-mgmt-chaos/generated_samples/list_experiment_statuses.py b/sdk/chaos/azure-mgmt-chaos/generated_samples/list_experiment_statuses.py index 4ba51b7a87ff..3d782caa0b17 100644 --- a/sdk/chaos/azure-mgmt-chaos/generated_samples/list_experiment_statuses.py +++ b/sdk/chaos/azure-mgmt-chaos/generated_samples/list_experiment_statuses.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-10-01-preview/examples/ListExperimentStatuses.json +# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/ListExperimentStatuses.json if __name__ == "__main__": main() diff --git a/sdk/chaos/azure-mgmt-chaos/generated_samples/list_experiments_in_aresource_group.py b/sdk/chaos/azure-mgmt-chaos/generated_samples/list_experiments_in_aresource_group.py index c0a340fda67d..01f301697ff8 100644 --- a/sdk/chaos/azure-mgmt-chaos/generated_samples/list_experiments_in_aresource_group.py +++ b/sdk/chaos/azure-mgmt-chaos/generated_samples/list_experiments_in_aresource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-10-01-preview/examples/ListExperimentsInAResourceGroup.json +# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/ListExperimentsInAResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/chaos/azure-mgmt-chaos/generated_samples/list_experiments_in_asubscription.py b/sdk/chaos/azure-mgmt-chaos/generated_samples/list_experiments_in_asubscription.py index 49403e457143..7b8b0ccf5b02 100644 --- a/sdk/chaos/azure-mgmt-chaos/generated_samples/list_experiments_in_asubscription.py +++ b/sdk/chaos/azure-mgmt-chaos/generated_samples/list_experiments_in_asubscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-10-01-preview/examples/ListExperimentsInASubscription.json +# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/ListExperimentsInASubscription.json if __name__ == "__main__": main() diff --git a/sdk/chaos/azure-mgmt-chaos/generated_samples/list_target_types.py b/sdk/chaos/azure-mgmt-chaos/generated_samples/list_target_types.py index 1a4611e56b9c..0796e573d4f1 100644 --- a/sdk/chaos/azure-mgmt-chaos/generated_samples/list_target_types.py +++ b/sdk/chaos/azure-mgmt-chaos/generated_samples/list_target_types.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-10-01-preview/examples/ListTargetTypes.json +# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/ListTargetTypes.json if __name__ == "__main__": main() diff --git a/sdk/chaos/azure-mgmt-chaos/generated_samples/list_targets.py b/sdk/chaos/azure-mgmt-chaos/generated_samples/list_targets.py index d2f150d8872a..0d604b702ba5 100644 --- a/sdk/chaos/azure-mgmt-chaos/generated_samples/list_targets.py +++ b/sdk/chaos/azure-mgmt-chaos/generated_samples/list_targets.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-10-01-preview/examples/ListTargets.json +# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/ListTargets.json if __name__ == "__main__": main() diff --git a/sdk/chaos/azure-mgmt-chaos/generated_samples/patch_experiment.py b/sdk/chaos/azure-mgmt-chaos/generated_samples/patch_experiment.py new file mode 100644 index 000000000000..92cd5013b40a --- /dev/null +++ b/sdk/chaos/azure-mgmt-chaos/generated_samples/patch_experiment.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.chaos import ChaosManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-chaos +# USAGE + python patch_experiment.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 = ChaosManagementClient( + credential=DefaultAzureCredential(), + subscription_id="6b052e15-03d3-4f17-b2e1-be7f07588291", + ) + + response = client.experiments.update( + resource_group_name="exampleRG", + experiment_name="exampleExperiment", + experiment={ + "identity": { + "type": "UserAssigned", + "userAssignedIdentities": { + "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.ManagedIdentity/userAssignedIdentity/exampleUMI": {} + }, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/PatchExperiment.json +if __name__ == "__main__": + main() diff --git a/sdk/chaos/azure-mgmt-chaos/generated_samples/start_aexperiment.py b/sdk/chaos/azure-mgmt-chaos/generated_samples/start_aexperiment.py index f97c83e7031c..7380abd953af 100644 --- a/sdk/chaos/azure-mgmt-chaos/generated_samples/start_aexperiment.py +++ b/sdk/chaos/azure-mgmt-chaos/generated_samples/start_aexperiment.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2022-10-01-preview/examples/StartAExperiment.json +# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/StartAExperiment.json if __name__ == "__main__": main()